Dialectics of Nature and Software Engineering
There was a short essay in the “Electric Torture Chamber Notes” column of the old “Electronic Game Software” magazine:
One day in politics class, the teacher was explaining quantitative change and qualitative change. The whole class couldn’t grasp it. A gamer slowly said: “Quantitative change is leveling up; qualitative change is class change.” The whole class had an epiphany. They wanted to write a strange article titled “Marxism and RPG.”
This anecdote was probably omitted from the complete “Electric Torture Chamber Notes” due to political sensitivity. But leveling up and class change in video games indeed align with the philosophical description of quantitative and qualitative change. It shows that the universality of philosophical principles and their guiding significance for specific sciences (video games count as science, right? Otherwise why would the National 863 Project fund game engine development?) is truly remarkable.
Just finished my final exam today — the last one was “Dialectics of Nature.” Initially I thought it would be like Maoism and Deng Xiaoping Theory — relying on memorization. But during this half-month of疯狂 (frantic) memorization, I discovered that, as the textbook says, dialectics of nature “helps improve theoretical thinking and scientific实践 (practice) capabilities, better参与 (participating) in modernization.” Some descriptions of the view of nature, scientific methodology, and scientific outlook are closely related to what programmers encounter daily. Here are some excerpts:
Dialectics of Nature: Hierarchical View
Hierarchy represents different levels within a system’s internal structure, revealing vertical connections between systems.
Characteristics of hierarchy: lower levels have constitutive relationships to higher levels; interactions exist between lower levels.
Law of decreasing hierarchical binding energy: as hierarchy goes from low to high, binding tightness decreases from strong to weak.
Explanation: Hierarchical design is very common in software architecture. A complete system is divided into multiple related layers. Each layer has its own focus and functionality. Layers form单向 (one-way) dependencies — in principle, each layer only interacts with its neighbors: using services from the layer below to build itself, while providing services to the layer above. Hierarchical design facilitates business logic reuse and provides good extensibility and maintainability.
Example: OS layering. The image below is the Windows CE architecture diagram I copied directly from MSDN.
According to philosophical views, Windows CE符合 (conforms to) the universal规律 (laws) of hierarchical物质 (material) systems in nature. The entire OS consists of n layers, each with different structures and functions. From the characteristics of hierarchy, upper layers in Windows CE depend on lower layers for functionality — e.g., the OS layer uses OEM layer functions, the application layer uses OS APIs… Interactions also exist between layers, most notably in several basic OS functions: memory management, scheduling, file system — all interconnected. From the law of decreasing binding energy, the coupling within lower-level OS functions is quite high — memory management, scheduling, file system are interlinked in a network of dependencies. But at the application layer, each process has its own 32MB virtual address space — coupling大大 (greatly) reduced. By .NET Compact Framework, “high cohesion, low coupling” has become cliché. This正好 (exactly) matches the law of decreasing hierarchical binding energy.
Dialectics of Nature: On Methods
Definition of method: method is the path to achieving goals, the means to完成任务 (complete tasks), the way to solve problems.
Lenin’s quote: “Method itself is the object’s inherent principle and soul.”
Four elements of method: purpose, a series of operations, tools, and object.
Explanation: In OO, the importance of methods is self-evident. The simplest class and method (in C#):
class Foo
{
public void PrintMe()
{
int a;
a = 1 + 1;
System.Console.WriteLine(a.ToString());
}
}
We can see if PrintMe符合 (matches) the definition and elements of method. Purpose: PrintMe wants to print 1+1. Operations: those three lines of code. Tools: using WriteLine from BCL, plus csc compilation. Object: “method acts on an object; the object’s characteristics constrain the method’s design and application.” Yes — public class Foo vs private class Foo certainly constrains the PrintMe method.
And Lenin’s quote — it’s a brilliant论述 (discussion) of the meaning of methods in OOP. Comrade Lenin truly was a great revolutionary mentor…
Others
Dialectics of Nature proposes that “enterprises are the主体 (main body) of innovation, not research institutes or independent inventors.” This theory provides high-level guidance for our career choices: it directs us to work at Microsoft Research Asia, IBM, Oracle, HP R&D centers — not to be soho, not to stay in state-owned research institutes or universities. Because research institutes face the “danger of being disconnected from the market,” and independent inventors “usually lack实验 (experimental) equipment and funding.” Working at Microsoft Research Asia is a “objective requirement for transforming scientific achievements into productive forces and the inevitable need for enterprise survival and development under market economy conditions.”
On simulation experiments: “Simulation experiments design a substitute similar to the研究对象 (object under study), and through studying the model, extend knowledge to the object itself” — this is the theoretical reason why we use emulators for Windows CE application development in most cases. But “human understanding of models has both known similarities and dissimilarities; extrapolating from simulation experiments to real objects carries probability” — this is the theoretical reason why we still need to test Windows CE applications on real devices before release.
On the difference between science and technology: “from five aspects: task, method, research process, results and evaluation, value and significance” (original text too long). This section should be shown to those computer science students who looked down on the Software Institute — then they’d understand why the Software Institute focuses on技术 (technology) rather than scientific research, and realize that the Software Institute and CS department have different focuses…
Time for bed. So much more to say. Maybe I’ll add more when I get a chance. :-)