How to write an unminerable code - programming section

zhaozj2021-02-11  191

How to write unoperable code

programming

The most important principle to write unmatchable code is to put the same fact as possible in different places, as much as possible to describe it in different ways.

1. The key to preparing the maintenance code is that the same fact is only in the same place. When you change your idea, you only need to change a place. The entire program also ensures still work. Therefore, the key to preparing an inoperable code is to specify the same fact over again, put it in different places, as much as possible to specify it in different ways. Fortunately, the language like Java makes it easy. For example, it is almost impossible to change a widely used variable. Because all conversion functions are no longer working, the type of related temporary variable is no longer appropriate. Further, if this variable is displayed on the screen, all related display and code must be modified manually. The Algol language family (including C, Java) is stored in Array, Hashtable, File, and Databases in different syntax. In the language similar to Abundance and some degree in smalltalk, the syntax is the same. Just declare change. Use good Java's unhappy. Putting you know that the data that will become too large for Rams into an Array. So the programmer of the maintenance code will have a terrible job to convert Array to the file. Similarly, save small files to the database, then the maintenance programmer will enjoy the fun of converting them to array to adjust performance.

2, Java type conversion Java type conversion mechanism is the gift of God. You can use it without sin, because Java language needs it. Whenever you take an Object from the Collection, you must convert it to the original type. Therefore, the type of variable must be specified in a pile of places. If the type is later turned, all type conversions must be rewritten. If there is a unlucky maintor, it is not possible to grab it all (or change too much), the compiler may not be able to catch him. Similarly, if the type of a variable changes from Short to Int, all related (short) must be turned (int).

3, using Java's redundant Java insists that you must develop the type of each variable twice. Java programmers have become accustomed to this redundancy, if you get two types, they will not notice. As will be described below. Bubblegum b = new bubblegom (); unfortunately, the popularity of operators makes it difficult to get rid of such pseudo redundancy code

SWIMMER = Swimner 1;

(to be continued)

转载请注明原文地址:https://www.9cbs.com/read-5033.html

New Post(0)