This document serves as a comprehensive guide outlining the coding style conventions that students and academic staff are encouraged to adhere to. Code style is a set of rules or guidelines that governs the layout of source code. These rules dictate how code should be formatted, structured, and written to ensure consistency, readability, and maintainability across a codebase. Additionally, this guide provides insight into the rubric used for evaluating coding tasks, ensuring alignment with industry standards and best practices.
This document aims to provide a guide to coding style, offering guidance, references, and criteria for evaluating adherence to industry standard coding conventions.
- Establish and maintain uniform coding styles across various bootcamps.
- Ensure that code produced by students meets industry standards for readability, consistency, and maintainability.
- Provide students with reputable style guides to enhance their understanding and application of coding style principles.
- Assess students adherence to coding style guidelines and provide constructive feedback for improvement.
The Flake 8 extension is a linting tool for Python code. Flake8 makes it convenient to check code for common errors such as syntax errors. It also helps to enforce some of the coding standards and best practices from the PEP 8 Style Guide regarding indentations, whitespaces, and more.
- Open VS Code and click on the extension's icon on the left panel.
- Search for Flake8 in the search bar.
- Click on the "Flake8" extension by Microsoft and then the install button.
Prettier is a code formatting tool that automatically formats code when saved, according to a set of predefined rules and conventions. This extension supports JavaScript, HTML and CSS, but it doesn't support Python. However, please note that Prettier focuses solely on code formatting and does not perform linting or provide warnings about violations of coding style guidelines as Flake8 does.
- Open VS Code and click on the extension's icon on the left panel.
- Search for "Prettier" in the search bar.
- Click on the "Prettier - Code formatter" extension by Prettier and then the install button.
After installation, you'll need to adjust the settings to enable Prettier. You may follow these steps:
-
Type "default" in the search box and navigate to the "Text Editor" folder. Next, set Prettier as the default formatter from the dropdown menu.
-
Lastly, type "format" in the search box and navigate to "Text Editor > Formatting". Check the boxes to format the file on paste, save and type.
While the above mentioned tools can provide helpful suggestions for maintaining coding style, it's important to note that they should be used as guidance. Adherence to the recommended style guides specified in this document takes precedence over the suggestions provided by these tools. Ultimately, it's the responsibility of students and all academic staff to ensure that the code aligns with the coding conventions outlined in the recommended style guides.
The rubric that is used for grading HyperionDev students follows a grading scale of 1 - 4 and includes four metrics. One of these metrics is coding style which assesses various aspects such as indentation, spacing, naming conventions, commenting practices, and overall code organization.
To ensure adherence to coding style guidelines, students are encouraged to:
- Familiarize themselves with the recommended style guides specific to the bootcamp they are enrolled in.
- Implement the specified coding styles in their tasks.
- Reference the style guides for guidance and clarification on coding conventions.
- Take responsibility to strive for consistency, readability, and maintainability in their codebase.
Mentors offer feedback and guidance to foster growth and development in the student’s coding journey. They are therefore responsible for:
- Reviewing students' code submissions with a focus on adherence to the recommended style guides.
- Providing constructive feedback on coding style by referencing specific sections of the style guides.
- Guiding students in understanding and implementing coding conventions.
- Supporting students by reinforcing good coding habits that align with industry standards and best practices.
Different style guides might offer conflicting guidance on coding conventions. Therefore, we have compiled the aforementioned list of reputable style guides for your benefit. These guides are helpful for understanding coding conventions and should be prioritized for the assignments. In the event of discrepancies between these guides and the one utilized, it will be imperative to explicitly specify the guide being adhered to in order to resolve any conflicts.
To adapt to evolving industry practices, continuous improvement of coding standards is reflected in these guides. Therefore, this is a living document that undergoes periodic revision and maintenance to ensure its relevance.