Member-only story
Why Code Readability is important
If you struggle to read the code, how the hell are you meant to fix it #HoskWisdom
Code readability is an important quality of good code, it’s a subjective topic which varies between developers.
If code is easy to read, it will be easy to understand and easy to debug, maintain and extend. Writing complicated code is easy, writing simple code is harder and takes longer.
Learning to make code readable/understandable is difficult for inexperienced developers because it can be difficult to quantify the differences between readable code and un-readable code.
You can spot good code and bad code but when asked to explain why some code is good and other code is bad a lot of developers will shrug there shoulders and just say “Because it is”. Similar to when you know something isn’t right, it doesn’t feel right but you are not sure why.
Why is code readability important?
When a developer initially writes the code their knowledge of the system is very detailed because usually they have worked on the project for some time, read requirement/technical specs. They know the code/related code, they know the system, everything is in harmony.
6 months or a year later no one is going to know the system that well again, so you have to understand how the code works by reading it.
Poorly written code can make this very difficult, code with poor readability is
- Difficult to understand
- Longer to debug
- Hard to maintain
- Tricky to extend
Code Readability in Dynamics 365
I have seen lots of plugin code and lots of the code is smells (code smells)
Plugins can be written quickly, developers create one big method in the plugin which does everything. This creates plugins of 100’s of lines long, retrieves, calculations, make a cup of tea. These plugins are hard to read, difficult to debug and a nightmare to change/extend.
The writer of the code no longer working at the company, someone else having to find and fix the bug…