Write better code by understanding bad code.

A few days ago I wrote a bout what does it means to write “bad” code, what makes a source code “bad” and why “bad” source code gets written. One of the things I truly believe is that in order to be good software developers, we have to expose ourselves and experience the pain of inheriting “bad” source code and maintaining bad or poorly written source code.

Bad Source Code

By experience bad code we will be more motivated to actually and proactively find ways to write better code, there are many many many ways to write very good code, and the many techniques vary from small naming conventions to big architectural guidelines to proven patterns and practices. And if you believe in karma and what goes around comes around, if you write good code you will inherit good code and will inspired other people around you to write better code.

In general good source code can be describe with one word: “encapsulation”. I would argue that most if not all the good wisdom, patterns and practices in source development and software engineering can be explained with that single purpose: encapsulation.

Encapsulation in software development is so powerful that all the good practices and patterns  that our teachers and colleagues  tell us to use in our everyday software development and design duties, can have its motivation explaining by that single most important concept of encapsulation.

What I am saying here encapsulation is a very good thing at all the stack levels of software development and engendering. But of course the problem is when people don’t understand very well what is encapsulation and why is so good.

For now I will leave you with the condense message that in order to be a good developer is a very good practice to understand and work with “bad” and hard to maintain code. And the answer to write really good source code is by applying in the right way the concept of encapsulation.

In order to understand encapsulation you need to understand its definition and the definition of all the related concepts around it. I will be exploring more about encapsulation in a future blog post.

Bad and good source code review

Next Post »


Write comments
July 2, 2018 at 12:06 AM delete
