Clean Code Standards

Clean Code Standards

At Interactiv4 we are implementing standards and good programming practices. Among them we have included many of @robert-martin-7395b0's Clean Code tips.

Why?

Most of you are lucky enough to not know me yet, so I'm going to give you a little context. I have been programming in #PHP for more than 20 years. I have worked with elearning, blogs, newspapers, ecommerce, software download pages, and many things that I don't remember. Much of it with its own frameworks.

My point is, I've been programming for many years and I've made a lot of mistakes. A lot. Also, lately I've been refactoring a lot of third-party and own old code, mine too. I learned that the worst programmer is yourself 6 months ago.

On the other hand, I am quite an optimizer of time and resources (my mother called it “lazy”), and I have learned, and I continue to learn, that there are some ways of programming that do not avoid errors, but make them appear much more quickly. In the best of cases, during the development itself.

Also, I have a very bad memory. I don't remember what I coded a month ago. So many times I have to reverse engineer what I have done myself not much ago. For my own mental health I have practiced with ways that make these stuff a little easier for me.

For all this, in recent times I have missed some standards that unify certain ways of doing things. Almost all of us have common sense, but I thought it would be cool to have a list so that in addition to being “common”, it can be “shared”.

Two main objectives:

  • Readability. If at a quick read you understand what code wants to do, it not only saves you time, but you find problems sooner.?
  • Separation of responsibilities or reasons of change.
  • Separation of levels of abstraction.

All together enhance code maintainability. It is the most important thing in any architecture with meaning and ease of improvement (and therefore with a desire to last a long time). It is the basis of methodologies such as #hexagonalarchitecture, #DDD, #CQRS... There are countless books, articles, videos... talking about it, so I am not going to go into depth.

Speaking of books, thinking about standards I remembered the book Clean Code, by Uncle Bob. I'm sure many of you already know it, and if not, I highly recommend it. In it there is a summary list of heuristics and recommendations. Since he is an internationally recognized eminence, it seemed the best way to choose programming tips.

So our Engineering Team has selected the ones that most apply to our ecosystems, and we have adapted them to work under Clean Code standards. As we have also been working for some time under #hexagonalarchitecture, #DDD and #CQRS, our code is moving to another level. Whenever we can, because not all Magento’s developments are compatible or efficient with these architectures. I know that in the case of #Magento, which is not very friendly with all this, we are apparently fighting against it. But we can try to keep our business logic as clean as possible, and isolate the limitations of #Magento in the Infrastructure layers.

I am #proud to be part of a team that encourages self-improvement. Because this is what it's all about, self-improvement and making our lives easier.

#proud #i4 #cleancode #programming #selfimprovement #Magento


要查看或添加评论,请登录

社区洞察