Clean Code - A Visible Series

Journal Topic of Robin Gruenke

Previously, I saw an amazing talk of Robert C. Martin (aka Uncle Bob) on Youtube. I was hooked to internalize all his ideas, because they are simply great and very reasonable. What he talks about are the lessons learned when it comes down to solid software development. With this journal entry I want to summarize some parts of his talk but in general, I want to document simple but powerful concepts for better and cleaner code. Enjoy ! View the talk

Starting with the basics: Naming
JAN 14, 2021 - Robin Gruenke

This first Illustration is all about names and naming. Naming is a very important topic in programming, so that you can understand from a high level perspective what the code is doing.

Actually, naming is so important that it will deeply characterize any code base on how well you can work with it. As a result, naming and the time you spend for creating names, is time well invested for the future.

When you think more about it, naming by itself is something which everybody can do quite intuitive. But to think about its implications long term, within one ore many applications where multiple or even dozens of people work on, is quite a counter intuitive thing. Therefore, to have some very universal and coherent rules, can make quite a remarkable difference for the success of any project.

How to structure files
JAN 14, 2021 - Robin Gruenke

As a general rule of thumb: Your files should read like journalism. Start descriptive and let the reader decide what to read next if interested.

Starting detailed and heavy, is like a barrier blocking your code. This is because other readers will struggle to understand the big picture of what the code actually wants to do and how to contextualize it with other parts of your code base. Being "polite" in your code by going from simple abstract to implementation details is something which makes your project a powerful tool and what makes the difference between being wasteful and being wise.

I have collected some further general ideas on how to structure your file. These are ways you can organize your files to that you can be more productive and consistent:

- Order functions alphabetically for quick navigation and to avoid merge conflicts.

- Order functions by abstraction for better reading flow.

- If you are declaring datatypes or alike, you can group them with functions that work on these dataypes. (You can also do this grouping for functions by default, if you add the datatype name at the beginning of each corresponding function and sort all functions alphabetically).

- Order branches, properties, list items alphabetically to avoid further merge conflicts.

- Create sections of functionalities to group code that is related and place a single worded and descriptive banner comment on top.

Copyright 2020-2023 Robin T. Gruenke