Git Product home page Git Product logo

Comments (5)

jjlauer avatar jjlauer commented on August 28, 2024

I appreciate your feedback. Some of the naming is due to Rocker's first release which didn't support hot reloading and the base class for your template was simply RockerTemplate. To get hot reloading to work, I had to split up the arguments & template interface (model) from the actual code that did the rendering (template). They had to be in two classes so the classloader could be reloaded.

The two combined (model & renderer) are the template. When calling the static method "template()" -- i does return a model, but it logically is a template.

In my own java code, I always use a fully qualified class name to help make it clear I'm using a template. For example, I'll do "views.Xyz.template(arg1, arg2, ...)". If you personally like to use non qualified names, then I think naming it "XyzView" is maybe more appropriate. I think your being a little nitpicky on the base class being called a Model since you directly use the name of your template. Is model a perfect name, no, I'd agree with you there. But I was trying to reflect that it represents the arguments & interface to a template.

As for single use that was a design decision both for backwards and forwards compat. The original Rocker w/o hot reloading, required the setup of many variables that were only good for single use. That case doesn't hold in today's version, but I can think of a few ideas down the road where it's still good to encourage users to think of templates as single use / immutable once their used. If you can pitch me on ideas why you would like reuse, I'm open to understanding your use case.

Hope that helps!

from rocker.

jjlauer avatar jjlauer commented on August 28, 2024

@mnlipp Wanted to circle back with you on this issue.

from rocker.

mnlipp avatar mnlipp commented on August 28, 2024

To be honest, I had to rule out rocker from my project. I should have noticed earlier, but rocker isn't "OSGi compatible" (a feature that I need on the long run). I thought about making rocker (runtime) an OSGi bundle, but (1) I don't know how to do this with a maven build (2) rocker has too many dependencies which I'd have to check for OSGi support first. It's a danger when using maven-style repos and dependencies that one actually doesn't really care enough about transient dependencies because they are pulled in automatically. (Probably the "worst" dependency from my personal point of view is the dependency on netty because my project is partially about an alternative to netty, so kind of silly to get this pulled in.)

Actually, OSGi support seems to be a kind of blind spot with template engines. I had to "revert" to "good" old Freemarker, which seems to be the only one that claims active OSGi support (and has no dependencies, which makes it really easy to integrate). Rocker's template syntax is much nicer and I would have loved to use it, but, well, see above...

from rocker.

jjlauer avatar jjlauer commented on August 28, 2024

@mnlipp Appreciate the feedback. Rocker-runtime doesn't have any other runtime dependencies -- so not sure I totally understand some of your feedback. Netty, for example, is scoped as a test dependency for a demo of rocker w/ asynchronous IO. As far as OSGI, I'd be open to it, but I suspect Java 9 will change the game dramatically. I do plan on fully supporting Java 9 modules once its released.

from rocker.

mnlipp avatar mnlipp commented on August 28, 2024

Ah, I admit that I have only looked at the pom.xml and seen the dependencies enumerated there. Maybe I'll try to setup a gradle build to find out about the real dependencies (and add OSGi info), but it won't be any time soon.

Java 9 modules aren't a replacement for OSGi (e.g. no versioning, no support for dynamic service loading). I'm not sure yet, however, if the two can coexist in one module/bundle project or if one has to make a choice.

from rocker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.