What should be the rules to write excellent code?

Click For Summary
The discussion centers around best practices for writing effective code, emphasizing principles that transcend specific programming languages. Key points include the importance of not polluting the global namespace, adhering to SOLID principles, and maintaining simplicity through the KISS principle. Test-driven development is highlighted as essential for ensuring that components can be independently tested with minimal setup. Functional programming is noted for its benefits in debugging and testing by eliminating side effects. The conversation also touches on the significance of proper documentation, meaningful variable naming, and coding standards to enhance code readability and maintainability. The role of design patterns and software requirements is acknowledged, alongside the recommendation of Steve McConnell's "Code Complete" as a valuable resource for programmers. While some participants argue against the use of 'goto' statements, others suggest that they can be beneficial in specific contexts, advocating for a balanced approach to coding practices. Overall, the thread underscores the necessity of thoughtful design, thorough documentation, and rigorous testing in software development.
  • #31
Document, document, document.
Read through the requirement
Identify testable statements
Use a design methodology relevant to the task/project
Use a recognised standard for documentation and design toolset
Identify methods/objects at the design stage
Use a programming language relevant to the task.
Wherever possible reuse known working classes if OOD/OOP
or working modules if procedural design.
Ensure the smallest components are easily testable, build up a library of components that could be reused later
Test each class/procedure from the bottom up, increasing complexity as you go, ensuring that the system requirements continue to be met
Test
Test
Test
The aim of the exercise is to obtain a software system that is fit for purpose and does what is required.
 
  • Like
Likes Svein

Similar threads

  • · Replies 40 ·
2
Replies
40
Views
626
  • · Replies 4 ·
Replies
4
Views
1K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 32 ·
2
Replies
32
Views
3K
  • · Replies 49 ·
2
Replies
49
Views
4K
Replies
47
Views
5K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 4 ·
Replies
4
Views
7K
  • · Replies 6 ·
Replies
6
Views
2K
Replies
10
Views
2K