Code Style Guide

Course Home \

Most companies or open source projects will have some form of a style guide. A style guide is a set of agreed rules about how to write and structure code within the project. They typically cover naming conventions, spacing, bracket placement, max characters on a line - the list is endless. I’ve linked to some established examples below.

The most common part of a style guide is around naming conventions. Naming conventions describe how we should name parts of our code. For example, classes should always be CamelCase, and properties should always be UPPERCASE. In a lot of programming languages, they don’t actually care what casing you use, so these rules tend to be based on personal preferences (or company preferences) and making code more readable.

For someone new to programming, you can get to grips with these at a later date or adopt an established one from the beginning. I don’t really have a fixed approach, but I do encourage everyone to simply be consistent. This will help you understand your own code as you’re learning.

Next Lesson ➔

Resources

Google Style Guides
Mozilla Coding Style

Richard Bradshaw's photo
Author

Richard Bradshaw

@FriendlyTester

Software Tester, speaker and trainer at Friendly Testing. BossBoss at Ministry of Testing. Whiteboard Testing creator. Striving to improve the testing craft.

Comments