Constant Code Style

Published in category Programming and Productivity
on Christian Mayer's Weblog.

Having a constant source code style in a software project is important. Not only for Code Refactoring, but also for understanding source code. For example, you have a class called ChannelComment and a corresponding variable called $channelComment. Maybe you also have an array of Channel Comments called $channelComments. Of course you can name a single one like $cc while looping over this array, but don’t. Even if you are in hurry, don’t. (You shouldn’t hurry-code anyway.) Maybe you want to refactor all the $channelComments. That’s the point where it’s better to have clear named variables. Not only for yourself but also for other programmers contributing to this project. If someone else jumping into your code can be better understood. It’s easy to understand $channelComment than $cc$channelComments than $list or $ccList. This needs to be done through the entire software project. It’s ok if you use $cc for Channel Comments and for Channel Comments only. Not professional but ok.

More Resources

Recent Posts

About the Author

Christian is a professional software developer living in Vienna, Austria. He loves coffee and is strongly addicted to music. In his spare time he writes open source software. He is known for developing automatic data processing systems for Debian Linux.