banner
Light

Light Log

做充满希望的动物
x
github
bilibili
steam

Some Concepts About Program Design

A function should start with a definition.

As implementers of functions, the pursuit of implementation details seems to be ingrained in our bones. We strive for performance optimization, more efficient algorithms, less memory usage, and more controllable data flow behaviors... these are always right; people always seek better products. However, when developing a new product, this kind of habitual thinking can actually bring some troubles.

A very foolish vicious cycle is that we want a great product, so we use better technology and refine the details, which leads us to always discover better practices, and thus we can never complete the product. A better approach is to finalize the design from the beginning and then implement it. This is a more traditional method, suitable for many large systems, while agile development is an extension of this approach. Since small systems do not have as high a demand for detailed design as large systems, and modifications are relatively easy, design work and development work are integrated. By simplifying and iterating the traditional process, teams can deliver products and receive feedback more quickly. In recent years, many related services and tools have emerged in the market to adapt to this trend.

Is there a model that can meet the needs of large-scale development while speeding up to an agile-like pace? A few years ago, I read several books on domain-driven design, which is a great development model, but it has high requirements for teams. In other words, it is still a high-cost choice, and if the entire team cannot quickly gel, its development speed remains slow.

Existing development models seem to always require people to learn some new concepts. Is there a universal concept that allows us to get started directly? There actually is, because people in this field have to learn some mathematics to some extent.

Yes, mathematics, perhaps the most widely used and consensus-driven tool model in the world. My parents may not know how to write software to calculate and compute monthly revenue, but they can achieve the same result through mathematical means. When we look at the structure and logic of our software, they are merely practical applications of some mathematical theories! The shadows of mathematics can be seen in many modern design concepts, and perhaps it is time to bring the concepts back to the pure field of mathematics.

In recent years, the increasing popularity of functional programming seems to be a practical embodiment of this idea. So let's return to the initial statement: a function should start with a definition. This statement is actually about mathematics; mathematics is about definitions. Rigorous definitions lead to rigorous proofs, and a definable definition is usable and safe. Definitions and theorems in set theory, group theory, ring theory, topology, and many others allow us to build a provable, safe, and scalable stable system architecture based on this foundation. Powerful restrictive conditions enable each function to be tightly integrated without focusing on the lowest-level implementation details.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.