What? No Code?!?
When I say things like “writing code bad, other stuff good” it comes out sounding radical and there a couple natural points of pushback. The most significant one is “yeah right, we put our business information in something else and that changes too - so we’re trapped forever in technology and like being addicted to food we just can’t stop”
Let’s nip this in the bud. The key difference between code and storing expressions of the intent of our app is that you can recognize, categorize and morph declarations. Sure, the syntax of any declaration is based on the technology its intended for. Just look at the massive difference between GenDotNet metadata and the metadata behind entity framework which solves a critical subset of the same problem. But, any metadata worth its salt can be transformed into any other metadata syntax. That’s why I’m excited about seeing the entity framework tools work tools work well. They create a standard mapping for any code gen anywhere. It’s just messy transformations that we know how to do.
Code is the opposite of isolation. It’s such a convenient mechanism that everything is thrown together. It’s ghoulash when we need a wedding cake.
If I write code for CSLA, the details of my classes are heavily influenced by the superstructure of Rocky’s library. I’m going to bury my stored procedure, parameters, data reader assignments, authorization, validation, etc into VB or C# code related to a specific library. All of these specifics are also required for a different library and a different set of libraries or C#, VB, Ruby, Python, F#, Post#. By separating out the known aspects of the job we’re doing – we can use it or not use it in the next great thing. I may not use the stored procs in Entity Framework.
While I have a lot to say trying to jar your world view into seeing code differently, it’s exactly that: kicking your world view. Code remains critical for two reasons. I generate my code, but I have to create code, not some other magic. If I don’t have code, I can’t debug. That’s one of the many, many things we forget about the 4GL disasters of the late 1980’s – you could no more debug the crap than fly to the moon. Imagine writing an application designed to run a refinery and hearing the programmers say “I don’t know why it does that, but try something that worked another time I didn’t know what to do”. A refinery! In a generated system, code becomes how the system tells you what it’s doing more than the reverse.
The other important thing about code is that as we move away from code as core way of expressing intent - the code that matters cannot be moved. You find business logic simply because it remains when all the potentially declarative stuff is removed. How exquisite we can make the code we have to write when it stands alone and we address it as a primary purpose of our existence. And how much more if it we’ll write when we aren’t busy plunging the toilets of our application plumbing.