Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ratio of real code to supporting code

I'm finding only about 30% of my code actually solves problems, the rest is taken up by logging, tests, parameter checking, exceptions, error handling and so on. Do you find that in your code, and is there an IDE/Editor that allows you to hide code that's not interesting?

OTOH are there languages which make the support code more manageable and smaller in size?

Edit - I think we're all aware of the difference between business logic and other code. I'm not saying that the logging etc is not important. The things is, when I'm coding I'm either implementing business logic, or I'm making sure things don't break. For me that's two different ways of thinking, do others develop like that, and is there an IDE that supports that way of developing?

like image 692
MrTelly Avatar asked Dec 04 '22 15:12

MrTelly


1 Answers

Supporting code is just as important as the "real code". The quality of your product is determined as much by supporting code as anything else.

Consider an automobile. In terms of just getting from point A to point B, that requires nothing more than a go-cart: a frame, a seat, an engine, a few tires. But modern cars have a lot more than just the basics. Highly efficient engines using electronic engine timing. Automatic transmissions. Bucket seats. Heating and A/C. Rack and pinion steering. Power brakes. Anti-lock brakes. Quiet, comfortable cabins protected from the weather. Air bags. Crumple zones and other advanced safety features. Etc. Etc.

Details and execution are important, even in software. If you find that your "supporting code" tends to look more like kludges and hacks, then it's time to rethink your fundamental approach. But ultimately the fit and finish determines quality of the end product as much as anything else.

Edit: The questions you should ask yourself:

Is your "supporting code":

  • An umbrella duct taped to a pole or a metal and glass cabin frame?
  • A piece of pipe tied to the front of the car or an energy absorbing bumper integrated into a crumple zone?
  • A grappling hook on a rope tied to the frame or 4-wheel anti-lock power brakes?
  • A pair of goggles and a thick coat or a windshield and a heating system?

Answers to these questions will probably affect how much you care about your "supporting code".

Edit: Response to Dave Turvey's comment:

I'd encourage rereading the original question, one of the examples of "support code" listed is "error handling". Consider this for a moment. Imagine it in the context of, say, an automobile, a microwave oven, or even an operating system. Should error handling be relegated to second class citizenship because it serves a "support" function in some abstract sense? In an automobile the safety features are part of the fundamental design of the vehicle and comprise a substantial part of the value of the car. The safety features and "error handling" of a microwave oven (indeed, of the microwave oven's embedded software as well) are an important part of its value as well. A microwave oven that was improperly shielded could cook food just fine, under the right circumstances, but it would pose a hazard to the operator.

The implicit featureset of every tool (software or otherwise) includes this list:

  • Robustness
  • Usability
  • Performance

Everything anyone has ever built or used has had these features. Failure to understand this will translate to failure to execute well on these features which will make for a poor quality product of low value and low commercial interest. There is no such thing as "support code", there is only a misunderstanding of the nature of what it means for a feature to be complete. A "feature" that works in the abstract only under laboratory conditions is an experiment, not a part of a product.

The idea of pure, pristine features floating on a bog of dirty, ugly support code is the wrong image of software development. Instead, think of elegant, superbly-integrated machinery that is well-built, intuitive to use, and powerful.

like image 113
Wedge Avatar answered Jan 29 '23 18:01

Wedge