Maintainability Patterns

This chapter will cover several patterns that are related to improving code readability and the ease of maintenance. These aspects are sometimes overlooked because programmers always think that they know what they are doing. In reality, programmers do not always write code that is readable to others. Sometimes, the code could be too cluttered and difficult to follow, or the files may not be very well organized. These problems can often be mitigated by refactoring.

Metaprogramming can be a good way to further improve readability and maintainability. In some cases, there are existing macros that we can utilize today. It would be a shame if we do not explore such opportunities. We know good programmers always have the relentless desire for achieving excellence, so learning these techniques would be a rewarding exercise. In the subsequent sections, we will look into the following patterns:

  • Sub-module pattern
  • Keyword definition pattern
  • Code generation pattern
  • Domain-specific language pattern

By the end of this chapter, you will have learned how to organize your code better. You will be able to reduce clutter and write very concise code. In addition, if you are working on a problem with a specific industry domain, you can build your own domain-specific language (DSL) to further express your problem clearly in your own syntax.

Let's go!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.14.253.152