Navigation

RSS 2.0 New Entries Syndication Feed Atom 0.3 New Entries Syndication Feed

Show blog menu v

 

General

Use it

Documentation

Support

Sibling projects

RIFE powered

Valid XHTML 1.0 Transitional

Valid CSS!

Blogs : Archives

avatar
< Act TODAY against European software patents   Drone IRC Bot v1.2 released >
Re: Hype: Ruby on Rails

I started writing a comment on Patrick's post, and it become so large that I'm making a seperate blog post out of it:

Lucas, while there are definitely advantages to providing sensible default behavior through an implicit approach, your example is so ridiculous that it's difficult to give your statement any credibility. Any micro comparison of source code length, or even the simple fact that you're comparing number of lines should make many developers look away.

It's utterly ridiculous to compare how long it took you to bash a simple application together. What is important (to me) is that I will be able to maintain that application for years and years, that other developers can easily find their way and take it over, that there's no doubt, that the maintenance cost doesn't get too high for the customer, that I don't have to spend days to just try to unravel what I did years ago and that I can easily call someone to help me out for a brief period when I find that the workload is too high.

I agree that many frameworks went a bit overboard in the configuration department, but starting off with implicit 'magic' behavior doesn't really rock my boat either.

About tadalist, that application is so stupid that I'm wondering how the hell it could have taken him 600 lines to write it. Also, the hugely hiped 'killer application' of RoR, Basecamp, is a total fraud imho. The screenshots look nice, and are nicely presented. So I did make an account and started using it. And honestly, everything they say is true, it sets itself apart in simplicity. Not difficult to write that in a few weeks. At least I hoped that the critical errors that I got during the testing would have disappeared after so many months of hyping. This made me really wonder about the maintainability and the transparency of a system written in RoR. If the demonstration application about which workshops are given refused me to perform work by spewing critical errors, I get rather suspicious. I revoked my account since I felt quite cut down in productivity by using it.

Lastly, I think that driving a web application from a database structure is totally backwards. It makes it very difficult to migrate to other structures over time and you're limited by the meta-data that your database supports. If you want to base yourself on a data structure, you should use domain objects with appropriate meta-data. Of course, then you get some kind of configuration and your precious line count might increase.

While RoR is greatly marketed and that Active Records nicely uses some of Ruby's features, I yet have to see something that really impresses me. Writing Ruby code in the middle of your HTML certainly didn't.

posted by Geert Bevin on Jan 22, 2005 2:20 AM : 56 comments [permalink]
 

Comments

Re: Re: Hype: Ruby on Rails

>About tadalist, that application is so stupid that I'm wondering how the hell it could have taken him 600 lines to write it.

Rather than talking, why don't you create something real? Give some proof that you can back up what you say.

Re: Re: Hype: Ruby on Rails

Sure, will do

Re: Re: Hype: Ruby on Rails

"And honestly, everything they say is true, it sets itself apart in simplicity. Not difficult to write that in a few weeks."

I've heard people say this so often in working in software. It's never, ever, turned out to be true when they try to go do it. Building something that "sets itself apart in simplicity" is probably the hardest thing you can do in designing and building software, and if you just look around your desktop you'll probably agree.

Re: Re: Hype: Ruby on Rails

Andrew, there's clear difference in designing a simple application and the actual implementation of it. The design is independent of the framework that is used, it can be implemented in anything. I do agree that stripping away the cruft is a rare quality. However, stripping down features and simplifying the interface generally makes the implementation easier and smaller. When RoR advocates make their loc statements they should be done in context. Saying that the whole Tadalist implementation is smaller than the configuration of most J2EE apps is a typical out-of-context hype statement that comes close to ignorance.

Re: Re: Hype: Ruby on Rails

" The design is independent of the framework that is used, it can be implemented in anything."

I don't know. My experience is that decisions about frameworks *always* have some impact on the design, even though developers and designers agree that they shouldn't.

I have to agree with you that the LoC argument is kind of pointless. There's clearly no correlation between LoC and inherently good or bad products.

Re: Re: Hype: Ruby on Rails

Nothing is every that clear Andrew. What if two programs do the exact same thing in the same programming language, the only difference is that one is written in half of the code? I think most professionals would agree that the one written in less code is more than likely a better product than the other one. For one thing, it more than likely has fewer bugs, but at the very least it is easier to maintain.

Open your eyes with a couple articles written by the guy who wrote the very first e-commerce application for the web.

http://paulgraham.com/avg.html
http://paulgraham.com/power.html
Re: Re: Hype: Ruby on Rails

I can write a ten line Perl program that is horrible to maintain.

Re: Re: Hype: Ruby on Rails

One word about "less lines of code": APL. And please, avoid bringing up old'Paul in discussions like this. He knows his Lisp shit, but in other matters he talks more like a cult-leader than an engineer.

Re: Re: Hype: Ruby on Rails

"Writing Ruby code in the middle of your HTML certainly didn't."

It's always the same problem with Java zealots and the V of MVC...

See my other comment on that topic on Patrick's blog : http://www.lightbody.net/mt/mtc.cgi?entry_id=144

It's not because you're writing Ruby in your template that you're writing actual business or domain logic in your HTML... Ruby is much more expressive, elegant and less verbose than every single microlanguage you may come with to develop your views in Java (JSP scriptlets and/or tags, velocity, XSLT, ...)

Java web frameworks will always suck as long as they only focus on providing the infrastructure to dispatch and process requests while completely missing the point when it comes to provide an efficient way to build the part of the system that actually interacts with the end-user and which has its own requirements.

Get back to earth guys, XHTML is not hazardous material it's what your user sees and feels!

Re: Re: Hype: Ruby on Rails

Templates shouldn't contain *any* logic. Period.

Re: Re: Hype: Ruby on Rails

Cool, now we, bloggars have our blog-se-tbar - http://blogsearchengine.com/blog/index.php?p=123 !

Re: Re: Hype: Ruby on Rails

Geert: Template need to have a presentation logic, common. Do your search, think, etc. You need presentation logic and that is probably the best combinaison of word you can use to justify that kind of logic.

In any language, no matter what, if you display a list of something, you need to give the logic that: what is the list, what is the element, what is the part of the elment that you will output.

It is not because you use a programming language, a template language or whetever you call it, that there is no logic.

ex. algorithm:

[table]
foreach elements as element
{
[tr]
[td]element.title[/td]
[td]element.description[/td]
[td]element.anything_else[/td]
[/tr]
}
endforeach

[/table]

How would you do that withouth ANY logic? Explain that to everyone. ;-)

Even if you say in xml

[loop: list="elements" token="element"]
some code that also tell which element to show

[/loop]

Or any similar solution, it is still PRESENTATION LOGIC.

However, maybe you will impress everyone and tell me what way you do not do any logic in your magical template?

(I might have missed something, I firstly wrote my example with the html tag and it erased everything even in the edit box. crap.)

Re: Re: Hype: Ruby on Rails

Sure you can build a template system that doesn't require the inclusion of logic. The main approach for that is stop think of a template as something that has only placeholders for values and needs logic for anything else. Ie. stop looking as templates that are only populated, but also make them provisional. Templates can also be blueprints that contain the standard value placeholders but also provide blocks of text that can be retrieved from within your application. If you then make the template engine a bit more functional and add support for intermediate building and construction, add deferred value replacement, add some byte encoding caching, etc etc and you get something very functional without any logic inside. What's the advantage? You can very easily build themes or variations without having to carefully preserve the logic that's inside. More info here: http://rifers.org/wiki/display/RIFE/Bidirectional+template+engine

I'm well aware that many people don't like this approach, but it has worked extremely well for us for almost 5 years. It's 100% possible to conceive a template engine that abolishes logic inside the templates competely.

Re: Re: Hype: Ruby on Rails

Xavier, stop thinking you know everybody else. I pretty damn well know my XHtml, CSS, Javascript, DHtml and I manually built more complex designs than any of the Rails apps I've seen. I also probably wrote more pure Javascript than many wrote XHtml. I'm being accused by some RoR people that I didn't look deep enough before judging (imho I looked enough), many RoR activists I see just shout and categorize people without even looking at one single thing. You guys seem to be worse than what you accuse others of being.

Re: Re: Hype: Ruby on Rails

Geert,

I'm sorry you have to go through this. David is a pretentious, attention-starved asshole - not to mention a cry-baby.

I agree with you. Basecamp is no big deal. TadaList is no big deal. RoR includes some interesting ideas, but it's not ground breaking, and certainly not the revolution in web development that David and his groupies make it out to be. There are plenty of things wrong with it. Both of these apps could have been written in short order by anyone sufficiently skilled in ANY language. I don't see why everyone is particularly impressed with either one.

Thanks for being one of the first to speak up.

Re: Re: Hype: Ruby on Rails
Hi Kostas, thanks for this sensible comment. Great to see that I'm not alone to speak up about this :-)
I was just so unnerved about all this hype about fluff and, as you mention it so well, about all the groupies. I thought it was time that someone just honestly took position for other views and after Patrick doing it, I didn't want to leave him standing on the hill top alone ;-). What I find amazing is that I never said anything accusatory about RoR, Basecamp or Tada. I merely said that the basecamp *marketing* caused me to feel that it was a fraud after trying it out, that Tada is a stupid application *idea* which inheretly takes little lines of code and that after glancing at RoR I liked some parts and didn't like others. All of a sudden I started a holy war ;-)
Re: Re: Hype: Ruby on Rails

Geert, don't take it personally (btw, thanks for the "mindless comment" on Patrick's blog).

It was a more general remark about the Java Web frameworks. Your biditemplate concept looks interresting, altghough I find the description a bit vague and some example could help understanding how it works in real life. But this approach is certainly several order of magnitude more complex to master and use than what Rails has to offer in its default setup just to deal with something I probably Ain't Gonna Need.

I still believe that presentation logic is not evil and shouldn't be considered harmful... it's actually this layer which adds all the value to Basecamp and Tadalist. Of course the model behind is simple but that's all the details in the UI that makes these stand out of the crowd.

Re: Re: Hype: Ruby on Rails
Hi Xavier, the wiki is full of examples, just look at http://rifers.org/wiki/display/RIFE/Templates and http://rifers.org/wiki/display/RIFE/Automated+form+building. You can also browse through some RIFE examples at http://rifers.org/examples/ or download one of our RIFE apps like Drone and Bamboo.

Btw, I don't find it more difficult to master, it's just different. Btw, this is not about YAGNI, this about maintainability and seperation of concerns. I personally find that *very* important, if you don't, then that's your opinion, but for me that has drastically cut down maintenance time over the years.

I'm fully aware that many people don't like our template engine, and are put off by some parts of the syntax, but that's another story. We and others love it and have done many projects with it, but I'm not gonna do a complete lay-down of our template engine in this blog comment. I just mentined it to demonstrate that non-logic template engines are not only possible, but also convenient and fast to use.

Btw, RoR is not the only framework that automates Crud admin interface building. We've been doing this without any file generation (100% at runtime) for quite a while, and it's driven by domain objects and not database structure (though the database structure is driven by the domain objects). We just never got 'round to releasing it yet. It's in a raw form in our SVN though at https://svn.rifers.org/rife-crud/trunk/ with some examples at https://svn.rifers.org/rife-crud/trunk/samples/
Yes, that's right, I had to write one line of code to generate the entire CRUD admin for 3 domain objects. If we have some time we'll prep it for public release with some docs since now some visual aspects are a bit hardcoded for our needs.
Re: Re: Hype: Ruby on Rails

Using a templating system is for higher maintainability. However high maintainability does not require a templating system. The only reason there is any urge to put logic in a template is because you can't figure out where else to put it. In Rails, figuring out where to put logic is a very simple task, and it takes no more work to put it where it belongs than within the templates. As a matter of fact, in Rails, it is harder to put logic in the template since you have to add <% and %> signs. In many frameworks, there are so many files to change and so much work required (XML files, Java Beans, recompiling, restarting Tomcat) to add functionality that given the opportunity, a programmer would prefer to put their logic in the template. That is why framework developers have developed templates, in order to prevent the programmers from taking the easy way out. I have been looking at your RIFE templates, and you have as much markup in them as any Rails project I have seen. I write maintainable code in Rails because it is very easy to do so, not because a convoluted templating system requires me to.

Re: Re: Hype: Ruby on Rails
> Lastly, I think that driving a web ... with

> appropriate meta-data.

Have a look at www.rubyforge.com/projects/nitro, a Ruby web framework featuring some ideas from Rails and true Object->Relational mapping.

Re: Re: Hype: Ruby on Rails

Geert, it sounds like you put PRESENTATION logic just another place than directly in your template. I have not looked all the example, but still it seems highly like those logic is just put outside, but it is still there:

ex:
public void output(Template template)
{
...
while (child_it.hasNext())
{

...

child.output(template);
}

}

I guess we can easily do this with any template engine by just getting the logic out the template, but it is still part of the presentation/view logic.

No matter what, if you want to output a list, you have to someone tell it to output each element of the list ;-) No matter where you do that job, you have to do it.

Maybe if I had some hours or days to analyze a very good example of why your method shine... however it just seem to me at first glance that you just put the logic out the template but you still do the same job...

What I like about just pushing the data, it is that you give the data, and could use a lot of different template that threat that data with whetever presentation logic it wants.

Re: Re: Hype: Ruby on Rails
Of course! That's exactly what seperation of concerns is about. I can just rip out some templates and replace them without having to write or carefully copy-paste any logic. Isn't that why you are using a *template* engine. Ie. you need a pattern or a mold that you use as a guide to the form of the view being made. You are flattening out the entire view layer into one place.
If I need to seperate out the view logic I can still create seperate builder classes that can easily be replaced, but apart from using totally different view technologies (Laszlo, HTML, DHTML, ...) I never had to do that.
Just look at the ridiculous history of PHP. It was initially built as a template engine, with some logic ... and then some more and more logic ... and again some more ... and now people use other template engines written in PHP to be able to cleanly seperate out the template content. Putting any logic inside a template is opening the road to exactly this since there's always some 'handy shortcut' that you can write inside the template to just 'quickly do something'.
Re: Re: Hype: Ruby on Rails

"That is why framework developers have developed templates, in order to prevent the programmers from taking the easy way out."

No, because they want to be able to cleanly seperate out the presentation content and put them into replacable templates. If you can't see the benefit of that, then maybe you never needed it. We have for instance a whole collection of modules that I just plug together in a site structure description and I provide a totally different set of HTML/CSS/Image files and baaaam ... I made a new fully functional site for a customer. If I need to fix a bug, or add a feature, I do it in the central module repository and they all get the updated version. If I need to override logic, I just implement or extend one or several elements (smallest modular RIFE building block) and iject that one into the site structure of the modules. Like this I can set up fully functional sites with little more than the time needed to make the design.

"I have been looking at your RIFE templates, and you have as much markup in them as any Rails project I have seen."

Where did I say anything about markup?

"I write maintainable code in Rails because it is very easy to do so, not because a convoluted templating system requires me to."

If you find it convoluted, that's your right, that's why there are so many different technologies for this. I find it convenient and easy to use.

Re: Re: Hype: Ruby on Rails

Here's my take on the whole separating-presentation from-content problem: the final result of a templating engine must be a document which contains data (generated/retrieved by logic) insterspersed with markup (static text/data). Now, let's see the methods used, how one evolves from the other and which would be the "ideal" solution extrapolatede from them.

The first approach, the most basic one, is to simply put the markup in the code. I'll need some HTML tags here so I'll just write them down in the code. Some time later I'm looking at the code again. Hoo, boy, that's ugly, loads of strings, heavy duplication, wanna modify something? Search and replace for days. What to do?

Oh, yeah I can use some sort of markup generator, write some code that puts markup together on the fly. Hmm, now, instead of strings I have just as many methods / subroutines and it doesn't look any prettier. At least the search and replace thing's fixed. Alas, markup come in a zillion varieties, put some attributes here, nest some markup there, soon I'm spending more time writing/customizing these generators than writing actual business logic. OK, what next?

Let's take the opposite approach. I'll just put the markup in a file, gonna call it template, sounds nice, rings a bell, okie. In the file I'll put some special placeholders which I'm gonna replace with my data. Ooops, some of this data is in lists, some of it in more complex data structures, that simple search and replace doesn't work. Well, easy, I'll add some more special text (careful, gotta escape it in case my data contains it too) which will loop over lists, descend into data structres and so on... While I'm at it, let's embed some method calls, it's just so parctical. Hmm, starts to look like PHP, ain't it? But, wait, now I need to change these damn lists and structures, so I start editing the templates, soon I'm back to writing perl scripts which parse and modify my templates. Damn, that didn't work either.

Now, how about splittin' these templates up into smaller pieces, make a master template, include smaller ones, combine them as we see fit, gee, it really works this time. All done aren't we. Mmm, not quite. The customer would like all foos changed to bars except where there's a baz around. Now instead of foo templates, I have foo and bar, but where to include foo and where bar? Yep, that's my template directory with approximately one googolplex of templates spread over one googol of directories and my trusty editor will open them all on startup, allowing me to take a quick nap each time I start it up.

So, markup in code didn't work, code in markup didn't either. Waaaait a minute, how about we say all data (including markup) is code? And vice-versa. I'll make a thingamajing and it can serve as template or as business logic depending on what's needed. Perfect! Wonderful! Ooops, just reinvented LISP. Looks like Paul Graham was onto something after all. Damn again.

OK, joking aside, the point is that at some time the markup and the logic have to interact. To be interspersed. According to some rules. Now, we tried simple rules: put these rules into code, you get the first two approaches, put the rules in the markup, you get the next two.

BTW, Geert, your links seem to suggest you want to allow the engine to parse the resulting document and extract either just the data it put in there or the whole document structure and manipulate it further. Am I right? Perhaps there's more to it, but as far as I could see (warning: serious oversimplifcation ahead) you arrive either at the second approach (a complex templating engine with simple templates) or at the fourth (complex templates with a simpler engine). Which is better? Depends on who you ask, what you need, actual implementation etc. And though a complex templating engines may seem more appropiate, I'm partially inclined to a well-thought template structure. RoR offers the means, they're called partials, a template inclusion mechanism which can be used to abstract more complex markup structures into separate templates, therefore allowing you to change the including templates without worrying about the logic hidden in the included ones.

Of course, take it to the extreme and, as I said, you get LISP (i.e. each system tends to become more and more complex until it turns into a LISP interpreter, hmm, can't remember who said that)

For the record, I'm neither a Java nor a Ruby developer (I'm a Perl developer, yeah, yeah, JAPH, what's that? Is it line noise? Is a live feed from the Matrix? why, no, it's just my perl code.... loathed by both Ruby and Java developers) and I'm really interested in RoR. Just recently (on my current project) I've seen the downside of complex templating engines, where the layout has become very constrained because of too complex customization requirements and currently I'm looking into the opposite approach.

Re: Re: Hype: Ruby on Rails

Hi Christian,

first, also for the record, I've got nothing against Ruby, hey I'm even mentioned on the JRuby site (http://jruby.sourceforge.net/credits.shtml). My post has 100% been about naive lies being spread through out-of-context statements that list number of code lines and other things like that as proof of the superiority of a technology. I can't help that many RoR users seem to think that I attack them or hate them, or something else, in any case it says more about those people than about me. I wrote a lot of Bash, Perl, Python, Java, C, C++, Php, etc etc, I have nothing against other languages than Java, I have something about decietful public statements.

Now about your templating problem. All your scenarios are indeed possibilities that exist and that are being used. The main flaw seems to be that you only talk about getting data into template files and not about getting data out of there or to externally manipulate the structure of a template instance. So instead of putting a loop inside the template, you declare blocks that define the snippets of content that you will use in the loop. Inside those snippets, you of course still provide placeholders for values. Now, I don't write the loop inside the template anymore, I write it in my view layer together with all the other logic, and it's not longer than the code I would write inside the template. The only thing I do is using the snippets to construct a larger chunk of content.

I don't see where you might get the idea from that I want to parse the resulting document. I parse the template file, that's it. I don't think RIFE's template system falls into either of the categories you mention.

The number one reason I don't want code to go into my template is because I package all logic into reusable jars and templates into others. I can quickly build new solutions by just reusing modules from the logic-containing jars, by just putting in new templates and not having to worry about integrating the correct logic statements.

Re: Re: Hype: Ruby on Rails

"So instead of putting a loop inside the template, you declare blocks that define the snippets of content that you will use in the loop."

That which we call a rose by any other name would smell as sweet. Just because you change the syntax of the loop in the template does not change the fact that is it a loop. All template languages, including RIFE's, add logic to presentation, no matter how much you try to disguise it. It seems to me that you are in denial of this aspect of web development.

In my opinion, the job of a template system is to minimize the amount of logic in the view, not to remove logic altogether (since that is, when you think about it deep enough, imposible for any dynamic content). I think that is what Lucas was trying to get at.

Also, in my humble opinion, I think you are confused about why you have so many Railers mad at you. I think it had more to do with the way you said "that application is so stupid that I'm wondering how the hell it could have taken him 600 lines to write it", not about what you said. Imagine if someone said that about something you were very proud of.

If you had said "that application seems relatively trivial, and I think I can do it in less than 600 lines of code" (which is in my opinion, relatively equivalent and yet polite), I don't think people would have been so upset. It remains a statement devoid of substance (until you show your 600 lines of code), but at least it is not as inflammatory.

If you expect people to be polite to you, you might want to try being polite yourself. Otherwise, please stop complaining.

Re: Re: Hype: Ruby on Rails

"All template languages, including RIFE's, add logic to presentation, no matter how much you try to disguise it. It seems to me that you are in denial of this aspect of web development."

Show me the loops in RIFE's templates.

"Also, in my humble opinion, I think you are confused about why you have so many Railers mad at you."

I'm not confused about it at all, would be very difficult since it was the title of David's blog post. Maybe you love hugging all together and chant about how marvelous and wonderfully ingenious you are, but outside there are people don't happen to not find that there's something to chant about. If you write a simple application with very limited features and without anything going on besides basic crud operations, and then shout very loud that it only took 600 lines ... and you shouted even louder before that your technology is incredibly terse, then I do wonder how the hell it took 600 lines. Don't worry, I'll come through with my version, I just happen to have a family to take care off and a business to run. Since I'm already totally overbooked for a couple of years, it's difficult to free up a bit of time when customers keep on calling for more projects that have to be done for yesterday.

Re: Re: Hype: Ruby on Rails

If you show me how to enumerate through an array in RIFE, I will show you a loop.

From http://rifers.org/05_friends_basic/src/templates/display.html.html

">

In this case, is equivalent to "foreach item in row do the following". This is logic. It is a very compressed and limited logic, but it is fundamentally logic.

You even have conditionals in RIFE. See http://rifers.org/05_friends_basic/src/templates/add.html.html

Provide�a�valid�firstname.

This is equivalent to the logical statement "if there is an error with the firstname, show the following message". This is logic. Disguised, but present.

Re: Re: Hype: Ruby on Rails

I was afraid of that. The template code didn't show up, but you can easily find it in the URLs provided.

On the point of yelling, there are polite ways to yell where people respect each-other (even if you think you are better or could do better work than others), and there are impolite ways to yell.

If you yell impolitely, you will get people angry. If you tell politely, you will get an interesting and civil conversation. I am not saying that you should yell politely, I am just saying that if you yell impolitely, you shouldn't be surprised when others are impolite.

Re: Re: Hype: Ruby on Rails

tell politely = yell politely

Re: Re: Hype: Ruby on Rails

No, this is not logic. There is nowhere written according to which conditions a loop will continue, how many times, which limits, what concrete data, when it breaks out forcibly, etc etc etc. These is pure markup, don't try to disguise it as something it isn't. Next you're gonna say that pure XHtml contains logic.

Btw, Juliet where did I say that I didn't expect people to react back? What very very very sad is that the whole conversation of David's original blog post has just been erased: http://weblog.rubyonrails.com/archives/2005/01/22/that-application-is-so-stupid/
Don't try to accuse me of things I never said and start looking into your own camp. Some Rails user at a certain time insisted that I deleted one of my own comments where I supposedly said that database-backed websites were not good (how the hell would I ever say that, I serve images straight from out of the DB), here everything has been totally erased. Is it because there were a few non-chanting comments? Is it because someone accused David for slander against Java? Who knows, but your community doesn't seem that holy to me.
Re: Re: Hype: Ruby on Rails

In Ruby, you can do:

foreach item in array
print item

end

Here, there is nowhere written according to which conditions a loop will continue, how many times, which limits, what concrete data, when it breaks out forcibly, etc etc etc. Is this not programming?

The fact is it is still logic because it does an action on a given set of data. Markup like xhtml is not logic because it describes the format of data, it does not perform an action on that data, like your loop does.

What about the conditional statements in the second example? Are you going to argue that if-then conditionals are not logic?

Re: Re: Hype: Ruby on Rails

Your Ruby example is again overly simplified, what if I conditionally want to show different rows, or break out of the loop, ... etc etc

You can start discussing about semantics, but in my book this is logic. Programming is the general act of writing a program.

No you don't get it, the template engine is totally markup and does nothing, only an external source intervenes with it and can manipulate it. Just like you can manipulate XHtml's DOM structure.

And there are no conditionals either, these are just marked up content blocks that are used by something outside the template engine, in this case the form builder.

Re: Re: Hype: Ruby on Rails

Wow, you have a very different language for talking about programming than most of us have. You might want to talk to some of your programmer friends so that they might be able to explain how the rest of us talk.

Your marked up content blocks are logic that is parsed by an interpreter. They are conditionals by definition, because if there is an error, they will show and if there isn't an error, they won't show. This is the definition of a conditional. Conditionals are the cornerstone of logic. Therefore, your templates have logic. Unlike the default Rails templating system which is Ruby code interpreted by the Ruby interpreter, your templating system is interpreted by your template engine, which is inherently interpreted by Java. Just because your logic is not interpreted directly by Java doesn't mean it isn't logic.

By the way, I really hope that your template engine is not totally markup and does nothing like you just said. Most programmers call the template engine the code that parses your template data.

Re: Re: Hype: Ruby on Rails
Oooh ... I typed this in MacOSX's dictionary and look what I found:
programming ?pr??gr�ming
noun
1 the action or process of writing computer programs
.figurative predetermined behavior:men and women are the playthings of programming.
2 the action or process of scheduling something, esp. radio or television programs:the programming of shows

.radio or television programs that are scheduled or broadcast:the station is to expand its late-night programming.

Yeah! Now you start redefining the English language ... great going!

Juliet, to use the words of the Rails community, you clearly just make assumptions from looking at a piece of code without trying anything out. The template engine doesn't make those errors appear. You seem to have a terribly hard time just thinking about different concepts than those you already know.

Indeed, that sentence should have read 'the template is totally markup'.

Now, get your facts straight because you make a further fool of yourself.

Re: Re: Hype: Ruby on Rails

Geert, I did not question your definition of programming. I did not try to redefine anything. I questioned the way you talk about programming. Do you know what the difference is? Or is it that you simply don't read carefully?

You clearly know how to program, having built a web framework in Java and done some great open-source work for Linux. But I am sorry to say that you don't seem to have a grasp about how to communicate or do self-reflexive thinking with regards to programming.

I don't actually have a community by the way. I have explored many web frameworks in PHP, Perl, Java, Python, Ruby and .NET. I am intimately familiar with the myriad ways in which template engines can work. What you have with RIFE is nothing new, hard to understand, or groundbreaking. The reason they exist is to separate the "business logic" from the "presentation logic", not to remove presentation logic altogether. I have never seen a template system where the templates did not have some logic in them, including RIFE's.

Obviously you are not really listening to me, so again, I beg you to go to any one of your programming buddies and ask them: is there any logic in the templates in RIFE? I am sure that a friend can explain it better than anyone else. If they agree with you, please have them come here and explain to me their reasoning because you have done a very poor job so far.

Re: Re: Hype: Ruby on Rails
Juliet, I'll drop them a word when I see them, and generally I do a very good job explaining concepts even though English is not my native language, you're just not listening. You point me to RIFE template examples and say that there's logic in there since (according to you) the template engine sets those error values or executes those loops. I'm sorry to bring the news to you, but as the author of the technology I keep telling you from the start that this simply just doesn't happen. The template engine doesn't do that. Of course something else will perform a loop somewhere (the logic in your view layer) or build a form with error indication (a form builder), but the template engine simply doesn't and the templates contain no syntax whatshowever in that regard, and that's is the point.
Now, if you had looked a bit further and stopped making assumptions about the trivial examples, there are a couple of additional features where the semantics are much closer to logic than this. It took me a long time to accept them and we debated long about them before doing so, but even then it's extremely limited and only relates to conditionally using existing blocks as default values instead of relying on the BV tag (I doubt you know what I'm talking about, but all this is documented extensively in the wiki and the usersguide).
Re: Re: Hype: Ruby on Rails

I have read through your documentation and fully understand that RAFB's templates don't directly generate the HTML. First, they are read by the template engine. Then, they are interpreted with the help of the view layer or the form builder. I get that.

I understand that the eRuby template system is much different, since the template itself is interpreted by Ruby, not the view layer. I also understand that PHP's Smarty is much more like RAFB's, since there is no real executable code in the template.

eRuby and Smarty firmly believe that there is logic in their templates. Not business logic, but presentation logic. Just because this logic is not executable does not negate the fact that it is logic (ask the Smarty folks). Logic means a description of how the data (in this case the HTML) will be changed when the template is interpreted.

Now that I have taken the time to review your documentation, please take the time to stare at these functionally equivalent pieces of templates:

http://rafb.net/paste/results/ictULC37.html

The old saying goes: if it looks like a dog, if it barks like a dog, then it is probably a dog. All three templates look very similar. All three produce the exact same HTML. If you gave the three templates with the output to a novice programmer, and ask them what is happening, they will probably tell you that the logic inherit in all three templates was interpreted with respect to some data in a database to produce HTML. And he would be right.

If you stare at those pieces of code long enough and keep your mind open to possibilities, I believe you will come to see that they all represent a minimal amount of logic, a minimal set of instructions for how the HTML will look in the end.

Re: Re: Hype: Ruby on Rails

What the hell is RAFB?

... your argument fails miserably since the RIFE template code you pasted doesn't do anything, if I put that in a template and print the template, you just get empty content.

Re: Re: Hype: Ruby on Rails

So to use your saying, it maybe looks like a dog, but it certainly doesn't bark like it.

Re: Re: Hype: Ruby on Rails

Sorry, RAFB == RIFE

None of the templates DO anything without context. Not the eRuby template, not the Smarty template, and not the RIFE template. None of them do anything without context provided by the controller and view.

For that matter, no Java code DOES anything. Not without a Java compiler (and even then you need an interpreter for compiled Java code).

That does not mean that the templates don't encapsulate some logic.

Imagine for a second that you don't know the specifics of how any of those example templates gave you the same HTML in the end... you just knew they all did. Now you were told that 2 of those templates had logic and 1 didn't. Nobody would be able to tell which one of those was the odd one. That is because none of them is odd, they all have logic.

Re: Re: Hype: Ruby on Rails

You're talking about semantics again. If take that smarty or ruby code and don't write additional code but just provide data, it will print the rows. If you take the RIFE template, it will not. So the logic is outside.

... Juliet, or ... maybe Lucas?

Re: Re: Hype: Ruby on Rails

So you are saying that providing data does not mean writing additional code?

Re: Re: Hype: Ruby on Rails

No I'm saying saying that you're comparing out of context and jump to conclusions. Write the full code to get that loop visible on a web page ... and then we'll talk again.

Re: Re: Hype: Ruby on Rails

"Imagine for a second that you don't know the specifics of how any of those example templates gave you the same HTML in the end... you just knew they all did. Now you were told that 2 of those templates had logic and 1 didn't. Nobody would be able to tell which one of those was the odd one. That is because none of them is odd, they all have logic."

It's because you put a red dot on certain things and then independently decide to put them in a certain order, that they move into that order by themselves. They just have a red dot. I could totally independently decide that the red dots don't have to be put into a certain order, but just not appear, or by duplicated, or ... They're still just numb things with just a red dot.

Re: Re: Hype: Ruby on Rails
the example code from RIFE you made comparing it with eRuby and Smarty is not the same thing as Geert says.
The 2 other systems have a specific behaviour attached; they itterate through rows. Whilst this may result in no effect if there are no rows, they are row processors.
The RIFE template is only a template, if no code is attached it has no identity other then being html, and if code is attached it can be a row processor, but it can also just contain some data from any other piece of logic, not only row data.
Re: Re: Hype: Ruby on Rails

Juliet, take a look at it from another perspective.

Pretend that this is XHTML:

[p]these are some [em]important words[/em][/p]

Without CSS, you will just get bog standard non-italic text. What the markup does is give semantic value to the text "important words" which says that they should be emphisised. It is up to the CSS rendering engine to use italics to show the emphasis.

Geert's template comments do to the markup what XHTML does to the text. It says that a chunk of markup can be used to represent a "row", but it is up to the template engine (=CSS in this case) to say what to do with that markup.

If you want to have a look at the Ruby way to do this, take a look at Amrita: http://amrita.sourceforge.jp/docs/QuickStart.html

It has much much much nicer syntax than Geert's templates, but does the same thing. An advantage over Geert's code is that it uses generic code to put the data into the template, you don't need to code the loops, ever. Not even in the View layer, Amrita handles that. (Well, you could say that Amrita is part of the View layer, but it isn't part of the view layer you have to write yourself :)

Douglas

Re: Re: Hype: Ruby on Rails

Some syntax examples: (eRuby, Amrita, Smarty, RAFB)

http://rafb.net/paste/results/SQxZbt40.html

Re: Re: Hype: Ruby on Rails

Douglas, Amrita's syntax is maybe nicer in XHtml (though you can't mark up something that's not a tag), but it doesn't work in text, sql, java, ... We use the template engine for many other things than generating web pages, and using the comment syntax for invisible tags or the short tags for convenience makes it possible to apply it to any text format. I also prefer to have the template markup be clearly isolated from the actual text format syntax to be able to identify it easily with highlighters like this for instance: http://rifers.org/05_friends_basic/src/templates/add.html.html. Of course, that's all a matter of taste.

You say that you don't ever have to write logic in the view layer, put you still have to write logic to populate your list datastructure. We prefer to do this directly from database resulset processors without putting large data structures in memory. Amrita's approach seems handy for simple stuff though.

Re: Re: Hype: Ruby on Rails

Douglas, it's RIFE, not RAFB

Re: Re: Hype: Ruby on Rails

> Douglas, it's RIFE, not RAFB

Sorry about that, copied Juliet's example code.

> apply it to any text format

If you attach the id attribute to a span, then Amrita will not place the span in the final output. That way you can generate any text format you like. Example template:

My first "[span id="data"][/span]" app.

Ruby code:

data = {
:data => "hello world",
}

tmpl.expand(STDOUT, data)

Will give:

My first "hello world" app.

Cheers,
Douglas
Re: Re: Hype: Ruby on Rails

"If you attach the id attribute to a span, then Amrita will not place the span in the final output. That way you can generate any text format you like. Example template:"

In that case it's uglier than RIFE's template syntax imho ... but that's taste again ;-)

Re: Re: Hype: Ruby on Rails

... just testing since Douglas had problems with placing a comment ...

Re: Re: Hype: Ruby on Rails

RIFE's templates are completely logic-less no matter what you say. There are no ifs, no while loops, no do-while, no foreach, nothing. You can't execute a template. There is no code to execute.

The templates are dead simple. You add a 'V' tag and you can set a value from in your code to the template. Not from the template to somewhere else. You create a 'B' tag and fill it with 'V' tags. Set values until you're done. Append the block to a V tag.

All from Java code. NOT from the template. There is absolutely NOTHING in a template, at all, that could be useful without some code behind it to make it complete.

It's a dumb template. I understand if you're shocked and amazed at the truth of that statement. Hard to believe in such bliss.

Re: Re: Hype: Ruby on Rails

One backdated comment:

> but that's taste again ;-)

Yes, that's probably true. I never like having single capital letters just hanging around which turned me off right from the start.

Even with the span styntax, it is more compact that the RIFE syntax:

http://rafb.net/paste/results/7BQvat75.html

PS: though as Geert showed in email, you can also use compact syntax, so the comment above is only true with the comment style syntax:

http://rafb.net/paste/results/O3iPWS12.html

I guess any arguments about about which template syntax is better are moot: both act in the same way. Both are language independant, but the Amrita implementation is in Ruby and the RIFE one in Java... and we all know that Ruby is the better language :-P

> There is absolutely NOTHING in a template

I've snipped the qualifier because with it it could apply to any template. The key to the templates isn't that there is NOTHING in them, quite the opposite. The key is that the template is MARKED UP, so that the template engine knows what the tags in the template mean. It's the solution to the "googolplex of templates spread over one googol of directories" problem, where this same markup data is stored in file names.

RIFE doesn't use SGML/XML templates (the alternative syntax is plain text) so you have to write a custom parser (unlike Amrita which just uses a standard XML parser) but the data is still there if you know what to look for. It isn't a "dumb template", it is a marked-up template.

Douglas

Re: Re: Hype: Ruby on Rails

"The key to the templates isn't that there is NOTHING in them, quite the opposite."

Douglas, what JR meant was that there was no logic (nothing) in the templates. For me that's very important, since I can very easily slap new templates on an existing webapp without having to worry about correctly porting over the integrated logic. Also, I don't have to maintain the logic in all the variants of the templates. So this is important, and you're right, the way it's achieved is by marking the template up.

Add a new comment

:) ;)
=) :-)
:'( :(
:/ :D
:| :p
:o 8)
Your email address will not be displayed at anytime on any page.
Only provide your email address if you'd like updates on this entry
and it's comments by email.
Please answer this simple math question:
16 + 9 = 
 
 
  

Manage subscription

Remove email:
 

< Act TODAY against European software patents   Drone IRC Bot v1.2 released >
 
 
 
Google
rifers.org web