What should be the rules to write excellent code?

Click For Summary
SUMMARY

This discussion outlines essential rules for writing excellent code, emphasizing principles such as "Don't pollute the global namespace" in JavaScript, SOLID principles, KISS (Keep It Simple, Stupid), and the Liskov Substitution Principle. Participants highlight the importance of documentation, test-driven development, and adhering to coding standards to ensure maintainability and readability. The conversation also references key resources, including Steve McConnell's "Code Complete 2," which is considered a must-read for programmers aiming to enhance their coding practices.

PREREQUISITES
  • Understanding of SOLID principles in object-oriented programming
  • Familiarity with KISS (Keep It Simple, Stupid) methodology
  • Knowledge of test-driven development (TDD) practices
  • Basic concepts of functional programming and its benefits
NEXT STEPS
  • Study the SOLID principles in-depth to improve object-oriented design
  • Learn about test-driven development (TDD) and its implementation in various programming languages
  • Explore Steve McConnell's "Code Complete 2" for comprehensive coding strategies
  • Research design patterns and their applications in software development
USEFUL FOR

Software developers, code reviewers, and anyone seeking to improve their coding standards and practices will benefit from this discussion.

  • #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   Reactions: Svein

Similar threads

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