You grew up speaking English, I guess. Not all languages work that way
and some languages you have to match up the cases, declinations and
conjurations as well as temporallities. There there’s languages like
Navaho which are so radically different you can’t really comapre them
with the Indo-European ones.
Navaho… that’s funny
into libraries. I can build a controller around no methods except
‘method_missing’. I can build it with lots of exception handlers and
few “if” statements that do checking
(http://blog.codefront.net/2007/12/10/declarative-exception-handling-i...http://railsforum.com/viewtopic.php?pid=49600http://nullstyle.com/exceptional/
and others)
The point is putting things where they belong… Of course you can put
them where ever you want, but then other programmers are going to have
to chaise your code around.
John Kenneth Galbraith is one of the most clear, fluent writers of
technical and business English. In one of his books I encountered a
sentence that ran on for one and a half pages. I did a double take when
I realised it and went back and wrote the sentence out by hand,
decomposed it, and tried reformulating it a a number of shorter
sentences, with, alas, no success in preserving the clarity and impact
the original, and I do not believe that was due to any shortcoming in my
ability to handle the language. It was beautiful. It was graceful. It
was easy to understnad. But short it was not! (Now re-read this last
paragraph.)
That might be true for Literature.
However, for programming, short precise methods and controllers lead
to better designed and modular apps.
One “traditional” way of judging code quality comes from the days of
“goto-ful” programming. With “GOTO” you needed to remember where you
came from as you flipped back and forth though the lsitings. So if you
needed more than a places where you had your finger stuck in the fanfold
as a placemaker it was called a ‘more than five finger program’. On can
make the case that a single file is easier to scan that having ten
different controllers and having to grep to find which one has the
method, its all in one and your pinky finger just has to hit the ‘/’.
Well I guess its a matter of taste, but to tell you the truth, if I
saw a 120 method controller, I would simply think the programmer is in
a rush and didn’t have time to think thoroughly about the design of
the app, not that he prefers to search for a method name in just one
file… I know you where just trying to explain a possible argument,
but… come on now
You’re arguing in a circle.
Not at all, this is regarding testing my friend, a crucial aspect of
software, that many people underestimate and later suffer the
consequences.
By encapsulating the functionality of your app into smaller units,
your testing becomes simpler.
REST lays down the guidelines for everyone to have a common
language. If I know you have a site about car rentals with all the
rates in xml form at the urlhttp://yousite.com/ratesI don’t need to
know anything else to access your data and add it to my site.I’m sorry: are you saying you need REST to output (or input) XML?
I don’t think that’s the case.
Nop, what I was saying is that REST combined with Rails gives you an
XML interface, with very few lines of code.
Of course you can play around with XML in many ways, but I doubt you
can do it faster and so well structured,
as having a respond_to block that takes either html or xml, and
returns the output accordingly.
Discontent presents a challenge.
That is a good point, and exactly what DHH, the core team, and all the
contributors, have been fighting for in the last 3-4 years.
We have already changed the way software is developed, and will surely
keep improving. Rails, REST and BDD are part of this software
revolution.
Once they become mature techniques, we’ll jump onto the next big
thing, which most of us, probably can not yet even imagine, but will
surely come.
In the meantime, they are the best tools and design arquitectures that
we have.
P.S. For some obscure reason, Anton, you are making me an even
stronger believer in the REST philosophy, thank you