From: Bauduin Raphael Date: 2004-07-26T07:57:28+09:00 Subject: Re: rubyonrails and cgikit comparison Florian Weber wrote: [snip] > > foo > > how would you do this in xml? My opinion: -I would work with css -The designer should not be concerned on the conditions to have one or the other color. He designs a red class, and a black, and the code determines which is used. ex: #template #binding mylink : CKHyperlink { href="foo" class = link_class } #ruby code #this file contains REDLIMIT value used throughout the appplitation require "myparameters" if @some_stuff < REDLIMIT @link_class = "redcss" else @link_class = "blackcss" And you have the benefit that you can use parameters like REDLIMIT defined in a file required in the code, and used through the whole application (though I guess the same applies to Rails if you require the file in the component's code). From our discussion, it seems you prefer to have a bit of code in the template, but I prefer to have a bit of presentation logic in the code. My fear it that the code in the template could become too important. I also think it's much easier for a programmer to give a certain class attribute to an element, based on conditions in his code, than for a designer to enter the conditions to use a class or another. Giving a css class doesn't get you inside the css, working with variables in the template gets you inside the code. Raph > > >>> - rails is pragmatic. it makes simple things simple, and hard >>> things possible (yes! i bet you never heard this sentence >>> before ; ) but with rails its totally true. if you believe in components >>> in the view, its possible to add that.. >> >> >> I don't care if it makes simple things simple. In the company I work >> for, we use WebObjects for complicated applications and simple Ruby >> FastCGI scripts for simple ones. For simple things you don't need a MVC >> framework, you can print the HTML code directly. > > > its not like there are only two existing types of app: simple and > complicated > ones.. there are things in between.. > > >>> basically you really start to appreciate that you dont have to >>> write tons of config files for everything. cgikit could also do that. >>> it would be so much nicer if there would be some name specifications >>> for your component class. like naming methods which return attributes >>> in a special way. then you could get rid of the whole binding file. (i >>> might be wrong, since i just quickly browsed the docs =) >> >> >> Yes, and then you would encounter the situation, when you REALLY can't >> follow this convention (the same goes for O/R mapping frameworks and >> mapping SQL columns to attributes of the same name - think about "ID" >> and what "id" attribute is used for in Ruby :) and you are stuck. I >> really like the freedom of cgikit-like frameworks. > > > personally i prefer to be forced to keep such limitations in mind and > use something different than 'id', but not being forced tell the lib > how to map every column to a attribute.. > > plus im pretty sure that it wouldnt be hard to add something to > activerecord > which allows you to declare names for such exceptional attributes > specifically.. > > > > > >