Changes between Version 9 and Version 10 of ControlSystems/SoftwareTeam/CodingConventions
- Timestamp:
- Sep 20, 2021, 5:39:50 PM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ControlSystems/SoftwareTeam/CodingConventions
v9 v10 6 6 * when choosing between a clever algorithm and one that will do the job and is easier to understand, use the latter. 7 7 * Understand [https://www.agile-code.com/blog/cohesion-vs-coupling-separate-concerns/ coupling vs. cohesion] deeply. These are the two most important concepts in software engineering, everything else is an attempt to increase cohesion and reduce coupling. Every block of code (class or function) should be a stand-alone black box with cleanly defined inputs and outputs. You should not need several files open to understand how one method works. 8 * Use meaningful names 9 * Function/method names and parameters should convey what they do. For example: 10 * move_arm(int direction); 11 * Variable/data member names should convey what they store including units if appropriate. For example 12 * int target_position_degrees; 13 * Comments should explain WHY. For example: 14 * bad comment: int target_position_degrees; !// target position in degrees 15 * good comment: int target_position_degrees; !// angle where arm should stop moving 8 16 * Tool (and language) wars are for noobs 9 17 * Being kind is better than being right