fbpx

Why should you write a simpler code? Why should you choose simpler technologies?

Designed by www.freepik.com

Simplicity is the key to success. This principle applies to the way we code and what tec
Today is going to be a very powerful powerful discussion on why do we need to write simple code and adopt simpler technologies.
Today we are going to dive deeper in the minds of technology creators and programmers and try to understand the current scenario of the technology world
and also try to find out how we can create a better technology experience for ourselves.

In today’s world we see a ton of programming languages and even more frameworks to make our coding job easier and more productive.
Each programming language boasts about making your life easier by providing the latest programming constructs and features.
Every programming language has its way of handling basic building blocks of programming like classes, objects, variables, functions, data structures, memory management, etc.
Then there are different methodologies for programming like procedural, functional, object-oriented programming.
Based on the methodology you choose you also have to follow certain design patterns and anti-patters.
Then when programming languages themselves were not enough we got a whole lot of frameworks above those programming languages.

This all has led to an ever increasing complex ecosystem of programming technology whose earlier purpose was to make our job easier than ever.
The confusion is very obvious to happen in the mind of developers on what technology to choose. In the mind of architects what technology would be best for a particular project.
In the mind of new developers when they are starting their career. In the mind of startup owners when they want to start creating a digital platform for their venture.

Complex nature of technology is the first thing i wanted to discuss. Another thing that i want to discuss here is the nature of developers.

Many of the developers which I have met throughout my career boast about how complex logic they have implemented and how magically it is working.
Then there are many good coders whose code nobody can understand at first glance. You have to really study hard to find out what that piece of code is doing.
Then there are some who want to write everything in a single line. We will talk about these 3 kinds of developers in our discussion further.

Hence there are two things we will focus on this article:

  1. Nature of technology to become more complex
  2. Nature of developers to make things complex
Designed by https://www.vecteezy.com/

Simplicity is the key to success

Whenever we think about building a digital platform we always imagine a turn-key solution.
But building those turn-key solutions are not at all like turning a key.

Have simpler technology for success.

Sr noSimpler technologyComplex technology
1Faster development cycleSlower development cycle
2Faster go to marketVery slow go to market
3Lesser bugsLot of bugs
4Easy to debugDifficult to debug, especially finding problems on Production
5Easier to maintain and make changesVery difficult to maintain and make changes
6Easily scalableDepends on the expertise of your DevOps team
7Easy setup and deploymentsDepends on the expertise of your DevOps team
8Cost effectiveNot at all cost effective
9More developers available in the marketAlways facing resource shortage
10Lesser number of developers requiredLarge number of developers required
11Easy to test automateTest Automation is also complex
12Minimal learning curve for new employeesBig learning curve
13Less problems and delays for business ownersBusiness suffers multiple delays in projects
14Ideal for startups and SME’sAdopted by most MNC’s and big companies
15Supported by Open communitySupported by big corporations

Examples –
Complex technologies:
Java technology, .Net technology, etc..

Simpler technologies:
PHP, Javascript, Python, No-Code/Low-Code Platforms, etc..

KISS Principle

We all must know about the KISS principle.
Keep it simple, stupid (KISS) is a design principle which states that designs and/or systems should be as simple as possible.
Wherever possible, complexity should be avoided in a system—as simplicity guarantees the greatest levels of user acceptance and interaction.

Why do I get angry with people who write complex code?

Throughout my career as a team leader one of my important roles has been to perform code reviews.
I believe this is a very difficult task, since we have to understand what the developer thought process was while creating the code,
what logic is being implemented and also if all defined code conventions are followed properly.

The situation for us becomes like a school teacher checking an answer paper with extremely bad handwriting.
If the code is lengthy or complex we have to try very hard to understand it and sometimes I even had to allow a few of them due to deadline pressure.
Imagine some new guys coming to the team and he/she looks at the complex code which even the original writer has no clue about.
The new guy is completely clueless.
This adds to maintenance headaches and more production issues.

More simpler the code, project is easier to maintain. Believe me when I say that, maintaining a project is much more costlier than creating it.

What do I do to solve such problems?

“DO NOT ALLOW DEVELOPERS TO CODE”.

It’s a big statement, I know, but it’s true.
I do not want developers to code.
Let me tell you a story to explain you how I achieved this in the past.

Back in 2011 when I was working for a GPS tracking company they had very similar problems with code.
They had multiple projects for different customers and segments. Code was of very bad quality and not sustainable.
Even a small change in the code was difficult and adding a new customer onboard was even more difficult.
Solution:
I created a platform which had all required features under one umbrella project.
This platform did not allow the developers to code. You would only add configuration files(xml files) to the platform per customer based on their requirements.
Only a few developers were allowed to code new components in the platform. All client implementations were strictly inside xml files.
This is how we achieved a good quality platform with minimal bugs and code churn.

This same process we follow at Datamoulds too, hence we are able to deliver projects faster and with less bugs using our home grown technology stack.

Why do people write complex code?

There are multiple reasons why developers write complex code.

  1. They do not want to analyze alternative ways to achieve the desired output. May be due to deadline pressure.
  2. Less knowledge on alternatives.
  3. Less knowledge on what impact your code will have in future.
  4. Not staying in a project for a long time. Some people keep jumping from one project to another just because they only want development work.
    They do not want to solve the problems that they created in those earlier projects. These guys have no idea on how to write a maintainable code.
  5. Some developers want to write everything in as minimum lines as possible. While this may be good but not in all cases. For example look at the below line.
    var result = context.OrderDetails
    .Join(context.OrderMasters
    , orderdetail => orderdetail.OrderId
    , order => order.OrderId
    , (orderdetail, order) => new {
    order,
    orderdetail
    }).GroupBy(od => new {
    od.orderdetail.OrderId, od.order.OrderNo
    })
    .OrderBy(d => d.Key.OrderNo)
    .Select(grp => new {
    OrderNo = grp.Key.OrderId,
    TotalAmt = grp.Sum(f => (f.orderdetail.UnitPrice * f.orderdetail.Qty))
    });
    While above is supposedly a good code but it is very hard to debug.
    Imagine UnitPrice or Qty is null for particular records or the order record is itself non-existing. You would never know while debugging since it is just a single line to debug.
  6. Writing code very fast. Some developers are very fast coders. While it is good they do not realize that a code is never perfect in the first attempt.
    When you look at your code again you will realize you could have done a few things differently to simplify the code.
    But since they are always in a hurry they neglect this process and the code remains complex.
  7. Too much security handling in the code.
  8. Less knowledge or training on how to breakdown code into reusable small pieces of classes and functions.
  9. Most important reason is that many developers do not want to learn new things. They think what they have learnt is enough for now and continue to hold on to it.

Why I do not like object-oriented programming?

While a lot of people brag about how awesome they feel about object-oriented programming and how they are learning and coding them.
I beg to differ in this matter. I absolutely hate object-oriented programming to the core of my heart.
I have been working on object-oriented technologies for most of my career but still I never liked them.

Whenever I am given the freedom to choose the technology I always choose other options than object-oriented ones.
I have seen many object-oriented projects becoming so complex overtime that they are very difficult to maintain even by a very big team.

Just think about this, if object-oriented programming languages were so awesome and let us build reusable and maintainable components,
we would never have needed to build microservices in the first place.

I will leave the judgement to you, this is just my opinion. It may differ from person to person.
Nobody knows what is the perfect solution, we just work with the most feasible one or the one we know.

How will your productivity improve by writing simple code?

When you write a simple code which does a single thing properly, there is very less chance that it will fail.
Hence there is a very less chance of doing a rework on the same code in future, which saves a lot of developer’s time.
New guys can immediately grasp the logic that you are trying to convey to them.
Simple and reusable code block can be shared across projects as they are reusable.
You will also save a lot of time in code review since the reviewer would be easily able to understand your code.

Conclusion

As a matter of fact complex things do not tend to stay longer when there are simpler alternatives available in the market.
Now some technology creators are also understanding ways to make technologies which are more convenient for developers.
My personal suggestion to startups and SME’s would be to user a simpler technology stack and focus more on running and growing your business.

How can we help?

We at Datamoulds provide free technology and solution consulting to all.
Please feel free to reach out to us for any questions.
When you don’t know what you need just fill the below form and we will guide you absolutely free of cost.

We will be writing more such articles on our social platforms, hence keep following us for more updates weekly.

Leave a Reply