Code is a Liability 47
I have thought for a long time that code is liability, and that viewing code as a liability has the power to transform our art. I read articles about code-as-a-corporate-asset and most of them are pretty good articles about wringing the value from the code you have, but I still feel that there’s something essentially wrong about it.
Programs are a great means to an end. Don’t get me wrong, I’m in favor of having software and I’m greatly in favor of writing software. I think we would be in pretty poor shape without it. But I can’t call code an asset.
Functionality is clearly an asset. When we can inter-operate with various services (possibly even web services) our businesses produce more business results more quickly. We use software to control machines and to increase public safety in more ways than most of us know (talk to the guys who write the software that controls your car, the over-the-road trucks, forklifts, industrial robots, and aircraft). Software makes our life better and it’s a wonderful thing. I’m all in favor of software functionality and you have to write code to get it.
Our bosses and clients will pay good money to get the functionality they want, and they want it right now! If we could give them what they want without writing a line, it would be a tremendous win. If we could do it with one line or two lines of well-considered code, we would be heroes! Why is doing less so valuable if code is an asset? Clearly less code is better.
Sadly, most companies have to deal with heaping, shaggy mounds of code. Code takes up time and space. It has to be managed. It has to be versioned. It hast to be tracked, and planned. It has to be updated, and packaged, and revised. It needs backup to save us from having to reproduce it by hand. It has to be reviewed (hopefully in an efficient way like pairing). It often drives companies to expand staff and dedicate people to manage it (version control administrators, managers, build czars, consultants, contractors, metric-gathering tool specialists, etc).
Old code gets in the way of new code. Having more code will typically slow development, and will certainly reduce your ability to incorporate new programmers. Of course you’ll need more programmers because you have all this code to deal with. Size has a cost.
The problem doesn’t go away if you artificially reduce the code. Folding a lot of effects into few lines of code makes the code worse. Adding voluminous documentation makes the code worse. Moving it into metadata and models and other forms doesn’t make it any smaller, and often makes it worse. Hand-crafted code is almost always more readable, smaller, more optimal, more focused, more literary in its style than generated code or funky data tables. Since there has to be code, it might as well be the best code we can write. Coding well takes human beings who value minimalism.
It seems that the trick with the functionality/code game is in trying to maintain a positive balance.
We reach a point on some projects where we are producing a positive number of functions with a net loss in lines of code. That’s a wonderful time. We reduce the line count by simplifying the code and eliminating duplication. Sometimes we refactor our code into a more compact form and then only add a very few lines of code to produce a change. If code were an asset, then those moments would be failures instead of triumphs.
Code size reduction is a very good thing. I want the simplest, the smallest, the least code possible, with the least risk of breaking something else in the system. I don’t want big functions that touch everything in sight. I don’t want long complicated blocks of if/else statements. I don’t want monster functions which conglomerate dozens of operations in a single, fat interface. Shallow is good. Short is good. Less code is good. More code is a liability. This isn’t about typing less, it’s about owning less.
This is the point of view that makes test-first (TDD) so important. TDD/BDD has us encode the functionality (the asset) first, and then write minimal code to realize the specified feature. If code is a liability, and function is an asset, this is exactly the right way to do things.
And maybe, just maybe, it might explain why one might open-source less-important useful systems.
I fully agree. I have long espoused the same idea, and have used the following metaphor to explain it…
Here is the ideal program (written in Python):
It does that thing…you know…that thing that your business can’t survive without? That’s what it does. This program is great because it’s easy to read, easy to maintain, and easy to change (while still being closed). For example, lets say that your business gets some venture captial and branches out into a new area, and you have to do a new thing. Well, then, we need to make some changes: But wait, you say! Where are my SQL statements? My input/output routines? My GUI? I need that stuff!Well, no you don’t. You need the functionality those things provide, but the actual code? No, you don’t need that.
Which is why, despite what you may have heard, lines of code can, in fact, be a useful metric for productivity. That is; Given the same level functionality (and all other things being equal), less lines of code generally indicates higher levels of productivity, because code == cost.
I have thought for a long time that legs are liability, and that viewing legs as a liability has the power to transform our gait. I read articles about legs-as-a-corporate-asset and most of them are pretty good articles about wringing the value from the legs you have, but I still feel that there’s something essentially wrong about it.
Walks are a great means to an end. Don’t get me wrong, I’m in favor of having walks and I’m greatly in favor of doing walks. I think we would be in pretty poor shape without them. But I can’t call legs an asset.
Wakling is clearly an asset. When we walk our businesses produce more business results more quickly. We use walks to reach machines and to increase public safety in more ways than most of us know (talk to the guys who do the walks to your car, the over-the-road trucks, forklifts, industrial robots, and aircraft). Walks makes our life better and that’s a wonderful thing. I’m all in favor of walking and you have to have legs to do it.
Our bosses and clients will pay good money to do the walking they want, and they want it right now! If we could give them what they want without moving a leg, it would be a tremendous win. If we could do it with one or two movements of well-considered legs, we would be heroes! Why is doing less so valuable if legs are an asset? Clearly less legs are better.
Sadly, most companies have to deal with heaping, shaggy mounds of legs. Legs takes up time and space. Legs have to be managed. They have to be versioned. They have to be tracked, and planned. They have to be updated, and packaged, and revised. They need backups to save us from having to walk on our hands. They have to be reviewed (hopefully in an efficient way like pairing). They often drive companies to expand staff and dedicate people to manage them (version control administrators, managers, build czars, consultants, contractors, metric-gathering tool specialists, etc).
Old legs get in the way of new legs. Having more legs will typically slow development, and will certainly reduce your ability to walk. Of course you’ll need more walkers because you have all these legs to deal with. Size has a cost.
The problem doesn’t go away if you artificially reduce the legs. Folding a lot of effects into fewer legs makes the legs worse. Adding voluminous documentation makes the legs worse. Moving them into metadata and models and other forms doesn’t make them any smaller, and often makes them worse. Hand-crafted legs are almost always more readable, smaller, more optimal, more focused, more literary in their style than generated legs or funky data tables. Since there have to be legs, they might as well be the best legs we can get. Walking well takes human beings who value minimalism.
It seems that the trick with the walking/legs game is in trying to maintain a positive balance.
We reach a point on some projects where we are making a positive number of walks with a net loss in legs. That’s a wonderful time. We reduce the leg count by simplifying the legs and eliminating duplication. Sometimes we refactor our legs into a more compact form and then only add a very few legs to produce a change. If legs were an asset, then those moments would be failures instead of triumphs.
Leg-size reduction is a very good thing. I want the simplest, the smallest, the least legs possible, with the least risk of breaking something else in the system. I don’t want big legs that touch everything in sight. I don’t want long complicated legs. I don’t want monster legs which conglomerate dozens of legs a single, fat leg. Shallow is good. Short is good. Less legs are good. More legs are a liability. This isn’t about walking less, it’s about owning less.
This is the point of view that makes sit-first (SDD) so important. SDD/BDD has us consider the walk (the asset) first, and then do minimal legs movement to realize the specified goal. If legs are a liability, and walking is an asset, this is exactly the right way to do things.
And maybe, just maybe, it might explain why one might open-source less-important useful legs.
(I know, I know, but I slightly disagreed with the post and couldn’t think of a better way to phrase it.)
I can’t stop laughing about “heaping, shaggy mounds of legs” (a need for nair perhaps?), “leg size reduction” (which I could probably use a little), folding effects into legs, and of course the bit about trying to maintain positive balance (perhaps after the third beer?). I’ll read it again later and try to vector in on your slight disagreement, but for now you’ve positively brightened my morning.
I totally agree with this post, and find developers on my teams naturally discover this on their own constantly.
As for the legs post… quite a laugh. To seriously consider that metaphor… centipedes are quite fast little bugs and millipedes are typically much slower. It seems that evolution has already proven the right balance of legs….
So in code and legs we should be thinking that hundreds of lines of code are much better than thousands.
Maybe all code is an asset, but one chunk is a ton of tin and another is a few ounces of gold. Prefer gold because it’s easier to drop in your pocket and smuggle out of the building. No, wait, that can’t be right.
In my opinion, this article is based on an over-simplification. All code is not a liability. Bad code is a liability; whereas, good code is an asset.
It is just like honest to goodness plumbing. Surely, I am interested in the effect (the removal of waste) more than I am with the number of pipes in the ground. Good plumbing is an asset. Bad plumbing is a mess.
I didn’t say code was bad. I said it is a liability. By that I mean that it costs, and that the costs recur, and that the costs are proportionate to the volume of the code.
Update: I found some good stuff from wikipedia:
There you go.
Most developer agree writing less code with same functionality is good. However, one common way is to move logic from code to config. Essentially the LOC is reduced, but the system getting more comlex than it should be.
Carfield: That is because most people don’t recognize that config files are just another form of code (albeit written in a limited and often non-standard programming language). All these developers are doing is shifting the responsibility for writing the code from themselves to the users—and giving them terrible tools to do it with. No wonder the overall system gets more complex!
Yes, code is a liability because it is inventory. All of the attributes you’ve noted about lines of code which make them a problem are facets of inventory. Code is inventory. Inventory that is not being turned over is a liability. Inventory that is being turned over (in this case, enabling functionality) is still a liabiltiy, but the fact that it is delivering value makes it worth more than it is costing. Driving toward zero inventory is always a good thing.
@Max: Excellent.
That is exactly what I want to say and didn’t know to say. Code is inventory. Thank you very much.
Tim
...so that makes two of us. :)
What are you guys on about? Code is a massive asset. If it was as simple as typing: DoThatThing(Val As who_cares_because_the_compiler’s_so_clever_it_will_do_whatever_you_intended_anyway) then everyone from the director to the cleaner could do my job! Code is an asset because it scares people. I’m sure you all know of someone who would actually be good at it but they just won’t look at it because they’re intimidated.
My first piece of advice is to make the functional parts of your code follow the principles discussed in most of the prior posts(i.e. less is more), and add to that heaps of mean, scary looking non-functional code to make sure that when they want something changed, they’ll come crawling back to you!
Here’s a link to an article called “How To Write Unmaintainable Code”, which will help you to that end.
http://www.afralisp.net/vbaa/unmain.htm
My second piece of advice is not to take this post too seriously, but read that article for a good laugh, and even a lvaluable lesson in how not to do things…
However RSpec uses an alternative syntax that reads more like a specification than like a test. Let me show you what I mean.
I wrote a blog post around your comment that “The problem doesn’t go away if you artificially reduce the code.”
Would love to have your feedback on it!
http://blog.outsystems.com/aboutagility/2011/02/code-liability---how-to-reduce-your-risk.htmlI’m sure you all know of someone who would actually be good at it but they just won’t look at it because they’re intimidated.
My first piece of advice is to make the functional parts of your code follow the principles discussed in most of the prior posts(i.e. less is more), and add to that heaps of mean, scary looking non-functional code to make sure that when they want something changed, they’ll come crawling back to you!
We are the professional clothes manufacturer and clothes supplier, so we manufacture kinds of custom clothes manufacturer. welcome you to come to our china clothes manufacturer and clothes factory.
Buy Sunglasses with 3-day FREE SHIPPING
So in code and legs we should be thinking that hundreds of lines of code are much better than thousands.
As for your “the British people want to be governed by one parliament not two or three”, the simple reply is No, the people of Scotland and Wales have shown in repeated referenda and elections
As for your “the British people want to be governed by one parliament not two or three”, the simple reply is No, the people of Scotland and Wales have shown in repeated referenda and elections
TopCombine Follow ipad bag the detail tips below, you can increase the laptop battery life of a year or more. Game Controllers first thing you should care about the USB Gadgets END!XDXDXDXDXXDXDXDXD
It looks like you have really placed a lot of effort into your blog and I require more of these on the web these days. My husband actually loved your article. I don’t have a great deal to say in retort, I only this minute wanted to comment to say well done.
Okey oynamak hiç bu kadar zevkli olmadi. Online ve 3 boyutlu okey oyunu oyna ve turnuvalara sende katil.
You have a very nice and motivating posting style, it makes me read your articles with great interest.
discounted Pandora Bangles
It’s great when you find relevant content .I can’t stay without admiring your post its really awesome thanks for sharing such a nice content.
It is nice of you to post this.I will pay more attention on it. Discount new Men sweater vests from China at on line store
thanks for share with us
see previous spirit elim younger sister that injustice shape. http://www.beadsonsale.net pandora bracelets
Gucci Shoulder Bags Gucci Clutches http://www.saleguccinewbags.com/gucci-boston-bags-c-58.html">Gucci Boston Bags Gucci Messenger Bags authentic discount gucci bags authentic discounted gucci bags
You guys are really Legal Assistant Job Description wonderful technology is visible in this blog that to searching the nice info is visible in this blog. I am searching the different services in this Director of Operations Job Description blog and the interesting services in this blog Accounting Job Description This is really inspired the Graphic Designer Job Description great technology that to using the amazing the info is visible in this blog
Slewing ring is also called slewing bearing, some people called: rotary support, swing support. English Name: slewing bearing or slewing ring bearing or turn table bearing, slewing ring in the real industrial applications is very wide.
Plz be careful for this fraud ?she can use credit CARDS and PAYPAL for fraud, buy a lot of products after say that no received, and then ask for
a refund, or receive fakes, give you return the empty package. Please be careful the fraud?This is paypal account: sarah cockle 6b School Road Kingswood Bristol, Avon BS15 8BJ United Kingdom 07943148074
Plz be careful for this fraud ?she can use credit CARDS and PAYPAL for fraud, buy a lot of products after say that no received, and then ask for
a refund, or receive fakes, give you return the empty package. Please be careful the fraud?This is paypal account: sarah cockle 6b School Road Kingswood Bristol, Avon BS15 8BJ United Kingdom 07943148074
It is true.Well. Though I am not a good application developer. And I need do more hard work to improve myself. When I come to here. I know that I have come to the right place to learn something I need. Thanks for your good advice. And I will do the practice as possible as I can. Thanks.
Maybe all code is an asset, but one chunk is a ton of tin and another is a few ounces of gold. Prefer gold because it’s easier to drop in your pocket and smuggle out of the building. No, wait, that can’t be right.
Been reading this site for awhile now, always has really good posts and topics please keep it up! loads of blogs are going under lately from lack of new posts etc dehumidifier | sewa genset
When I originally commented I clicked the Notify me when new comments are added checkbox and now each time a comment is added I get four emails with the same comment. Is there any way you can remove me from that service? Thanks! , convert m2ts video to avi, mpeg, wmv, flv, mp4, mov, dvd, vob
Thank you for bringing more information to this topic for me.After reading you site, Your site is very useful for me . [url=hhttp://www.christianlouboutin-onlineshop.com/]Christian Louboutin Online Shop[/url] Thank you for providing this information.I hope we can learn from each other.0Y366YJ
Great Work. Recently i am seeking for a dofollow blog list. Thanks for sharing.
Code is a Liability 42 hoo,good article!!I like the post!19
excellent information keep up your good work thanks.
code can also be hidden within tags. this is best for corporations
Well I definitely enjoyed reading it. This article provided by you is very helpful for accurate planning.
Great post. I was checking continuously this blog and I’m impressed! Extremely helpful info specially the last part I care for such information a lot. I was seeking this certain information for a very long time. Thank you and best of luck.