Make a Lasting Impression
ImpressCMS Blog > Real Good Code and Code Standards

Real Good Code and Code Standards

CodeA while ago, there were some emails going around between @fiammybe, @MekDrop, @eyekeeper and I about being able to test new commits against a given code standard to avoid unnecessary work later on. This is a good question and practice, as is testing the code before integrating it into a development branch leading up to a release. There are tools that facilitate both of these processes - applying code standards and testing - and most modern IDE provide ways to do these things. However, such tools are only guides, as are the standards themselves.

Code Standards Are Good

When we first adopted our coding standards, we did so for several reasons:

  • To better support multi-language sites and environments we needed to standardize on encoding, line endings
  • To improve our performance we needed to adhere to a standard that made autoloading easier, reduced unnecessary white space, and helped us identify inefficiencies
  • To increase interoperability - our inclusion of external libraries increases the possibilities of collisions and conflicts if we (and they) don't adhere to some common standard
  • Increase readability and lower the barrier for new (and new to us) developers

We also were deliberate about the standards we chose to use and the exceptions we made to common standards, because of the above. 

Rules are made to be broken

There are 2 aspects of this - the theoretical (ideal) and the practical (real). I feel a growing urgency to focus more on the practical and publish as many updates and releases as quickly as we can. In our early days, we had a lot to learn, and we would discuss things for days and weeks, taking a long time to get to a point where we produced something real. We don't have that amount of time anymore.

You need to know the rules to know when to break them. 

You also need to know what the rules will miss. There is code that is completely compliant with our code standards, yet, is very inefficient. It works, doesn't contain any logic errors and meets the code format we have chosed. It is inefficient because rules are applied to individual statements and not to the collective.

As an example, I am working on integrating the private messaging improvements @sato-san did to make it more mobile-friendly. He has done a great job to improve the PM features for mobile devices, tablets and desktops and maintained functionality for existing sites performing upgrades. But, there are more than a few opportunities for us to take things to another level.   In the following video, I go through reworking the remainder of the code to be more precise and ready to move to the next step of pulling the page rendering out of the logic.

One of the things I have always admired about our project is our willingness to try new things, to learn from each other and to make each release better than the last. I think we're also making the Internet a better place and earning the respect all open source projects deserve.

Well done! Thank you.

Coming up, we'll have some tips and tricks for helping you set up your IDE and development environment for better coding. What things do you have on your list to conquer? How do we balance these 2 things? How do we learn while we produce meaningful features and improvements for ourselves and our community?

All posts by skenow
Subscribe to latest posts
The comments are owned by the poster. We aren't responsible for their content.
Poster Thread