lesscode.org


16 Jan 06
01
18

I’ll Be Speaking At Canada On Rails Conference  2

By Alex Bunardzic under Rails

I am excited to announce that I was selected as one of the 15 speakers to present a talk at the first world wide conference on Ruby on Rails. This conference is shaping up to be one of the most exciting events in software development this year (another one being the RailsConf 2006). It would be a shame to miss it, so if any of you are planing to attend, please pre-register here.

The tentative title of my presentation is “Less Technology — Reclaiming the Software Development Craft, One Scaffold at a Time”. I am not in the position to divulge the topics of the other 14 presentations, but I can assure you that some of the speakers are planing to tackle some of the most contentious and controversial aspects of the contemporary Rails development. I cannot wait to hear all these ambitious talks unfold.

If you’re interested, please drop me a line what areas of Rails development would you like to see tackled at the conference. I’ll see if I could squeeze some of your questions/concerns in.

2 Comments...

08 Jan 06
16
23

Ruby On Rails Is Like Red Wine  32

By Alex Bunardzic under Ruby

Fifteen, twenty years ago North America was a culinary wasteland, save for the rare pockets scattered along east, west and south coasts. A brief trip to places like New Orleans would shock and jolt the palate of the plain white crustless bread, stake-and-potatoes visitors. Of course, let’s not forget other fine culinary spots, such as Manhattan, San Francisco, and several other islands in the otherwise homogenous sea of mediocrity.

Things started to change rapidly in the nineties, reaching levels of unprecedented sophistication in dinning and wining. Today, we can enjoy the incredibly opulent selection offered to us through stores such as The Whole Paycheck (er, Whole Foods), but things were drastically different only fifteen years ago.

I remember how unpopular wine drinking was not that long ago. Especially in my neck of the woods (I live in Vancouver, British Columbia, where most locals still mentally inhabit the 19th century time zone). Up until very recently, this was a beer country. All normal, regular males were expected to drink beer. Wine was mostly available in those hideous 4 litre carton boxes, and tasted like pee that went bad. Anyone caught preferring or, god forbid, drinking wine was declared gay on the spot. It used to be very hard to smuggle a bottle of import wine into one’s apartment.

At social gatherings, wine drinking was reserved for the female population. Men were either expected to chug beer, or go with some hard booze.

Luckily, things started changing for the better, and now we have pretty decent selection of import wines from all around the world. Plus, straight men are not afraid that they’ll be labelled as ‘faggots’ if they are seen drinking wine in public.

What Does Wine Have to Do With Ruby on Rails?

Programming languages and development platforms are kind of similar to alcoholic beverages. Majority of software developers choose products that belong to the beer category. Sure, there’s plenty of variety there, but in the final analysis, it’s all beer after all. Thus programming languages such as Pascal, Perl, Java, C#, ColdFusion, PHP etc. are basically just different varieties of beer (like, dark beer, pale ale, lager, etc.) Languages such as Assembler and C are more like hard liqueurs (e.g. whiskey, tequila, vodka). Languages such as Smalltalk, Python, Lisp, are like white wine — sophisticated and enchanting.

Finally, languages like Ruby (with all its domain specific flavors, such as Rake and Ruby on Rails) are like red wine. Red wine is that special gamut of products that demand incredibly high level of devotion and finesse, thus creating its own breed of aficionados.

And like the friction that wine drinkers were having with the overruling beer crowd, Ruby and Ruby on Rails users are today experiencing similar friction coming from the ‘beer crowd’ of programming languages. Most of the dissent seems to be coming from the ‘plain vanilla’ lager crowd (the Java consumers). There’s also some dissent coming from the ‘white wine’ crowd, but in a much more civilized fashion.

I wonder if the same cultural evolution, that helped promote the spreading of the red wine culture throughout North America, will happen for the ‘red wine of software development’, that is, for Ruby on Rails? At this point, it doesn’t seem very likely, as anyone who’s using Rails seems to be labelled in a knee-jerk fashion as being ‘queer’. It is obvious that the mainstream crowd of software developers (i.e. the beer drinking crowd) is extremely uncomfortable with the uprising of the red wine drinking crowd (i.e. the Ruby on Rails). The beer drinking crowd confesses that they simply don’t get what could possibly be so enchanting about enjoying the red wine.

Hopefully, cooler heads will prevail, and the medical findings that red wine is actually beneficial for one’s health will pave the way toward adopting the red wine consumption on a larger scale.

32 Comments...

07 Jan 06
13
07

How’s that for less code?  8

By Aristotle Pagaltzis under Python, PHP, Java

Bob Ippolito, speaking about the upcoming flashticle, offers proof in the pudding for things I wrote a week ago:

This is a total of a whopping 117 lines of very liberally spaced Python code that defines all three database tables and fully implements every feature of both sample applications.

The PHP version of the pizzaService backend […] is 138 lines of code, is one big security flaw (doesn’t escape SQL properly, big surprise), is MySQL specific, and it doesn’t include the DB schema and can’t create any tables for you (thank you tg-admin sql create).

The Java version of the BirthdayOrganizer backend, which I won’t even bother linking to, is well… ginormous. 246 lines of XML configuration sludge in 5 files, 29 lines of SQL schema in 1 file, and 3004 lines of Java code in 45 files. Holy crap. If you add that all up, the trivial BirthdayOrganizer example is only a hair shorter than all of flashticle! And the BirthdayOrganizer example builds on top of 15 Java dependencies and requires a J2EE server plus ant. Friends don’t let friends code Java. Oh, and it’s also MySQL specific, but you better be damn well sure that there’s a stub implementation you can subclass and an XML file you can mangle in order to support something else if you so choose to write that 200 lines of code to support a single three column table database.

8 Comments...

30 Dec 05
06
50

Maintainable Programmers  25

By Aristotle Pagaltzis under Then they laugh at you...

I thought it unfortunate that the controversy kicked up by a few (now retracted) passages in Brian Fioca’s article about WASP detracted from a proper discussion of the article’s real flaw. I addressed the controversial, less interesting sentiments in comment over there, but wanted to take a few moments for a longer commentary. It took a while, but here we go.

The true failing in that article is a terminal case of corporate-management world view. Let me quote a little out of order to highlight this:

Sure, you can write spagetti code in PHP 5, but if you have a well designed framework that keeps PHP code outside of your HTML and in tightly structured classes, you’re more likely to end up with code that looks and works and feels like Java.

The implication appears to be that anyone in the real world, if only they’re using Java, writes well structured and maintainable code.

I think the real world has a few surprises in store for people who think that way. As the saying goes, real programmers can write Fortran in any language.

Deemed “hacker” languages, scripting languages can be quick to write, but since they do not have many of the advanced features of compiled languages like C++ and Java, they have been prone to lax design practices, leading to code that isn’t efficient, stable, or maintainable enough for large solutions. With the correct mindset and help from structured frameworks like WASP, this no longer has to be the case.

This claim is a crock. PHP has a very low barrier to entry; consequently, a lot of eye-wateringly bad programmers are writing code in it; hence, a lot of code written in PHP is awful. This is arguably a good thing: a lot of people who have small needs are empowered to meet them on their own despite having little skill, which would never happen if Java were the only option available.

To conclude that if these programmers did learn Java, they would suddenly turn out maintainable code, or that if a good programmer changed camps from Java to PHP, the quality of his code would suddenly degrade, is fallacious.

Again, you can write pretzel logic in any language.

Until recently, platforms like Java were more likely to provide a stable, proven foundation to design and build well designed code, however by their nature they introduce a level of complexity that takes extra time to overcome.

The entire “more likely” clause is a myth, perpetuated by a middle management population that has absolutely no clue whatsoever what makes code good.

Using scripting languages like PHP tended to produce code in a faster time frame, but it was often impossible to maintain the architectural integrity necessary for building maintainable, extendable applications.

This is true – in an extremely local sense.

The overall design of large Java systems will tend to be more convoluted than that of almost any system written in a dynamic language, simply because the contortions forced by Java require larger overall designs.

Java buries the intention of code under a thick layer of implementation details and typing bureaucracy. Programmers are drilled to execute the requisite gruntwork in repeatable, predictable ways. Moreover, doing so conditions them to design their own system to cater to these reflexes. A maintainance programmer who comes in later will therefore easily be able to make changes to the mortar of an application. Unfortunately, that does not ensure good high-level designs nor does it translate to easy refactoring of convoluted architecture.

Dynamic languages abstract away huge swathes of gruntwork and require less structure. This means small systems have small implementations, which directly translates to better maintainability. The price is a loss of exemplary structure and of conditioning, which requires better innate architectural skills and stronger discipline when building larger designs; neither are strong points of the average programmer. However, designs in such languages aren’t frequently large, because the language does not require large architecture for modestly sized systems – which the majority are.

I have seen as many examples of truly terrible designs in Java as I have seen examples of completely unreadable code in Perl. Maintenance problems may manifest in apparently different ways, but their cost does not degrade appreciably when they afflict a system written in a “more maintainable” language. The only objectively measurable difference is in the amount of required code.

Why would you want to stick with PHP even in situations when you can use Python, Ruby, or anything else?

Simple. Because it’s cheaper to hire programmers that can write code in PHP. And if you have a good technical lead and a well implemented framework, your cheap programmers are going to pick it up and run and write good (and maybe even less) code.

(Brian writes this in a response in the comments, not in the article.)

This is a fear-based middle-management hiring strategy. Good developers know that “cheap programmers” will never hit the high notes. You can hire 100,000 code monkeys and they will never produce the same quality as 5 stellar programmers.

All these quotations are pervaded by a disregard for the fact that programmers are craftsmen; for the fact that that the language, framework, and whatever else they use in the course of their work is a tool. Good tools matter, but the stated opinions read as if the programming language is the principal factor in the quality of the result, when the truth is that it’s the programmers who ultimately matter.

If you hire good programmers, maintainability won’t intrinsically be affected by whether your in-house software development has standardised on Java, PHP, Perl, Ruby, Lisp, Smalltalk, Haskell, or Self. Good programmers can appreciate and can create good design regardless of language, and they can absorb a new language easily enough. Or as Joel Spolsky says:

I have never met anyone who can do Scheme, Haskell, and C pointers who can’t pick up Java in two days, and create better Java code than people with five years of experience in Java, but try explaining that to the average HR drone.

But whether your system is written in Java or an exotic programming language, every single programmer you hire will have to get acquainted with its architecture – which is hence the major factor in its maintainability. Comparatively, the chosen language is barely more than a neglibility, assuming it has a good impendance match with the type of application being written.

In thinking about this issue, I am in fact tempted to recommend that you hire programmers who are unfamiliar with the language your system is written in – because if they still struggle with the basics of a new language after a month, you might want to reconsider their future with your company. But that may be too bold a claim. Even if, in lesser form, it has been made before.

The bottom line is that you need people capable of producing a clean, flexible and only-as-complex-as-necessary architecture for the problem they were tasked with solving. And you won’t get that from an army of code monkeys, even if you hire 1,000,000 of them.

25 Comments...

28 Dec 05
17
30

Verbosity  28

By Alex Bunardzic under Languages

I’d like to offer several snippets collected from the recent discussion threads on programming languages (regarding conciseness and verbosity). One person wrote:

The important point about verbosity is not the time you spend typing: it’s about how difficult it is to read and understand the code.

To which the other fellow responded:

And verbosity makes code easier to read. I don’t have to know anything to understand the code. Everything I need to know is there in front of me.

Now, that’s an interesting way to look at the problem of understanding the code. Would you agree that the more verbose the source code is, the easier it gets to understand it?

Finally (and inevitably), the sacred cow of corporate computing (Java) is dragged in to demonstrate the benefits of verbosity as a feature that encourages reusability through increasing the level of abstraction:

The verbosity of Java code also encourages developers to implement more abstractions and reusable components. The ease of coding in some languages often results in more code, in my experience. It’s easier to just write more code than to stop and think about reusable solutions. In Java and other verbose languages, ‘coding for the moment’ is a losing strategy.

Interesting stuff, innit? Do any of you guys agree with this, or have comments to offer?

28 Comments...