An Informed Programmer.

Owais Idris
Geek Culture
Published in
8 min readApr 14, 2022

Hello World. I hope you are doing well. This article is not a technical but more towards pleasure reading. Idea is to tickle your thoughts so that you can take meaningful decisions ahead. Following are some analogies with real life examples that will help you think programming.

Image only for representation purpose

Code for today

Have you ever imagined about hitting the road with your eyes closed. A road unknown to you. Some can try their luck and manage to take that risk, but many can’t. Though walking and carrying ourselves is our day to day activity, we are used to it and have practice hundreds of time. We are sure when we take a step forward. But when we try to walk in a shallow river then we try to find a stable surface only then place our foot.

This is very similar to writing our code. You can only code if the requirement is clear in your head. Even the smallest unit has to be very clear and one must be able to visualise it. If you can visualise it and find no loose ends then coding is pretty good to start.

You must only code for the requirements those have clarity today. Any unclear requirement must go through brainstorming sessions with stake holders. Remember, if requirements are difficult to explain, it is an indication that it is not defined clearly. One approach could be dividing requirements in to sub-requirements, identify and address fuzzy part.

Software is an ever improving Portrait

Have you seen an artist working on a live portrait? Does he/she manage to create final output at once? No, the process is based on a technique of iteratively progressing in a systematic way to achieve desired goal.

This is same with Software Development, Programming is an Art and you need to think like an artist. Complex problems can be solved only by breaking them into smaller problems and then conquering each.

Each Software development starts with sketching a bare minimum structure by creating abstractions, creating interfaces, thinking about data and its structure. Once that is done then next iteration include realising those abstractions by writing implementations, going deeper and deeper into implementations and coding for smallest unit possible. Wiring them together and testing and so on.

Re-Iterating like a sketch is the journey of Software development and for that, one needs to master The Art Of Refactoring.

Refactoring simply means organising and re-organising the code without changing its behaviour. These could be anything like Extracting a Method if the code is repeated more than once or extracting because some lines of code are specifically doing only one thing, Identifying the Dependencies by simply drawing the meaning or relating them with real world entities(Like Cycle Depends on Tire and not wise versa) and still preserving the behaviour of a Cycle or a Tire etc.

I would recommend to read a book on Refactoring. Here are couple of books you may start with.
1. Refactoring: Improving the Design of Existing Code — Martin Fowler

2: Working Effectively with Legacy Code- Michael C. Feathers

Test Harness

As the software grows, world of things are going to happen with it. Tests will help you to keep a track of your software behaviours. A software is a result of various Imaginary Rules that solves a particular Human problem. As time progress it will be very difficult to remember all of them. We might want to add features and check rest of the software is behaving as expected. This could be a repetitive task and could happen on daily basis and so we need some measures to take care of it. Tests are those measures. Computers can keep repeating and running test cases against our software every day or every couple hour without exhausting unlike Human.

Generally during our schooling very less emphasis given on writing a Unit Test and most of us know Unit Testing theoretically only. Notions like, Unit testing is kind of extra effort, why should we manage two code-bases? If we are making mistakes in writing code what is the guarantee these so called “test code” will be error free? This one is my favourite “We are already writing perfectly working codes, why do we need tests for?”. All these notions create barriers and make even more difficult to understand importance of Tests.

Let me admit, we also went through all these reluctant thoughts. One peculiar experience if you are starting to learn Tests very late in your career is, even if you read articles, read books you will kind of understand what an author is trying to make you understand but still it will some way not make sense initially. Concepts will sound very obvious but still it will not “Click”. It is very similar to attain “Inner Peace”. Everything else we learnt was knowledge but this part is Wisdom.

So, what shall we do to imbibe this wisdom? Well the answer to it is also a wise.
Take a leap of faith. Surrender to your tests

You will have to forget that you are a perfect programmer. Write a test, give some input to the Class you are testing and expect some output. This should be even before you write anything in the said Class. The test will fail. Then write code only to pass that test, just enough to pass the test. Leave next behaviour for up coming next test. Don’t think beyond this class and keep on writing tests and passing them until the desired behaviour of the said class is achieved. Don’t hop between other classes. There might be situations like the said class will need to collaborate with other classes but again those classes don’t exist. We can still keep on writing test and passing them for the current class by using techniques of Mocking and Faking.

You may learn these things on internet there are lots of Testing, Mocking libraries available for almost every kind of programming platform.

For Java you may check out Junit4, Junit5, Mockito. Similarly for Kotlin to name some Kotest, Mockk

Don’t Re-invent

Programming and Programmers have been evolving since 1960's. They have had hit various roadblocks and have addressed most of them. Like the real problems in life there is no one solution to every problem, similarly there have been categorisations of such solution those have been lying in scripts, books, published papers etc. We must learn from such documentations, this will fast-forward us and we will be able to learn from their mistakes and from their findings and from their solutions.

One way to start is by learning Programming patterns. There are 3 categories of programming pattern.

Creational
Structural
Behavioural

Creational Pattern
Structural Patterns
Behavioural Patterns

Check all of these in detail with example make a quick reference note so that you can revisit at any point of time.

Additionally, also learn about Architectural Patterns like MVC, MVVM, MVP, MVI… etc. Describing these patterns is out of scope of this article as I have promised you this will not be a techie one.

Having said that do understand the intent of Architectural Pattern. These patterns are adopted to make the communication between developers easier. In short it define more or less what code will go where, and if you are looking for something how should one navigate to it. When working in teams it save you from grave reworks.

Learn about some philosophies like DRY( Don’t Repeat Yourself) and SOLID principals. With an intent to gain wisdom same as learning Tests. More over all of these things will help you write decoupled and reusable code. Once you get the grip of these things you will not be that same person anymore. Your approach to problems will be different. Your understanding about what is not important will drastically change, eventually will save you from over-engineering. You will understand difference between Framework code and Business logic, this distinction will allow you to defer or delay some decision till the later stage of software development.

All of these stuff will enable you to Enjoy Software Engineering. Just like an Espresso, for you to develop liking to it will take some time. Its worth it.

Develop Empathy

As we learnt, its ideal to look for a solution for a problem if that has already been addressed by someone before, can save you from Re-Inventing same. This mean we are together into this and it is the community that contributes to your work and it is you who will contribute to community sooner or later. So be Empathetic. This is the most important gear for a Programmer to progress in career and life.

As we are in transition every time similarly every one else is in their respective fields. It is important that you request and appreciate everyone. Don’t hesitate to say Thank you even if you think its merely a formality. Respect time and efforts of everyone. If you are working in cross functional team and blessed with QA(Quality Assurance Engineers), even if they logging bugs for you, is kind of helping you and is trying to save you and company from grave problems.

One quick way to understand the feedbacks is to try understanding their role. Have a friendly discussion and try to find what day to day challenges they face and they work in what constraints.

Eventually your empathy will make some humble friends around you. Hence a good working culture.

Lastly I would ask you to always be Useful. Be Enablers. Our existence must always benefit people around us.

Do let me know your thoughts. If you think if there is a room for improvement in this article we can always accommodate them here.

--

--