2020-09-05
The common perception for developers is they think, all they need to do is just writing a piece of code that is functional and their job is done. No, it's not as simple as that. If we want to become a more mature developer, we need to do beyond that. Writing a code is not just as simple as typing in some language syntaxes as long as its functional.
To go beyond that, first of all we need to plan before we write the code. I remember there is a quote saying 'if you fail to plan then you plan to fail'. We need to dig deeper what are the requirements, what are the expected behaviour of this feature that we are going to develop.
And then when we write the code, we need to understand the limitation and scope of a certain part of our code. For example, say we have an input box for a discount value, we need to know whether the value is in percentange or in amount, we need to know if the value can be fraction number or not, what will happen if the user input is string (not numbers), etc. That is just for one input box, what if that discount input box is related or has interaction with other parts, let's say we have discount type, then we need to think more of all the posibilities that might happen with those two inputs.
Furthermore, in terms of the code maintainance. We need to plan first, what kind of structure we want to follow, what coding style or linter we need to use, what will be the code naming convention, how to space out between lines, how to indent properly, etc. A good developer writes code for other humans to read.