Menu

The idea

Xuesong Guo

Main Idea

Adding a new feature into a application is easy, removing it is almost imposible, specially after some weeks.

Nobody remenbers what changes was made for this feature, so there would be more and more garbages untill the whole project is reconstructed.

We have process-oriented programming, we have object-oriented programming, but the real world is never drived by processes nor objects, but drived by features.

One day some importent man say: I need a feature, then the programmer thinks, they thinked out some solution which is maybe object-oriented or process-oriented, this solution was recorded in programming languages, so the structure of code matches the solution instead of the request.

This is not correct. The structure of code should match the reqeust, the code about a feature should be managed in a same place, and should be easy to be deleted or replaced.

How Is It Posible

A feature is considered as some modifies of the main structure. These modifies include:

  • add some variable into a class
  • insert some code into a special place of a function
  • add some class
  • create some global objects

MCS provide a new keyword (other than Pike's) MIXIN as a method to add some variable into a class.

MIXIN is actually a alias of class, the diffrence is: a MIXIN will be inherited automatically by the CLASS in the main structure which has the same name of the MIXIN. Corresponding to: CLASS is a alias of class which will inherit MIXINs automatically.

To insert some code into a special place of a function need mark the place and register the function. In MCS use MODULED->apply_function(this,"place_name") to mark the place, and use REGISTER(place_name) to register the function place_name(), the function name must match the place name. Actually, MODULED->apply_function(this,"place_name") calls all the REGISTERed funcion named place_name in the base classes of this.

add some class and create some global objects is easy, and will be descripted later.

Holographic

The main structure of a project, should be easy to be used as a module of another project. in another word: the code structure of a module of a project should be managed in the same way of the whole project.

Usually main structure reusable is not pursued, programmers may agree it is good, but not think it necessary.

Notice main structure reusable equals to MCS holographic, and MCS holographic is really importente. so main structure reusable is really necessary.

MCS holographic means the class added by the feature and the global objects created by the feature, should be some kind of a whole project, and can has features of them own.

Philosophy

The philosophy of MCS is: all things change, just do wrong thing good.

A normal programmer try to do things correct, but things change, so nothing would be correct. Even it is correct now, when the world changes, it's wrong.

A good programmer never think: because it's correct so we do it, he would think: even it's wrong, to correct it is easy, so we do it.

MCS is the tool to make correcting wrong things easy, In MCS's idea, a project should have a long lifetime, full of changes, and it's best no to reconstruct.


Related

Wiki: Create a FEATURE
Wiki: Home