Sunday, April 15, 2012

Spartan Programming


What is Spartan Programming?
Spartan programming seeks to reduce code complexity through  minimum coding practices.

Instead of these 4 lines of code,
import GREETERS:MyClass;
Local GREETERS:MyClass &greeter = create GREETERS:MyClass();
Local string &message = &greeter.GreetMe();
MessageBox(0, "", 0, 0, &message)
we could rewrite in two lines as below:
import GREETERS:MyClass;
MessageBox(0, "", 0, 0, (create GREETERS:MyClass()).sayHello());
It may be difficult to read this 2nd method but less codes to maintain..

No comments:

Post a Comment