120 likes | 161 Views
Explore the art of metaprogramming and its significance in software engineering. Learn how it enables software reuseability, consistency enforcement, and semi-automatic programming. This paper discusses metaprogramming techniques, their application in web component deployment, and the challenges hindering their common usage.
E N D
Metaprogramming and its relevance in Software Engineering (CSC 532 Term Paper) By, Sucharitha Rodda
INTRODUCTION • Need for an evolution of Abstract Conceptual tools • Metaprogramming is the art of programming programs that read, transform, or write other programs
Metaprogramming in everyday life • Input -> Output • 0 -> 0 : Normal program • 1 -> 0 : Interpreter • 0 -> 1 : Data Pre-Compiler • 1 -> 1 : Automatic translator • 2 -> 0 : Metainterpreter • 2 -> 1 : Code walker • 1 -> 2 :Phase splitter
Significance of Metaprogramming in • Software Engineering • Enables Software Reuseability • Enforces Consistency • Performs semi automatic programming • Helps in inexpensive maintenance of software
Metaprogramming applied to Web Component Deployment «interface» Component +m1() +m2() «interface» MyComponent MyImpl
Architecture «interface» Component +m1() +m2() «interface» MyComponent MyImpl MyStub +handle() «interface» Skeleton MySkeleton
abstract class A { int i; A a; } interface B { } class C extends A { float f; B b; } class X extends C implements B { X x; } class Y extends X { boolean[] b; } class Z implements B { X x; } XMLSerializer: public static void serializeClassY(XMLSerializerStream s, Y o) { if(s.serializeReference(o)) return; o.serializeXML(s); // o may be of type Y or any // subtype thereof }
public void serializeXML(XMLSerializerStream s) { s.openingTag("<classY>"); serializeBodyClassY(s); s.closingTag("</classY>"); } protected final void serializeBodyClassY(XMLSerializerStream s) { serializeBodyClassX(s); // superclass data layout XMLSerializer.serializeArrayOfBoolean(s, this.b); // boolean[] b; }
Implementation • Analysis • Transformation
Why are metaprogramming techniques not used commonly? • Consist precisely in not using the studied language, but another language, through metaprograms • Lack of a formal encoding • Lack of a general approach • Lack of a metaprogramming notation
Conclusion • Computing today has to face two challenges, metaprogramming and the free availability of source code of software. • Practitioners of computing arts should free themselves from slogans like multimedia, object-oriented, design-pattern, virtual machine, intelligent network, etc, and should rather adopt a scientific attitude.
References: http://www.erlang.org http://www.tunes.org http://java.sun.com/products/ XML 1.0.http://www.w3.org/TR/ Simple Object Access Protocol (SOAP)http://www.w3.org/TR/