I’ve been hunting for a web development framework for a few months. Back in the summer I was immersed in CSS and javascript, just sticking with my tried and tested server-side techniques. Using the TinyButStrong (TBS) template class I could put together a highly organized dynamic website pretty quickly. In retrospect it seems that I’d found my own path towards an MVC-like pattern: nothing but HTML and logic-less TBS tags in the templates; PHP pages acting like controllers, for form processing and manipulating data; and a class for each table in the database (more or less). Very neat. Framework junkies amongst you could tell me exactly why this isn’t really MVC, but I don’t care.
Anyway, my first intention was to stick with PHP, so I was led to have a look at the CodeIgniter framework after I watched a couple of excellent tutorial screencasts by Jeffrey Way on nettuts. But then I discovered Kohana, originally a fork of CodeIgniter but apparently better in several ways. Last time I checked, CodeIgniter was very PHP4-centric, whereas Kohana is most definitely a PHP5 beast, with all the OO stuff that entails.
I haven’t been able to use it in anger yet, but I’ve set a few things up with it, and it gives me a nice warm feeling. It seems really lean and simple and built in the right spirit, and it didn’t take me as long to get my head around the MVC pattern as I’d expected.
The thing is, now I find my thoughts drifting into alien territory…
This goes back to my previous post about web development choices. The more I look, the more confused I become. I wouldn’t consider anything Java or .NET, so in the area I’m looking at the big [puts on suit and pulls a sombre, earnest expression] SERIOUS frameworks seem to be Ruby on Rails and Django. I’ve been trying out Python with the Google App Engine, and I forgot how great it was to learn a new programming language, so Django – a Python framework – looks like a good way to go. But something in me cries out NO – do I really need all that stuff? Look, there’s this guy over here says Django’s too big and bloated; but wait, there’s that guy over there says with Django he can spit out ten amazing websites every day.
But coalescing out of my confusion is the perception of a contrast in the community, and for those who build websites and web apps it’s good to be aware of this. On the one hand there are those whose overriding concerns arise from their work in creating and maintaining the frameworks themselves; and on the other hand there are those who just want to make websites. This became obvious to me after watching two video talks from DjangoCon 2008 (yes, I’m still catching up with all this), one by Mark Ramm, one of the guys behind TurboGears (another Python framework), and the other by James Bennett, one of the Django guys.
Now, I’m aware that the subjects of these talks were quite different, and pitched at different levels, but nevertheless I do think it’s fruitful to compare them.
Mark Ramm seemed most interested in guiding the philosophy of the Python community, about the future of Python frameworks and how they should be taken forward. In particular he criticized the “monolithic,” all-things-to-all-people approach of Django, opposing it to the Turbogears/Pylons approach, which is to open things up, to make it easy (even necessary) for developers to grab this bit here and that bit there and carefully craft an optimal whole. His standpoint reflected his immersion in developing for – or the development of – web app frameworks.
James Bennett’s focus was on developing with frameworks – that is, building web applications – rather than on how best to build the frameworks themselves. He talked about the most efficient ways to approach the development of an application using Django, for maximum code re-use and maintainability.
Of course, these are not implacably opposed positions: it’s just a difference of focus. Both may be right in their own ways, but as a freelance developer of – currently – small to medium websites, I naturally find James Bennett’s focus on the day-to-day business of making a web app much more appealing.
It might be true, as Mark Ramm says, that you don’t get perfection by installing everything in one bundle and just running with it, but to me that’s rather academic. Everyone is agreed that the purpose of frameworks is to free us from the boring repetitive tasks of this line of work. We shouldn’t have to even think about admin interfaces, form-handling, nice URLs, templating, or ORM data-mapping. But further, I just want some one thing that does all that pretty well. If I have to pick and choose between different combinations, and try to get all the bits working nicely together, then I’m thinking about it: I’m wasting my time. I don’t want to think about the optimal key set-up of a saxophone – I just want to make music (is that a cheesy analogy?)
Before I realized this I struggled to stay a course through the choices facing me, taken first in one direction and then another, each with its own passionate and persuasive adherents. But now, even if the two approaches I’ve perceived are just sides of the same coin, I can use this idea of a dichotomy to sort and prioritize the opinions I find.
However, I now find myself considering having a go at building a web app with Haskell, a functional programming language beloved of geniuses, hippies, mad scientists and my good friend Paul Keir (who might fall in all three of those categories). The introductory message at haskell.org has the words ADVANCED, PURE, CUTTING EDGE, RESEARCH, CORRECT, and PARALLELISM (eh?). That’s all a bit scary to me.
Haskell is definitely scary, but good scary! Then again, life is short.
First install the Glorious Glasgow Haskell Compiler via http://www.haskell.org, create a hello.hs text file, and put this in it:
Then from the command line:
*Main>hello
Hello World!
*Main>:q
For more flexibility try this in hello2.hs
-- n.b. Spacing: the p should be beneath the [
main = do [arg1,arg2] <- getArgs
putStrLn (arg1 ++ " " ++ arg2)
Then type:
> ./hello2 Hello Planet!
Hello Planet!
ghc is GHC’s exe name; ghci is GHC’s interactive environment.
Check out the videos. Simon Peyton Jones gives a good introduction.
http://www.haskell.org/haskellwiki/Video_presentations
I’m watching these now as they arrive:
http://channel9.msdn.com/shows/Going+Deep/Lecture-Series-Erik-Meijer-Functional-Programming-Fundamentals-Chapter-1/
Paul
“Command line”? What’s that?
A nanagram of “Almond Mince” :)
Almond mince pies, available at Fortnum and Mason:
http://www.fortnumandmason.com/(S(r5ifdtjpi5xsww455kyym555))/catalog/productinfo.aspx?id=8468&AspxAutoDetectCookieSupport=1