Update src/roadmaps/software-design-architecture/content/100-clean-code-principles/109-use-correct-constructs.md

content/software-design-and-architecture
Kamran Ahmed 2 years ago committed by GitHub
parent cd0b6bc07f
commit 901f359d39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 17
      src/roadmaps/software-design-architecture/content/100-clean-code-principles/109-use-correct-constructs.md

@ -1,18 +1,9 @@
# Use Correct Constructs
Using the correct constructs in system architecture is important for ensuring that the code is clear, maintainable, and efficient. Some common constructs include variables, loops, conditionals, and functions.
In the context of clean code principles, "using correct constructs" refers to using appropriate programming constructs, such as loops, conditionals, and functions, in a way that makes the code easy to understand, maintain, and modify.
Here are some ways to use correct constructs in system architecture:
When using correct constructs, the code should be organized in a logical and intuitive way, making use of appropriate control flow statements and data structures to accomplish the task at hand. This also means that the code should avoid using unnecessary or overly complex constructs that make the code harder to understand or reason about.
1. Use variables to store and manipulate data in a clear and organized manner.
2. Use loops to repeat operations on a set of data.
3. Use conditionals to control the flow of the program based on certain conditions.
4. Use functions to encapsulate specific functionality and make the code more reusable.
5. Use appropriate data structures such as arrays, lists, maps, and sets to organize and manage data.
6. Use exception handling to handle and recover from errors in a predictable and consistent manner.
Additionally, correct constructs also means to use the right constructs for the right problem, for example, if you want to iterate over an array, use a for loop instead of recursion and also, you should avoid using global variables and instead use function arguments and return values to pass data between different parts of the code.
By following these best practices, the system architecture will be more maintainable, testable, and less error-prone, and it will be easier to read and understand the code.
Learn more from the following links:
- [Architecture Constructs](https://csrc.nist.gov/glossary/term/architecture_constructs)
By using correct constructs, the code will be more readable, more maintainable, and less prone to bugs, making it easier for other developers to understand, debug and extend the code.
Loading…
Cancel
Save