Saturday, September 26, 2020

Coding is easy, creating Enterprise level code is hard

In the first chapter of The Mythical Man-Month, Frederik Brooks describes the progression from a program to a programming product to a programming system to finally be part of a programming system product; and how this increases the complexity of software development. I personally think that he low-balled the differences and, these days, the difference between one extreme to the other is not just a single digit multiplier but orders of magnitude more complicated.

This may not be obvious to the casual or beginner programmer who can do wonders by knowing a language, a platform and having an itch to scratch.

This came to mind recently when I was figuring a way to have a separate background picture in each monitor on my Linux Mint system at home. Unfortunately, this is not a default functionality in the Cinnamon Desktop environment.

Very quickly I realized that I could create a large picture composed of two pictures and set it to span across monitors. Then I figured out that I could use the same technique to span single picture across monitors. I opened my image editor and created the background. Task done! ... or was it?

If you've read my other posts, you know that I am lazy. I didn't want to manually edit each picture I wanted to put as background, so I figured out I could do it with three ImageMagick commands. One to scale and crop the image(s), and two to assemble them into the final image. 

Awesome, but... I have hundreds of pictures from my last trip to Asia and I want to rotate them as my background. Executing those three commands for each picture is still faster than editing each picture manually, but I am lazier than that. I decided to create a little bash script.

The first version of the script was about 30 lines of code and it did what I wanted it to do. After all, it is a very simple task, to execute three lines of code. I had my program. Yeah! 

Still, it was 10 times the amount of code than the original 3 lines. 

The result was really pleasing and I remembered that while searching for the original solution I had found several people wanting to do the same. So being the nice guy I am, I decided to share it with others.

Sharing it meant that now I had to:

  • account for different monitor resolutions and configurations, (+18 lines of code)
  • read parameters (+75 lines of code)
  • do parameter validation,  (+38 lines of code)
  • error checking,
  • consider edge cases,
  • ensure that dependencies were installed,  (+7 lines of code)
  • follow  standards,
  • create some help (+47 lines of "code")
  • tidy-up the code to ensure it was readable by others (code elegance should not be understated)
  • Create a git repository to keep track of future versions and be able to share it.

In total, the script right now is 300+ lines of code. If you are keeping track, this is about 10 times the original script and 100 times the original 3 command I had to execute.

And this is just for a personal script which does the basic I want it to do. I have a small list of other things I'd like the script to do so eventually the script size will grow, but for now, this is good enough.

If this were an official release (programming product), I'd probably need to test it in a variety of environments, different monitor set ups, different video cards, even different desktop managers and create an installation package. All that with the associated documentation, error checking, parameters, edge cases, etc. Probably increasing another order of magnitude. Just to show a background image!

If this was a function required for an Enterprise level system, I would also need to worry about security, additional standards, logging, decomposition and integration with other components, versioning, automated unit testing, integration into a DevOps workflow and many other ancillary tasks.

Even more important: given that more people is involved in the creation of an Enterprise System, a developer needs to understand the finesses of social interactions to be really successful.

I hope you can now see how knowing a development language is just a tiny portion of what a developer must know to create production ready enterprise level systems and I also hope this blog is helping you becoming a better developer.

3 comments:

  1. hii bro,
    Can you please tell me how OOAD and agile,waterfall models and design patterns work together in real world projects?. Please point to me sources and examples to understand them.
    Thank you.

    ReplyDelete
    Replies
    1. I have some posts planned to talk about each of those topics. For now I can tell you that you that code design is independent of the methodology.

      Delete