<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sramach5</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sramach5"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Sramach5"/>
	<updated>2026-05-10T18:17:41Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=54325</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=54325"/>
		<updated>2011-10-30T01:54:12Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Additional Reading */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Reflection_%28computer_programming%29 Reflection ]is a relatively common [http://en.wikipedia.org/wiki/Computer_programming computer programming] concept where in the program has the inherent ability to examine itself at run time. Based on its observations the program can modify it's behavior for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith&amp;lt;ref&amp;gt;[http://hdl.handle.net/1721.1/15961 Brian Cantwell Smith, Procedural Reflection in Programming Languages, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, PhD Thesis, 1982.]&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;[http://publications.csail.mit.edu/lcs/specpub.php?id=840 Brian C. Smith. Reflection and semantics in a procedural language. Technical Report MIT-LCS-TR-272, Massachusetts Institute of Technology, Cambridge, Mass., January 1982.]&amp;lt;/ref&amp;gt; in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Superclass_%28computer_science%29#Subclasses_and_superclasses Super classes] of any class&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Method_(computer_programming) Methods]&lt;br /&gt;
* class fields&lt;br /&gt;
* [http://download.oracle.com/javase/tutorial/java/concepts/interface.html Interfaces]&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as [http://en.wikipedia.org/wiki/Type_introspection introspection] (This involves the action of observing the class) and intercession (this involves the operation of modifying the behavior of the class). These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we can inspect all the methods available to the instance 'w'.&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
cls.getName() gives the complete class name which is printed out as the output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$reflector = new ReflectionClass(&amp;quot;SimpleXMLElement&amp;quot;); &lt;br /&gt;
echo $reflector;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of this example is the complete class map of the class SimpleXMLElement.&lt;br /&gt;
&lt;br /&gt;
==Dynamic binding : Making reflection possible==&lt;br /&gt;
&lt;br /&gt;
Ruby implements  [http://en.wikipedia.org/wiki/Dynamic_dispatch dynamic binding] of objects. Dynamic binding plays a very important role in [http://en.wikipedia.org/wiki/Metaprogramming meta-programming].&lt;br /&gt;
&lt;br /&gt;
In languages like C,C++; a simple assignment &amp;quot;a = b&amp;quot;, would require 'a' and 'b' to be of the same type. The assignment is interpreted as copying b into a and is implemented by copying the contents of b into the space occupied by a. Thus if 'a' had been declared as an object whose memory size is less than b's object, then object slicing takes place i.e. only that part of 'b' which fits into a's memory would be copied. This behavior might lead to unintended consequences.&lt;br /&gt;
&lt;br /&gt;
[[File:Slicing.gif]]&lt;br /&gt;
&lt;br /&gt;
But dynamic binding in Ruby ensures that the type of object stored in a variable is determined at run time and not at compile time. Thus the assignment &amp;quot;a = b&amp;quot; is interpreted as binding 'a' to the same object that 'b' is bound to. It is implemented by copying the reference stored in b into the (pointer-sized) memory cell of 'a'. Thus 'a' and 'b' point to the same object after the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Before_binding.png]]        [[File:After_binding.png]]&lt;br /&gt;
&lt;br /&gt;
==Symbols and their usage in reflection techniques==&lt;br /&gt;
&lt;br /&gt;
===Basics===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Symbol_%28programming%29 Symbols] are objects used to represent names and strings inside a Ruby [http://en.wikipedia.org/wiki/Interpreter_%28computing%29 interpreter]. They are immutable and remain unique i.e. every instance of a particular symbol is the same symbol.&lt;br /&gt;
&lt;br /&gt;
===Usage in reflection techniques===&lt;br /&gt;
Symbols are widely used in reflection to invoke methods dynamically. Reflection methods like 'respond_to', 'send' make use of symbols as a reference to other methods. Strings can also be used in place of symbols. However symbols are more efficient compared to strings in terms of memory and performance.&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
====Passing method by reference using a symbol====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Float&lt;br /&gt;
  def poly&lt;br /&gt;
    self*self*self + 2*self*self + 3*self + 4&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And we can pass poly to an integration routine:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
area = integrate(:poly, 0, 10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Symbols in reflection====&lt;br /&gt;
[http://ruby-doc.org/core-1.9.2/Object.html#method-i-send Send] method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
irb(main):015:0&amp;gt; to = [:to_s , :to_f]&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
irb(main):016:0&amp;gt; to.each{|method| puts &amp;quot;#{method} =&amp;gt; #{5.send method}&amp;quot;}&lt;br /&gt;
to_s =&amp;gt; 5&lt;br /&gt;
to_f =&amp;gt; 5.0&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://ruby-doc.org/core-1.9.2/Object.html#method-i-respond_to-3F respond_to] method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
5.respond_to? :slice #=&amp;gt; false&lt;br /&gt;
5.respond_to? :to_f #=&amp;gt; true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
obj = Object.new&lt;br /&gt;
if obj.respond_to?(:program)&lt;br /&gt;
  obj.program&lt;br /&gt;
else&lt;br /&gt;
  puts &amp;quot;Sorry, the object doesn't understand the 'program' message.&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==method_missing==&lt;br /&gt;
&lt;br /&gt;
Whenever a call to a method is made on an object , Ruby does a method look up. If the method is not found, Ruby calls a method named '[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_object.html#Object.method_missing method_missing]'. Ruby knows the existence of the 'method_missing' as all objects are instances of 'BasicObject' which includes 'method_missing'. The default behavior of BasicObject#method_missing is to respond by raising a [http://www.ruby-doc.org/core-1.9.2/NoMethodError.html NoMethodError].&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overriding Overriding] 'method_missing' allows users to call methods that don't really exist. The example below illustrates overriding of 'method_missing' to the programmer's advantage. Ruby passes as parameters the name of the method called and the arguments passed to it.&lt;br /&gt;
&lt;br /&gt;
'''Example1'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Cat&lt;br /&gt;
  def mew&lt;br /&gt;
    puts &amp;quot;Meow&amp;quot;&lt;br /&gt;
  end  &lt;br /&gt;
  def method_missing(meth, *args)&lt;br /&gt;
    puts &amp;quot;Sorry, I do not #{meth}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
c = Cat.new&lt;br /&gt;
c.mew&lt;br /&gt;
&amp;gt;&amp;gt;Meow&lt;br /&gt;
c.bark&lt;br /&gt;
&amp;gt;&amp;gt; Sorry, I do not bark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above example, as the method 'bark' does not exist, method_missing is called with the meth (method name as a symbol) :bark. Hence the result &amp;quot; Sorry, I do not bark &amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''Example2'''&lt;br /&gt;
Using method_missing to convert Roman numerals &amp;lt;ref&amp;gt;http://www.rubyquiz.com/quiz22.html&amp;lt;/ref&amp;gt; to integers&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Roman &lt;br /&gt;
&lt;br /&gt;
  DIGITS = {&lt;br /&gt;
    'I' =&amp;gt; 1,&lt;br /&gt;
    'V' =&amp;gt; 5,&lt;br /&gt;
    'X' =&amp;gt; 10,&lt;br /&gt;
    'L' =&amp;gt; 50,&lt;br /&gt;
    'C' =&amp;gt; 100,&lt;br /&gt;
    'D' =&amp;gt; 500,&lt;br /&gt;
    'M' =&amp;gt; 1000,&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def roman_to_integer(roman_string)&lt;br /&gt;
    last = nil&lt;br /&gt;
    roman_string.to_s.upcase.split(//).reverse.inject(0) do |memo, digit|&lt;br /&gt;
      if digit_value = DIGITS[digit]&lt;br /&gt;
        if last &amp;amp;&amp;amp; last &amp;gt; digit_value&lt;br /&gt;
          memo -= digit_value&lt;br /&gt;
        else&lt;br /&gt;
          memo += digit_value&lt;br /&gt;
        end&lt;br /&gt;
        last = digit_value&lt;br /&gt;
      end&lt;br /&gt;
      memo&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method)        &lt;br /&gt;
    str = method.id2name &lt;br /&gt;
    roman_to_integer(str)      &lt;br /&gt;
  end   &lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Evaluating Roman.xix calls the xix method of module Roman. Roman has no xix method, so 	method_missing is invoked with :xix as the argument.The id2name method of class Symbol is invoked on xix returning &amp;quot;xix&amp;quot;. The &amp;quot;xix&amp;quot; is then parsed according to the rules for evaluating Roman numerals, and evaluates to 19.&lt;br /&gt;
&lt;br /&gt;
''' Example 3 '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Performer&lt;br /&gt;
  def method_missing(name, *args)&lt;br /&gt;
    &amp;quot;The duck will #{name}: #{args[0]}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
duck = Performer.new&lt;br /&gt;
duck.sing(&amp;quot;Quacking in the Rain&amp;quot;) # =&amp;gt; &amp;quot;The duck will sing: Quacking in the Rain&amp;quot;&lt;br /&gt;
duck.dance(&amp;quot;Swan Lake&amp;quot;) # =&amp;gt; &amp;quot;The duck will dance: Swan Lake&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of reflection==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
* Correctness : Reflection improves the robustness and the correctness of a program  especially in dynamically typed languages as runtime checks can be added to check the availability of the methods or classes.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
This article makes an attempt to explain the concept of Reflection in Object Oriented Programming. The article mentions the different approaches to reflection in Ruby and other languages.It mentions the usage of Reflections and the advantages and disadvantages of using Reflection. A follow up to this article would be to study the concept of [http://en.wikipedia.org/wiki/Metaprogramming Metaprogramming].&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Reflection_(computer_programming) Reflection]&lt;br /&gt;
*[http://www.cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
*[http://tutorials.jenkov.com/java-reflection/classes.html Java Reflection]&lt;br /&gt;
*[http://www.slideshare.net/CiaranMcHale/java-reflection-explained-simply Java reflection basics]&lt;br /&gt;
*[http://www2.parc.com/csl/groups/sda/projects/reflection96/docs/malenfant/ref96/ref96.html A Tutorial on Behavioral Reflection and its Implementation]&lt;br /&gt;
*[http://www.quora.com/Computer-Programming/How-is-reflection-useful Uses of reflection]&lt;br /&gt;
*[http://download.oracle.com/javase/tutorial/reflect/index.html Java reflection official website]&lt;br /&gt;
*[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Ruby Documentation]&lt;br /&gt;
*[http://www.slideshare.net/MarcusDenker/behavioral-reflection Behavioral reflection]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=54324</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=54324"/>
		<updated>2011-10-30T01:53:40Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Types of reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Reflection_%28computer_programming%29 Reflection ]is a relatively common [http://en.wikipedia.org/wiki/Computer_programming computer programming] concept where in the program has the inherent ability to examine itself at run time. Based on its observations the program can modify it's behavior for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith&amp;lt;ref&amp;gt;[http://hdl.handle.net/1721.1/15961 Brian Cantwell Smith, Procedural Reflection in Programming Languages, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, PhD Thesis, 1982.]&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;[http://publications.csail.mit.edu/lcs/specpub.php?id=840 Brian C. Smith. Reflection and semantics in a procedural language. Technical Report MIT-LCS-TR-272, Massachusetts Institute of Technology, Cambridge, Mass., January 1982.]&amp;lt;/ref&amp;gt; in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Superclass_%28computer_science%29#Subclasses_and_superclasses Super classes] of any class&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Method_(computer_programming) Methods]&lt;br /&gt;
* class fields&lt;br /&gt;
* [http://download.oracle.com/javase/tutorial/java/concepts/interface.html Interfaces]&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as [http://en.wikipedia.org/wiki/Type_introspection introspection] (This involves the action of observing the class) and intercession (this involves the operation of modifying the behavior of the class). These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we can inspect all the methods available to the instance 'w'.&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
cls.getName() gives the complete class name which is printed out as the output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$reflector = new ReflectionClass(&amp;quot;SimpleXMLElement&amp;quot;); &lt;br /&gt;
echo $reflector;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of this example is the complete class map of the class SimpleXMLElement.&lt;br /&gt;
&lt;br /&gt;
==Dynamic binding : Making reflection possible==&lt;br /&gt;
&lt;br /&gt;
Ruby implements  [http://en.wikipedia.org/wiki/Dynamic_dispatch dynamic binding] of objects. Dynamic binding plays a very important role in [http://en.wikipedia.org/wiki/Metaprogramming meta-programming].&lt;br /&gt;
&lt;br /&gt;
In languages like C,C++; a simple assignment &amp;quot;a = b&amp;quot;, would require 'a' and 'b' to be of the same type. The assignment is interpreted as copying b into a and is implemented by copying the contents of b into the space occupied by a. Thus if 'a' had been declared as an object whose memory size is less than b's object, then object slicing takes place i.e. only that part of 'b' which fits into a's memory would be copied. This behavior might lead to unintended consequences.&lt;br /&gt;
&lt;br /&gt;
[[File:Slicing.gif]]&lt;br /&gt;
&lt;br /&gt;
But dynamic binding in Ruby ensures that the type of object stored in a variable is determined at run time and not at compile time. Thus the assignment &amp;quot;a = b&amp;quot; is interpreted as binding 'a' to the same object that 'b' is bound to. It is implemented by copying the reference stored in b into the (pointer-sized) memory cell of 'a'. Thus 'a' and 'b' point to the same object after the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Before_binding.png]]        [[File:After_binding.png]]&lt;br /&gt;
&lt;br /&gt;
==Symbols and their usage in reflection techniques==&lt;br /&gt;
&lt;br /&gt;
===Basics===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Symbol_%28programming%29 Symbols] are objects used to represent names and strings inside a Ruby [http://en.wikipedia.org/wiki/Interpreter_%28computing%29 interpreter]. They are immutable and remain unique i.e. every instance of a particular symbol is the same symbol.&lt;br /&gt;
&lt;br /&gt;
===Usage in reflection techniques===&lt;br /&gt;
Symbols are widely used in reflection to invoke methods dynamically. Reflection methods like 'respond_to', 'send' make use of symbols as a reference to other methods. Strings can also be used in place of symbols. However symbols are more efficient compared to strings in terms of memory and performance.&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
====Passing method by reference using a symbol====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Float&lt;br /&gt;
  def poly&lt;br /&gt;
    self*self*self + 2*self*self + 3*self + 4&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And we can pass poly to an integration routine:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
area = integrate(:poly, 0, 10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Symbols in reflection====&lt;br /&gt;
[http://ruby-doc.org/core-1.9.2/Object.html#method-i-send Send] method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
irb(main):015:0&amp;gt; to = [:to_s , :to_f]&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
irb(main):016:0&amp;gt; to.each{|method| puts &amp;quot;#{method} =&amp;gt; #{5.send method}&amp;quot;}&lt;br /&gt;
to_s =&amp;gt; 5&lt;br /&gt;
to_f =&amp;gt; 5.0&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://ruby-doc.org/core-1.9.2/Object.html#method-i-respond_to-3F respond_to] method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
5.respond_to? :slice #=&amp;gt; false&lt;br /&gt;
5.respond_to? :to_f #=&amp;gt; true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
obj = Object.new&lt;br /&gt;
if obj.respond_to?(:program)&lt;br /&gt;
  obj.program&lt;br /&gt;
else&lt;br /&gt;
  puts &amp;quot;Sorry, the object doesn't understand the 'program' message.&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==method_missing==&lt;br /&gt;
&lt;br /&gt;
Whenever a call to a method is made on an object , Ruby does a method look up. If the method is not found, Ruby calls a method named '[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_object.html#Object.method_missing method_missing]'. Ruby knows the existence of the 'method_missing' as all objects are instances of 'BasicObject' which includes 'method_missing'. The default behavior of BasicObject#method_missing is to respond by raising a [http://www.ruby-doc.org/core-1.9.2/NoMethodError.html NoMethodError].&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overriding Overriding] 'method_missing' allows users to call methods that don't really exist. The example below illustrates overriding of 'method_missing' to the programmer's advantage. Ruby passes as parameters the name of the method called and the arguments passed to it.&lt;br /&gt;
&lt;br /&gt;
'''Example1'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Cat&lt;br /&gt;
  def mew&lt;br /&gt;
    puts &amp;quot;Meow&amp;quot;&lt;br /&gt;
  end  &lt;br /&gt;
  def method_missing(meth, *args)&lt;br /&gt;
    puts &amp;quot;Sorry, I do not #{meth}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
c = Cat.new&lt;br /&gt;
c.mew&lt;br /&gt;
&amp;gt;&amp;gt;Meow&lt;br /&gt;
c.bark&lt;br /&gt;
&amp;gt;&amp;gt; Sorry, I do not bark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above example, as the method 'bark' does not exist, method_missing is called with the meth (method name as a symbol) :bark. Hence the result &amp;quot; Sorry, I do not bark &amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''Example2'''&lt;br /&gt;
Using method_missing to convert Roman numerals &amp;lt;ref&amp;gt;http://www.rubyquiz.com/quiz22.html&amp;lt;/ref&amp;gt; to integers&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Roman &lt;br /&gt;
&lt;br /&gt;
  DIGITS = {&lt;br /&gt;
    'I' =&amp;gt; 1,&lt;br /&gt;
    'V' =&amp;gt; 5,&lt;br /&gt;
    'X' =&amp;gt; 10,&lt;br /&gt;
    'L' =&amp;gt; 50,&lt;br /&gt;
    'C' =&amp;gt; 100,&lt;br /&gt;
    'D' =&amp;gt; 500,&lt;br /&gt;
    'M' =&amp;gt; 1000,&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def roman_to_integer(roman_string)&lt;br /&gt;
    last = nil&lt;br /&gt;
    roman_string.to_s.upcase.split(//).reverse.inject(0) do |memo, digit|&lt;br /&gt;
      if digit_value = DIGITS[digit]&lt;br /&gt;
        if last &amp;amp;&amp;amp; last &amp;gt; digit_value&lt;br /&gt;
          memo -= digit_value&lt;br /&gt;
        else&lt;br /&gt;
          memo += digit_value&lt;br /&gt;
        end&lt;br /&gt;
        last = digit_value&lt;br /&gt;
      end&lt;br /&gt;
      memo&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method)        &lt;br /&gt;
    str = method.id2name &lt;br /&gt;
    roman_to_integer(str)      &lt;br /&gt;
  end   &lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Evaluating Roman.xix calls the xix method of module Roman. Roman has no xix method, so 	method_missing is invoked with :xix as the argument.The id2name method of class Symbol is invoked on xix returning &amp;quot;xix&amp;quot;. The &amp;quot;xix&amp;quot; is then parsed according to the rules for evaluating Roman numerals, and evaluates to 19.&lt;br /&gt;
&lt;br /&gt;
''' Example 3 '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Performer&lt;br /&gt;
  def method_missing(name, *args)&lt;br /&gt;
    &amp;quot;The duck will #{name}: #{args[0]}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
duck = Performer.new&lt;br /&gt;
duck.sing(&amp;quot;Quacking in the Rain&amp;quot;) # =&amp;gt; &amp;quot;The duck will sing: Quacking in the Rain&amp;quot;&lt;br /&gt;
duck.dance(&amp;quot;Swan Lake&amp;quot;) # =&amp;gt; &amp;quot;The duck will dance: Swan Lake&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of reflection==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
* Correctness : Reflection improves the robustness and the correctness of a program  especially in dynamically typed languages as runtime checks can be added to check the availability of the methods or classes.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
This article makes an attempt to explain the concept of Reflection in Object Oriented Programming. The article mentions the different approaches to reflection in Ruby and other languages.It mentions the usage of Reflections and the advantages and disadvantages of using Reflection. A follow up to this article would be to study the concept of [http://en.wikipedia.org/wiki/Metaprogramming Metaprogramming].&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Reflection_(computer_programming) Reflection]&lt;br /&gt;
*[http://www.cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
*[http://tutorials.jenkov.com/java-reflection/classes.html Java Reflection]&lt;br /&gt;
*[http://www.slideshare.net/CiaranMcHale/java-reflection-explained-simply Java reflection basics]&lt;br /&gt;
*[http://www2.parc.com/csl/groups/sda/projects/reflection96/docs/malenfant/ref96/ref96.html A Tutorial on Behavioral Reflection and its Implementation]&lt;br /&gt;
*[http://www.quora.com/Computer-Programming/How-is-reflection-useful Uses of reflection]&lt;br /&gt;
*[http://download.oracle.com/javase/tutorial/reflect/index.html Java reflection official website]&lt;br /&gt;
*[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Ruby Documentation]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=54323</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=54323"/>
		<updated>2011-10-30T01:51:07Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Types of reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Reflection_%28computer_programming%29 Reflection ]is a relatively common [http://en.wikipedia.org/wiki/Computer_programming computer programming] concept where in the program has the inherent ability to examine itself at run time. Based on its observations the program can modify it's behavior for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith&amp;lt;ref&amp;gt;[http://hdl.handle.net/1721.1/15961 Brian Cantwell Smith, Procedural Reflection in Programming Languages, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, PhD Thesis, 1982.]&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;[http://publications.csail.mit.edu/lcs/specpub.php?id=840 Brian C. Smith. Reflection and semantics in a procedural language. Technical Report MIT-LCS-TR-272, Massachusetts Institute of Technology, Cambridge, Mass., January 1982.]&amp;lt;/ref&amp;gt; in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Superclass_%28computer_science%29#Subclasses_and_superclasses Super classes] of any class&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Method_(computer_programming) Methods]&lt;br /&gt;
* class fields&lt;br /&gt;
* [http://download.oracle.com/javase/tutorial/java/concepts/interface.html Interfaces]&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* [http://www.slideshare.net/MarcusDenker/behavioral-reflection Behavioral Reflection]: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as [http://en.wikipedia.org/wiki/Type_introspection introspection] (This involves the action of observing the class) and intercession (this involves the operation of modifying the behavior of the class). These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we can inspect all the methods available to the instance 'w'.&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
cls.getName() gives the complete class name which is printed out as the output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$reflector = new ReflectionClass(&amp;quot;SimpleXMLElement&amp;quot;); &lt;br /&gt;
echo $reflector;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of this example is the complete class map of the class SimpleXMLElement.&lt;br /&gt;
&lt;br /&gt;
==Dynamic binding : Making reflection possible==&lt;br /&gt;
&lt;br /&gt;
Ruby implements  [http://en.wikipedia.org/wiki/Dynamic_dispatch dynamic binding] of objects. Dynamic binding plays a very important role in [http://en.wikipedia.org/wiki/Metaprogramming meta-programming].&lt;br /&gt;
&lt;br /&gt;
In languages like C,C++; a simple assignment &amp;quot;a = b&amp;quot;, would require 'a' and 'b' to be of the same type. The assignment is interpreted as copying b into a and is implemented by copying the contents of b into the space occupied by a. Thus if 'a' had been declared as an object whose memory size is less than b's object, then object slicing takes place i.e. only that part of 'b' which fits into a's memory would be copied. This behavior might lead to unintended consequences.&lt;br /&gt;
&lt;br /&gt;
[[File:Slicing.gif]]&lt;br /&gt;
&lt;br /&gt;
But dynamic binding in Ruby ensures that the type of object stored in a variable is determined at run time and not at compile time. Thus the assignment &amp;quot;a = b&amp;quot; is interpreted as binding 'a' to the same object that 'b' is bound to. It is implemented by copying the reference stored in b into the (pointer-sized) memory cell of 'a'. Thus 'a' and 'b' point to the same object after the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Before_binding.png]]        [[File:After_binding.png]]&lt;br /&gt;
&lt;br /&gt;
==Symbols and their usage in reflection techniques==&lt;br /&gt;
&lt;br /&gt;
===Basics===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Symbol_%28programming%29 Symbols] are objects used to represent names and strings inside a Ruby [http://en.wikipedia.org/wiki/Interpreter_%28computing%29 interpreter]. They are immutable and remain unique i.e. every instance of a particular symbol is the same symbol.&lt;br /&gt;
&lt;br /&gt;
===Usage in reflection techniques===&lt;br /&gt;
Symbols are widely used in reflection to invoke methods dynamically. Reflection methods like 'respond_to', 'send' make use of symbols as a reference to other methods. Strings can also be used in place of symbols. However symbols are more efficient compared to strings in terms of memory and performance.&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
====Passing method by reference using a symbol====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Float&lt;br /&gt;
  def poly&lt;br /&gt;
    self*self*self + 2*self*self + 3*self + 4&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And we can pass poly to an integration routine:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
area = integrate(:poly, 0, 10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Symbols in reflection====&lt;br /&gt;
[http://ruby-doc.org/core-1.9.2/Object.html#method-i-send Send] method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
irb(main):015:0&amp;gt; to = [:to_s , :to_f]&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
irb(main):016:0&amp;gt; to.each{|method| puts &amp;quot;#{method} =&amp;gt; #{5.send method}&amp;quot;}&lt;br /&gt;
to_s =&amp;gt; 5&lt;br /&gt;
to_f =&amp;gt; 5.0&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://ruby-doc.org/core-1.9.2/Object.html#method-i-respond_to-3F respond_to] method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
5.respond_to? :slice #=&amp;gt; false&lt;br /&gt;
5.respond_to? :to_f #=&amp;gt; true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
obj = Object.new&lt;br /&gt;
if obj.respond_to?(:program)&lt;br /&gt;
  obj.program&lt;br /&gt;
else&lt;br /&gt;
  puts &amp;quot;Sorry, the object doesn't understand the 'program' message.&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==method_missing==&lt;br /&gt;
&lt;br /&gt;
Whenever a call to a method is made on an object , Ruby does a method look up. If the method is not found, Ruby calls a method named '[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_object.html#Object.method_missing method_missing]'. Ruby knows the existence of the 'method_missing' as all objects are instances of 'BasicObject' which includes 'method_missing'. The default behavior of BasicObject#method_missing is to respond by raising a [http://www.ruby-doc.org/core-1.9.2/NoMethodError.html NoMethodError].&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overriding Overriding] 'method_missing' allows users to call methods that don't really exist. The example below illustrates overriding of 'method_missing' to the programmer's advantage. Ruby passes as parameters the name of the method called and the arguments passed to it.&lt;br /&gt;
&lt;br /&gt;
'''Example1'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Cat&lt;br /&gt;
  def mew&lt;br /&gt;
    puts &amp;quot;Meow&amp;quot;&lt;br /&gt;
  end  &lt;br /&gt;
  def method_missing(meth, *args)&lt;br /&gt;
    puts &amp;quot;Sorry, I do not #{meth}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
c = Cat.new&lt;br /&gt;
c.mew&lt;br /&gt;
&amp;gt;&amp;gt;Meow&lt;br /&gt;
c.bark&lt;br /&gt;
&amp;gt;&amp;gt; Sorry, I do not bark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above example, as the method 'bark' does not exist, method_missing is called with the meth (method name as a symbol) :bark. Hence the result &amp;quot; Sorry, I do not bark &amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''Example2'''&lt;br /&gt;
Using method_missing to convert Roman numerals &amp;lt;ref&amp;gt;http://www.rubyquiz.com/quiz22.html&amp;lt;/ref&amp;gt; to integers&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Roman &lt;br /&gt;
&lt;br /&gt;
  DIGITS = {&lt;br /&gt;
    'I' =&amp;gt; 1,&lt;br /&gt;
    'V' =&amp;gt; 5,&lt;br /&gt;
    'X' =&amp;gt; 10,&lt;br /&gt;
    'L' =&amp;gt; 50,&lt;br /&gt;
    'C' =&amp;gt; 100,&lt;br /&gt;
    'D' =&amp;gt; 500,&lt;br /&gt;
    'M' =&amp;gt; 1000,&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def roman_to_integer(roman_string)&lt;br /&gt;
    last = nil&lt;br /&gt;
    roman_string.to_s.upcase.split(//).reverse.inject(0) do |memo, digit|&lt;br /&gt;
      if digit_value = DIGITS[digit]&lt;br /&gt;
        if last &amp;amp;&amp;amp; last &amp;gt; digit_value&lt;br /&gt;
          memo -= digit_value&lt;br /&gt;
        else&lt;br /&gt;
          memo += digit_value&lt;br /&gt;
        end&lt;br /&gt;
        last = digit_value&lt;br /&gt;
      end&lt;br /&gt;
      memo&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method)        &lt;br /&gt;
    str = method.id2name &lt;br /&gt;
    roman_to_integer(str)      &lt;br /&gt;
  end   &lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Evaluating Roman.xix calls the xix method of module Roman. Roman has no xix method, so 	method_missing is invoked with :xix as the argument.The id2name method of class Symbol is invoked on xix returning &amp;quot;xix&amp;quot;. The &amp;quot;xix&amp;quot; is then parsed according to the rules for evaluating Roman numerals, and evaluates to 19.&lt;br /&gt;
&lt;br /&gt;
''' Example 3 '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Performer&lt;br /&gt;
  def method_missing(name, *args)&lt;br /&gt;
    &amp;quot;The duck will #{name}: #{args[0]}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
duck = Performer.new&lt;br /&gt;
duck.sing(&amp;quot;Quacking in the Rain&amp;quot;) # =&amp;gt; &amp;quot;The duck will sing: Quacking in the Rain&amp;quot;&lt;br /&gt;
duck.dance(&amp;quot;Swan Lake&amp;quot;) # =&amp;gt; &amp;quot;The duck will dance: Swan Lake&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of reflection==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
* Correctness : Reflection improves the robustness and the correctness of a program  especially in dynamically typed languages as runtime checks can be added to check the availability of the methods or classes.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
This article makes an attempt to explain the concept of Reflection in Object Oriented Programming. The article mentions the different approaches to reflection in Ruby and other languages.It mentions the usage of Reflections and the advantages and disadvantages of using Reflection. A follow up to this article would be to study the concept of [http://en.wikipedia.org/wiki/Metaprogramming Metaprogramming].&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Reflection_(computer_programming) Reflection]&lt;br /&gt;
*[http://www.cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
*[http://tutorials.jenkov.com/java-reflection/classes.html Java Reflection]&lt;br /&gt;
*[http://www.slideshare.net/CiaranMcHale/java-reflection-explained-simply Java reflection basics]&lt;br /&gt;
*[http://www2.parc.com/csl/groups/sda/projects/reflection96/docs/malenfant/ref96/ref96.html A Tutorial on Behavioral Reflection and its Implementation]&lt;br /&gt;
*[http://www.quora.com/Computer-Programming/How-is-reflection-useful Uses of reflection]&lt;br /&gt;
*[http://download.oracle.com/javase/tutorial/reflect/index.html Java reflection official website]&lt;br /&gt;
*[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Ruby Documentation]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=54322</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=54322"/>
		<updated>2011-10-30T01:47:29Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Reflection_%28computer_programming%29 Reflection ]is a relatively common [http://en.wikipedia.org/wiki/Computer_programming computer programming] concept where in the program has the inherent ability to examine itself at run time. Based on its observations the program can modify it's behavior for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith&amp;lt;ref&amp;gt;[http://hdl.handle.net/1721.1/15961 Brian Cantwell Smith, Procedural Reflection in Programming Languages, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, PhD Thesis, 1982.]&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;[http://publications.csail.mit.edu/lcs/specpub.php?id=840 Brian C. Smith. Reflection and semantics in a procedural language. Technical Report MIT-LCS-TR-272, Massachusetts Institute of Technology, Cambridge, Mass., January 1982.]&amp;lt;/ref&amp;gt; in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Superclass_%28computer_science%29#Subclasses_and_superclasses Super classes] of any class&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Method_(computer_programming) Methods]&lt;br /&gt;
* class fields&lt;br /&gt;
* [http://download.oracle.com/javase/tutorial/java/concepts/interface.html Interfaces]&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as [http://en.wikipedia.org/wiki/Type_introspection introspection] (This involves the action of observing the class) and intercession (this involves the operation of modifying the behavior of the class). These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we can inspect all the methods available to the instance 'w'.&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
cls.getName() gives the complete class name which is printed out as the output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$reflector = new ReflectionClass(&amp;quot;SimpleXMLElement&amp;quot;); &lt;br /&gt;
echo $reflector;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of this example is the complete class map of the class SimpleXMLElement.&lt;br /&gt;
&lt;br /&gt;
==Dynamic binding : Making reflection possible==&lt;br /&gt;
&lt;br /&gt;
Ruby implements  [http://en.wikipedia.org/wiki/Dynamic_dispatch dynamic binding] of objects. Dynamic binding plays a very important role in [http://en.wikipedia.org/wiki/Metaprogramming meta-programming].&lt;br /&gt;
&lt;br /&gt;
In languages like C,C++; a simple assignment &amp;quot;a = b&amp;quot;, would require 'a' and 'b' to be of the same type. The assignment is interpreted as copying b into a and is implemented by copying the contents of b into the space occupied by a. Thus if 'a' had been declared as an object whose memory size is less than b's object, then object slicing takes place i.e. only that part of 'b' which fits into a's memory would be copied. This behavior might lead to unintended consequences.&lt;br /&gt;
&lt;br /&gt;
[[File:Slicing.gif]]&lt;br /&gt;
&lt;br /&gt;
But dynamic binding in Ruby ensures that the type of object stored in a variable is determined at run time and not at compile time. Thus the assignment &amp;quot;a = b&amp;quot; is interpreted as binding 'a' to the same object that 'b' is bound to. It is implemented by copying the reference stored in b into the (pointer-sized) memory cell of 'a'. Thus 'a' and 'b' point to the same object after the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Before_binding.png]]        [[File:After_binding.png]]&lt;br /&gt;
&lt;br /&gt;
==Symbols and their usage in reflection techniques==&lt;br /&gt;
&lt;br /&gt;
===Basics===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Symbol_%28programming%29 Symbols] are objects used to represent names and strings inside a Ruby [http://en.wikipedia.org/wiki/Interpreter_%28computing%29 interpreter]. They are immutable and remain unique i.e. every instance of a particular symbol is the same symbol.&lt;br /&gt;
&lt;br /&gt;
===Usage in reflection techniques===&lt;br /&gt;
Symbols are widely used in reflection to invoke methods dynamically. Reflection methods like 'respond_to', 'send' make use of symbols as a reference to other methods. Strings can also be used in place of symbols. However symbols are more efficient compared to strings in terms of memory and performance.&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
====Passing method by reference using a symbol====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Float&lt;br /&gt;
  def poly&lt;br /&gt;
    self*self*self + 2*self*self + 3*self + 4&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And we can pass poly to an integration routine:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
area = integrate(:poly, 0, 10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Symbols in reflection====&lt;br /&gt;
[http://ruby-doc.org/core-1.9.2/Object.html#method-i-send Send] method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
irb(main):015:0&amp;gt; to = [:to_s , :to_f]&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
irb(main):016:0&amp;gt; to.each{|method| puts &amp;quot;#{method} =&amp;gt; #{5.send method}&amp;quot;}&lt;br /&gt;
to_s =&amp;gt; 5&lt;br /&gt;
to_f =&amp;gt; 5.0&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://ruby-doc.org/core-1.9.2/Object.html#method-i-respond_to-3F respond_to] method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
5.respond_to? :slice #=&amp;gt; false&lt;br /&gt;
5.respond_to? :to_f #=&amp;gt; true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
obj = Object.new&lt;br /&gt;
if obj.respond_to?(:program)&lt;br /&gt;
  obj.program&lt;br /&gt;
else&lt;br /&gt;
  puts &amp;quot;Sorry, the object doesn't understand the 'program' message.&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==method_missing==&lt;br /&gt;
&lt;br /&gt;
Whenever a call to a method is made on an object , Ruby does a method look up. If the method is not found, Ruby calls a method named '[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_object.html#Object.method_missing method_missing]'. Ruby knows the existence of the 'method_missing' as all objects are instances of 'BasicObject' which includes 'method_missing'. The default behavior of BasicObject#method_missing is to respond by raising a [http://www.ruby-doc.org/core-1.9.2/NoMethodError.html NoMethodError].&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overriding Overriding] 'method_missing' allows users to call methods that don't really exist. The example below illustrates overriding of 'method_missing' to the programmer's advantage. Ruby passes as parameters the name of the method called and the arguments passed to it.&lt;br /&gt;
&lt;br /&gt;
'''Example1'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Cat&lt;br /&gt;
  def mew&lt;br /&gt;
    puts &amp;quot;Meow&amp;quot;&lt;br /&gt;
  end  &lt;br /&gt;
  def method_missing(meth, *args)&lt;br /&gt;
    puts &amp;quot;Sorry, I do not #{meth}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
c = Cat.new&lt;br /&gt;
c.mew&lt;br /&gt;
&amp;gt;&amp;gt;Meow&lt;br /&gt;
c.bark&lt;br /&gt;
&amp;gt;&amp;gt; Sorry, I do not bark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above example, as the method 'bark' does not exist, method_missing is called with the meth (method name as a symbol) :bark. Hence the result &amp;quot; Sorry, I do not bark &amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''Example2'''&lt;br /&gt;
Using method_missing to convert Roman numerals &amp;lt;ref&amp;gt;http://www.rubyquiz.com/quiz22.html&amp;lt;/ref&amp;gt; to integers&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Roman &lt;br /&gt;
&lt;br /&gt;
  DIGITS = {&lt;br /&gt;
    'I' =&amp;gt; 1,&lt;br /&gt;
    'V' =&amp;gt; 5,&lt;br /&gt;
    'X' =&amp;gt; 10,&lt;br /&gt;
    'L' =&amp;gt; 50,&lt;br /&gt;
    'C' =&amp;gt; 100,&lt;br /&gt;
    'D' =&amp;gt; 500,&lt;br /&gt;
    'M' =&amp;gt; 1000,&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def roman_to_integer(roman_string)&lt;br /&gt;
    last = nil&lt;br /&gt;
    roman_string.to_s.upcase.split(//).reverse.inject(0) do |memo, digit|&lt;br /&gt;
      if digit_value = DIGITS[digit]&lt;br /&gt;
        if last &amp;amp;&amp;amp; last &amp;gt; digit_value&lt;br /&gt;
          memo -= digit_value&lt;br /&gt;
        else&lt;br /&gt;
          memo += digit_value&lt;br /&gt;
        end&lt;br /&gt;
        last = digit_value&lt;br /&gt;
      end&lt;br /&gt;
      memo&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method)        &lt;br /&gt;
    str = method.id2name &lt;br /&gt;
    roman_to_integer(str)      &lt;br /&gt;
  end   &lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Evaluating Roman.xix calls the xix method of module Roman. Roman has no xix method, so 	method_missing is invoked with :xix as the argument.The id2name method of class Symbol is invoked on xix returning &amp;quot;xix&amp;quot;. The &amp;quot;xix&amp;quot; is then parsed according to the rules for evaluating Roman numerals, and evaluates to 19.&lt;br /&gt;
&lt;br /&gt;
''' Example 3 '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Performer&lt;br /&gt;
  def method_missing(name, *args)&lt;br /&gt;
    &amp;quot;The duck will #{name}: #{args[0]}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
duck = Performer.new&lt;br /&gt;
duck.sing(&amp;quot;Quacking in the Rain&amp;quot;) # =&amp;gt; &amp;quot;The duck will sing: Quacking in the Rain&amp;quot;&lt;br /&gt;
duck.dance(&amp;quot;Swan Lake&amp;quot;) # =&amp;gt; &amp;quot;The duck will dance: Swan Lake&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of reflection==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
* Correctness : Reflection improves the robustness and the correctness of a program  especially in dynamically typed languages as runtime checks can be added to check the availability of the methods or classes.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
This article makes an attempt to explain the concept of Reflection in Object Oriented Programming. The article mentions the different approaches to reflection in Ruby and other languages.It mentions the usage of Reflections and the advantages and disadvantages of using Reflection. A follow up to this article would be to study the concept of [http://en.wikipedia.org/wiki/Metaprogramming Metaprogramming].&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Reflection_(computer_programming) Reflection]&lt;br /&gt;
*[http://www.cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
*[http://tutorials.jenkov.com/java-reflection/classes.html Java Reflection]&lt;br /&gt;
*[http://www.slideshare.net/CiaranMcHale/java-reflection-explained-simply Java reflection basics]&lt;br /&gt;
*[http://www2.parc.com/csl/groups/sda/projects/reflection96/docs/malenfant/ref96/ref96.html A Tutorial on Behavioral Reflection and its Implementation]&lt;br /&gt;
*[http://www.quora.com/Computer-Programming/How-is-reflection-useful Uses of reflection]&lt;br /&gt;
*[http://download.oracle.com/javase/tutorial/reflect/index.html Java reflection official website]&lt;br /&gt;
*[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Ruby Documentation]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=54321</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=54321"/>
		<updated>2011-10-30T01:44:22Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
[http://en.wikipedia.org/wiki/Reflection_%28computer_programming%29 Reflection ]is a relatively common [http://en.wikipedia.org/wiki/Computer_programming computer programming] concept where in the program has the inherent ability to examine itself at run time. Based on its observations the program can modify it's behavior for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith&amp;lt;ref&amp;gt;[http://hdl.handle.net/1721.1/15961 Brian Cantwell Smith, Procedural Reflection in Programming Languages, Department of Electrical Engineering and Computer Science, Massachusetts Institute of Technology, PhD Thesis, 1982.]&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;[http://publications.csail.mit.edu/lcs/specpub.php?id=840 Brian C. Smith. Reflection and semantics in a procedural language. Technical Report MIT-LCS-TR-272, Massachusetts Institute of Technology, Cambridge, Mass., January 1982.]&amp;lt;/ref&amp;gt; in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Superclass_%28computer_science%29#Subclasses_and_superclasses Super classes] of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* [http://download.oracle.com/javase/tutorial/java/concepts/interface.html Interfaces]&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as [http://en.wikipedia.org/wiki/Type_introspection introspection] (This involves the action of observing the class) and intercession (this involves the operation of modifying the behavior of the class). These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we can inspect all the methods available to the instance 'w'.&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
cls.getName() gives the complete class name which is printed out as the output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$reflector = new ReflectionClass(&amp;quot;SimpleXMLElement&amp;quot;); &lt;br /&gt;
echo $reflector;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of this example is the complete class map of the class SimpleXMLElement.&lt;br /&gt;
&lt;br /&gt;
==Dynamic binding : Making reflection possible==&lt;br /&gt;
&lt;br /&gt;
Ruby implements  [http://en.wikipedia.org/wiki/Dynamic_dispatch dynamic binding] of objects. Dynamic binding plays a very important role in [http://en.wikipedia.org/wiki/Metaprogramming meta-programming].&lt;br /&gt;
&lt;br /&gt;
In languages like C,C++; a simple assignment &amp;quot;a = b&amp;quot;, would require 'a' and 'b' to be of the same type. The assignment is interpreted as copying b into a and is implemented by copying the contents of b into the space occupied by a. Thus if 'a' had been declared as an object whose memory size is less than b's object, then object slicing takes place i.e. only that part of 'b' which fits into a's memory would be copied. This behavior might lead to unintended consequences.&lt;br /&gt;
&lt;br /&gt;
[[File:Slicing.gif]]&lt;br /&gt;
&lt;br /&gt;
But dynamic binding in Ruby ensures that the type of object stored in a variable is determined at run time and not at compile time. Thus the assignment &amp;quot;a = b&amp;quot; is interpreted as binding 'a' to the same object that 'b' is bound to. It is implemented by copying the reference stored in b into the (pointer-sized) memory cell of 'a'. Thus 'a' and 'b' point to the same object after the assignment.&lt;br /&gt;
&lt;br /&gt;
[[File:Before_binding.png]]        [[File:After_binding.png]]&lt;br /&gt;
&lt;br /&gt;
==Symbols and their usage in reflection techniques==&lt;br /&gt;
&lt;br /&gt;
===Basics===&lt;br /&gt;
[http://en.wikipedia.org/wiki/Symbol_%28programming%29 Symbols] are objects used to represent names and strings inside a Ruby [http://en.wikipedia.org/wiki/Interpreter_%28computing%29 interpreter]. They are immutable and remain unique i.e. every instance of a particular symbol is the same symbol.&lt;br /&gt;
&lt;br /&gt;
===Usage in reflection techniques===&lt;br /&gt;
Symbols are widely used in reflection to invoke methods dynamically. Reflection methods like 'respond_to', 'send' make use of symbols as a reference to other methods. Strings can also be used in place of symbols. However symbols are more efficient compared to strings in terms of memory and performance.&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
====Passing method by reference using a symbol====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Float&lt;br /&gt;
  def poly&lt;br /&gt;
    self*self*self + 2*self*self + 3*self + 4&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And we can pass poly to an integration routine:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
area = integrate(:poly, 0, 10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Symbols in reflection====&lt;br /&gt;
[http://ruby-doc.org/core-1.9.2/Object.html#method-i-send Send] method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
irb(main):015:0&amp;gt; to = [:to_s , :to_f]&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
irb(main):016:0&amp;gt; to.each{|method| puts &amp;quot;#{method} =&amp;gt; #{5.send method}&amp;quot;}&lt;br /&gt;
to_s =&amp;gt; 5&lt;br /&gt;
to_f =&amp;gt; 5.0&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[http://ruby-doc.org/core-1.9.2/Object.html#method-i-respond_to-3F respond_to] method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
5.respond_to? :slice #=&amp;gt; false&lt;br /&gt;
5.respond_to? :to_f #=&amp;gt; true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
obj = Object.new&lt;br /&gt;
if obj.respond_to?(:program)&lt;br /&gt;
  obj.program&lt;br /&gt;
else&lt;br /&gt;
  puts &amp;quot;Sorry, the object doesn't understand the 'program' message.&amp;quot;&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==method_missing==&lt;br /&gt;
&lt;br /&gt;
Whenever a call to a method is made on an object , Ruby does a method look up. If the method is not found, Ruby calls a method named '[http://ruby-doc.org/docs/ProgrammingRuby/html/ref_c_object.html#Object.method_missing method_missing]'. Ruby knows the existence of the 'method_missing' as all objects are instances of 'BasicObject' which includes 'method_missing'. The default behavior of BasicObject#method_missing is to respond by raising a [http://www.ruby-doc.org/core-1.9.2/NoMethodError.html NoMethodError].&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Method_overriding Overriding] 'method_missing' allows users to call methods that don't really exist. The example below illustrates overriding of 'method_missing' to the programmer's advantage. Ruby passes as parameters the name of the method called and the arguments passed to it.&lt;br /&gt;
&lt;br /&gt;
'''Example1'''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Cat&lt;br /&gt;
  def mew&lt;br /&gt;
    puts &amp;quot;Meow&amp;quot;&lt;br /&gt;
  end  &lt;br /&gt;
  def method_missing(meth, *args)&lt;br /&gt;
    puts &amp;quot;Sorry, I do not #{meth}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
c = Cat.new&lt;br /&gt;
c.mew&lt;br /&gt;
&amp;gt;&amp;gt;Meow&lt;br /&gt;
c.bark&lt;br /&gt;
&amp;gt;&amp;gt; Sorry, I do not bark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above example, as the method 'bark' does not exist, method_missing is called with the meth (method name as a symbol) :bark. Hence the result &amp;quot; Sorry, I do not bark &amp;quot;&lt;br /&gt;
&lt;br /&gt;
'''Example2'''&lt;br /&gt;
Using method_missing to convert Roman numerals &amp;lt;ref&amp;gt;http://www.rubyquiz.com/quiz22.html&amp;lt;/ref&amp;gt; to integers&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Roman &lt;br /&gt;
&lt;br /&gt;
  DIGITS = {&lt;br /&gt;
    'I' =&amp;gt; 1,&lt;br /&gt;
    'V' =&amp;gt; 5,&lt;br /&gt;
    'X' =&amp;gt; 10,&lt;br /&gt;
    'L' =&amp;gt; 50,&lt;br /&gt;
    'C' =&amp;gt; 100,&lt;br /&gt;
    'D' =&amp;gt; 500,&lt;br /&gt;
    'M' =&amp;gt; 1000,&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def roman_to_integer(roman_string)&lt;br /&gt;
    last = nil&lt;br /&gt;
    roman_string.to_s.upcase.split(//).reverse.inject(0) do |memo, digit|&lt;br /&gt;
      if digit_value = DIGITS[digit]&lt;br /&gt;
        if last &amp;amp;&amp;amp; last &amp;gt; digit_value&lt;br /&gt;
          memo -= digit_value&lt;br /&gt;
        else&lt;br /&gt;
          memo += digit_value&lt;br /&gt;
        end&lt;br /&gt;
        last = digit_value&lt;br /&gt;
      end&lt;br /&gt;
      memo&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method)        &lt;br /&gt;
    str = method.id2name &lt;br /&gt;
    roman_to_integer(str)      &lt;br /&gt;
  end   &lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Evaluating Roman.xix calls the xix method of module Roman. Roman has no xix method, so 	method_missing is invoked with :xix as the argument.The id2name method of class Symbol is invoked on xix returning &amp;quot;xix&amp;quot;. The &amp;quot;xix&amp;quot; is then parsed according to the rules for evaluating Roman numerals, and evaluates to 19.&lt;br /&gt;
&lt;br /&gt;
''' Example 3 '''&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Performer&lt;br /&gt;
  def method_missing(name, *args)&lt;br /&gt;
    &amp;quot;The duck will #{name}: #{args[0]}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
duck = Performer.new&lt;br /&gt;
duck.sing(&amp;quot;Quacking in the Rain&amp;quot;) # =&amp;gt; &amp;quot;The duck will sing: Quacking in the Rain&amp;quot;&lt;br /&gt;
duck.dance(&amp;quot;Swan Lake&amp;quot;) # =&amp;gt; &amp;quot;The duck will dance: Swan Lake&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of reflection==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
* Correctness : Reflection improves the robustness and the correctness of a program  especially in dynamically typed languages as runtime checks can be added to check the availability of the methods or classes.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Conclusion==&lt;br /&gt;
This article makes an attempt to explain the concept of Reflection in Object Oriented Programming. The article mentions the different approaches to reflection in Ruby and other languages.It mentions the usage of Reflections and the advantages and disadvantages of using Reflection. A follow up to this article would be to study the concept of [http://en.wikipedia.org/wiki/Metaprogramming Metaprogramming].&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Reflection_(computer_programming) Reflection]&lt;br /&gt;
*[http://www.cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
*[http://tutorials.jenkov.com/java-reflection/classes.html Java Reflection]&lt;br /&gt;
*[http://www.slideshare.net/CiaranMcHale/java-reflection-explained-simply Java reflection basics]&lt;br /&gt;
*[http://www2.parc.com/csl/groups/sda/projects/reflection96/docs/malenfant/ref96/ref96.html A Tutorial on Behavioral Reflection and its Implementation]&lt;br /&gt;
*[http://www.quora.com/Computer-Programming/How-is-reflection-useful Uses of reflection]&lt;br /&gt;
*[http://download.oracle.com/javase/tutorial/reflect/index.html Java reflection official website]&lt;br /&gt;
*[http://ruby-doc.org/docs/ProgrammingRuby/html/builtins.html Ruby Documentation]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53729</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53729"/>
		<updated>2011-10-21T01:43:56Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Additional Reading */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we can inspect all the methods available to the instance 'w'.&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
cls.getName() gives the complete class name which is printed out as the output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$reflector = new ReflectionClass(&amp;quot;SimpleXMLElement&amp;quot;); &lt;br /&gt;
echo $reflector;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of this example is the complete class map of the class SimpleXMLElement.&lt;br /&gt;
&lt;br /&gt;
==Dynamic binding : Making reflection possible==&lt;br /&gt;
&lt;br /&gt;
Ruby implements dynamic binding of objects. Dynamic binding plays a very important role in metaprogramming.&lt;br /&gt;
&lt;br /&gt;
In languages like C,C++; a simple assignment &amp;quot;a = b&amp;quot;, would require 'a' and 'b' to be of the same type. The assignment is interpreted as copying b into a and is implemented by copying the contents of b into the space occupied by a. Thus if 'a' had been declared as an object whose memory size is less than b's object, then object slicing takes place i.e. only that part of 'b' which fits into a's memory would be copied. This behavior might lead to unintended consequences.&lt;br /&gt;
&lt;br /&gt;
But dynamic binding in Ruby ensures that the type of object stored in a variable is determined at run time and not at compile time. Thus the assignment &amp;quot;a = b&amp;quot; is interpreted as binding 'a' to the same object that 'b' is bound to. It is implemented by copying the reference stored in b into the (pointer-sized) memory cell of 'a'. Thus 'a' and 'b' point to the same object after the assignment.&lt;br /&gt;
&lt;br /&gt;
==Symbols and their usage in reflection techniques==&lt;br /&gt;
&lt;br /&gt;
===Basics===&lt;br /&gt;
Symbols are objects used to represent names and strings inside a Ruby interpreter. They are immutable and remain unique i.e. every instance of a particular symbol is the same symbol.&lt;br /&gt;
&lt;br /&gt;
===Usage in reflection techniques===&lt;br /&gt;
Symbols are widely used in reflection to invoke methods dynamically. Reflection methods like 'respond_to', 'send' make use of symbols as a reference to other methods. Strings can also be used in place of symbols. However symbols are more efficient compared to strings in terms of memory and performance.&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
====Passing method by reference using a symbol====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Float&lt;br /&gt;
  def poly&lt;br /&gt;
    self*self*self + 2*self*self + 3*self + 4&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
And we can pass poly to an integration routine:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
area = integrate(:poly, 0, 10)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Symbols in reflection====&lt;br /&gt;
Send method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
irb(main):015:0&amp;gt; to = [:to_s , :to_f]&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
irb(main):016:0&amp;gt; to.each{|method| puts &amp;quot;#{method} =&amp;gt; #{5.send method}&amp;quot;}&lt;br /&gt;
to_s =&amp;gt; 5&lt;br /&gt;
to_f =&amp;gt; 5.0&lt;br /&gt;
=&amp;gt; [:to_s, :to_f]&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
respond_to method&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
5.respond_to? :slice #=&amp;gt; false&lt;br /&gt;
5.respond_to? :to_f #=&amp;gt; true&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==method_missing==&lt;br /&gt;
&lt;br /&gt;
Whenever a call to a method is made on an object , Ruby does a method look up. If the method is not found, Ruby calls a method named 'method_missing'. Ruby knows the existence of the 'method_missing' as all objects are instances of 'BasicObject' which includes 'method_missing'. The default behavior of BasicObject#method_missing is to respond by raising a NoMethodError.&lt;br /&gt;
&lt;br /&gt;
Overriding 'method_missing' allows users to call methods that don't really exist. The example below illustrates overriding of 'method_missing' to the programmer's advantage. Ruby passes as parameters the name of the method called and the arguments passed to it.&lt;br /&gt;
&lt;br /&gt;
===Example1===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Cat&lt;br /&gt;
  def mew&lt;br /&gt;
    puts &amp;quot;Meow&amp;quot;&lt;br /&gt;
  end  &lt;br /&gt;
  def method_missing(meth, *args)&lt;br /&gt;
    puts &amp;quot;Sorry, I do not #{meth}&amp;quot;&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
c = Cat.new&lt;br /&gt;
c.mew&lt;br /&gt;
&amp;gt;&amp;gt;Meow&lt;br /&gt;
c.bark&lt;br /&gt;
&amp;gt;&amp;gt; Sorry, I do not bark &lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the above example, as the method 'bark' does not exist, method_missing is called with the meth (method name as a symbol) :bark. Hence the result &amp;quot; Sorry, I do not bark &amp;quot;&lt;br /&gt;
&lt;br /&gt;
===Example2===&lt;br /&gt;
Using method_missing to convert Roman numerals to integers&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class Roman &lt;br /&gt;
&lt;br /&gt;
  DIGITS = {&lt;br /&gt;
    'I' =&amp;gt; 1,&lt;br /&gt;
    'V' =&amp;gt; 5,&lt;br /&gt;
    'X' =&amp;gt; 10,&lt;br /&gt;
    'L' =&amp;gt; 50,&lt;br /&gt;
    'C' =&amp;gt; 100,&lt;br /&gt;
    'D' =&amp;gt; 500,&lt;br /&gt;
    'M' =&amp;gt; 1000,&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  def roman_to_integer(roman_string)&lt;br /&gt;
    last = nil&lt;br /&gt;
    roman_string.to_s.upcase.split(//).reverse.inject(0) do |memo, digit|&lt;br /&gt;
      if digit_value = DIGITS[digit]&lt;br /&gt;
        if last &amp;amp;&amp;amp; last &amp;gt; digit_value&lt;br /&gt;
          memo -= digit_value&lt;br /&gt;
        else&lt;br /&gt;
          memo += digit_value&lt;br /&gt;
        end&lt;br /&gt;
        last = digit_value&lt;br /&gt;
      end&lt;br /&gt;
      memo&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def method_missing(method)        &lt;br /&gt;
    str = method.id2name &lt;br /&gt;
    roman_to_integer(str)      &lt;br /&gt;
  end    &lt;br /&gt;
end &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Evaluating Roman.xix calls the xix method of module Roman. Roman has no xix method, so 	method_missing is invoked with :xix as the argument.The id2name method of class Symbol is invoked on xix returning &amp;quot;xix&amp;quot;. The &amp;quot;xix&amp;quot; is then parsed according to the rules for evaluating Roman numerals, and evaluates to 19.&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of reflection==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
* Correctness : Reflection improves the robustness and the correctness of a program  especially in dynamically typed languages as runtime checks can be added to check the availability of the methods or classes.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;br /&gt;
*[http://en.wikipedia.org/wiki/Reflection_(computer_programming) Reflection]&lt;br /&gt;
*[http://www.cs.indiana.edu/~jsobel/rop.html An Introduction to Reflection-Oriented Programming]&lt;br /&gt;
*[http://tutorials.jenkov.com/java-reflection/classes.html Java Reflection]&lt;br /&gt;
*[http://www.slideshare.net/CiaranMcHale/java-reflection-explained-simply Java reflection basics]&lt;br /&gt;
*[http://www2.parc.com/csl/groups/sda/projects/reflection96/docs/malenfant/ref96/ref96.html A Tutorial on Behavioral Reflection and its Implementation]&lt;br /&gt;
*[http://www.quora.com/Computer-Programming/How-is-reflection-useful Uses of reflection]&lt;br /&gt;
*[http://download.oracle.com/javase/tutorial/reflect/index.html Java reflection official website]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53492</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53492"/>
		<updated>2011-10-21T00:20:54Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Advantages and disadvantages of refletion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we can inspect all the methods available to the instance 'w'.&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
cls.getName() gives the complete class name which is printed out as the output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$reflector = new ReflectionClass(&amp;quot;SimpleXMLElement&amp;quot;); &lt;br /&gt;
echo $reflector;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of this example is the complete class map of the class SimpleXMLElement.&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of reflection==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
* Correctness : Reflection improves the robustness and the correctness of a program  especially in dynamically typed languages as runtime checks can be added to check the availability of the methods or classes.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53419</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53419"/>
		<updated>2011-10-20T23:56:37Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Java */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we can inspect all the methods available to the instance 'w'.&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
cls.getName() gives the complete class name which is printed out as the output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$reflector = new ReflectionClass(&amp;quot;SimpleXMLElement&amp;quot;); &lt;br /&gt;
echo $reflector;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of this example is the complete class map of the class SimpleXMLElement.&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
* Correctness : Reflection improves the robustness and the correctness of a program  especially in dynamically typed languages as runtime checks can be added to check the availability of the methods or classes.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53417</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53417"/>
		<updated>2011-10-20T23:55:30Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Smalltalk */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Here we can inspect all the methods available to the instance 'w'.&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$reflector = new ReflectionClass(&amp;quot;SimpleXMLElement&amp;quot;); &lt;br /&gt;
echo $reflector;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of this example is the complete class map of the class SimpleXMLElement.&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
* Correctness : Reflection improves the robustness and the correctness of a program  especially in dynamically typed languages as runtime checks can be added to check the availability of the methods or classes.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53413</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53413"/>
		<updated>2011-10-20T23:53:45Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Advantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$reflector = new ReflectionClass(&amp;quot;SimpleXMLElement&amp;quot;); &lt;br /&gt;
echo $reflector;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of this example is the complete class map of the class SimpleXMLElement.&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
* Correctness : Reflection improves the robustness and the correctness of a program  especially in dynamically typed languages as runtime checks can be added to check the availability of the methods or classes.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53180</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53180"/>
		<updated>2011-10-20T19:31:56Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection by example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
===PHP===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$reflector = new ReflectionClass(&amp;quot;SimpleXMLElement&amp;quot;); &lt;br /&gt;
echo $reflector;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of this example is the complete class map of the class SimpleXMLElement.&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53175</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53175"/>
		<updated>2011-10-20T19:26:36Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection by example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Java===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
public class Fclass{&lt;br /&gt;
  public static void main(String[] args){&lt;br /&gt;
  Class cls = java.lang.Integer.class;&lt;br /&gt;
  String info;&lt;br /&gt;
  info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
  System.out.println(info);&lt;br /&gt;
  }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output of the above code is &amp;quot;java.lang.Integer&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53172</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53172"/>
		<updated>2011-10-20T19:24:26Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* = */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53171</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53171"/>
		<updated>2011-10-20T19:24:08Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection by example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53169</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53169"/>
		<updated>2011-10-20T19:23:21Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* C# */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===Smalltalk===&lt;br /&gt;
w := Workspace new.&lt;br /&gt;
w openLabel:'My Workspace'&lt;br /&gt;
w inspect&lt;br /&gt;
&lt;br /&gt;
===&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53136</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53136"/>
		<updated>2011-10-20T18:41:57Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection by example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
===C#===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
int val = 20;&lt;br /&gt;
System.Type type = val.GetType();&lt;br /&gt;
System.Console.WriteLine(type);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Output is type of the variable &amp;quot;val&amp;quot; = System.Int32&lt;br /&gt;
&lt;br /&gt;
===&lt;br /&gt;
&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53092</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53092"/>
		<updated>2011-10-20T17:35:10Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Types of reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based on observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53090</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53090"/>
		<updated>2011-10-20T17:30:58Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in ruby we can see how the name of a class can be obtained from the object and how we can get the ancestor classes and modules of a particular class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5.class #=&amp;gt; Fixnum&lt;br /&gt;
&lt;br /&gt;
&amp;quot;hello&amp;quot;.class #=&amp;gt; String&lt;br /&gt;
&lt;br /&gt;
String.ancestors #=&amp;gt; [String, Enumerable, Comparable, Object, Kernel]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53069</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53069"/>
		<updated>2011-10-20T16:07:37Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Types of reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in java we can see how the name of a class can be obtained from the class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
 public class Fclass{&lt;br /&gt;
   public static void main(String[] args){&lt;br /&gt;
   Class cls = java.lang.Integer.class;&lt;br /&gt;
   String info;&lt;br /&gt;
   info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
   System.out.println(info);&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
There are two basic types of reflection. They are:&lt;br /&gt;
* Behavioral Reflection: This type of reflection changes the behaviour of the execution of the program based observation and modification.&lt;br /&gt;
* Structural Reflection: This type of reflection deals with changing the very structure of the program such as the data structures and flow of control in the program.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53058</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53058"/>
		<updated>2011-10-20T15:51:01Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in java we can see how the name of a class can be obtained from the class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
 public class Fclass{&lt;br /&gt;
   public static void main(String[] args){&lt;br /&gt;
   Class cls = java.lang.Integer.class;&lt;br /&gt;
   String info;&lt;br /&gt;
   info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
   System.out.println(info);&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
== Types of reflection ==&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53051</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53051"/>
		<updated>2011-10-20T14:52:21Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in java we can see how the name of a class can be obtained from the class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
 public class Fclass{&lt;br /&gt;
   public static void main(String[] args){&lt;br /&gt;
   Class cls = java.lang.Integer.class;&lt;br /&gt;
   String info;&lt;br /&gt;
   info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
   System.out.println(info);&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession. These actions can  implemented with the implementation of the following components:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53050</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53050"/>
		<updated>2011-10-20T14:51:20Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in java we can see how the name of a class can be obtained from the class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
 public class Fclass{&lt;br /&gt;
   public static void main(String[] args){&lt;br /&gt;
   Class cls = java.lang.Integer.class;&lt;br /&gt;
   String info;&lt;br /&gt;
   info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
   System.out.println(info);&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53049</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53049"/>
		<updated>2011-10-20T14:50:46Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in java we can see how the name of a class can be obtained from the class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
 public class Fclass{&lt;br /&gt;
   public static void main(String[] args){&lt;br /&gt;
   Class cls = java.lang.Integer.class;&lt;br /&gt;
   String info;&lt;br /&gt;
   info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
   System.out.println(info);&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Reflection is in essense a connection between the object-level (program) and meta-level (the processor). The ability of the object level to be able to observe and modify the meta-level information is the consequence of this connection. These actions can be termed as introspection and intercession.&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53048</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53048"/>
		<updated>2011-10-20T14:43:26Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in java we can see how the name of a class can be obtained from the class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
 public class Fclass{&lt;br /&gt;
   public static void main(String[] args){&lt;br /&gt;
   Class cls = java.lang.Integer.class;&lt;br /&gt;
   String info;&lt;br /&gt;
   info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
   System.out.println(info);&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
* Ability to create [http://en.wikipedia.org/wiki/First-class_object first class objects] ie  [http://en.wikipedia.org/wiki/Reification_(computer_science) reification]. &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53047</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53047"/>
		<updated>2011-10-20T14:41:02Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in java we can see how the name of a class can be obtained from the class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
 public class Fclass{&lt;br /&gt;
   public static void main(String[] args){&lt;br /&gt;
   Class cls = java.lang.Integer.class;&lt;br /&gt;
   String info;&lt;br /&gt;
   info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
   System.out.println(info);&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Some of the common information that can be obtained from reflection are :&lt;br /&gt;
* Object type&lt;br /&gt;
* Super classes of any class&lt;br /&gt;
* Methods&lt;br /&gt;
* class fields&lt;br /&gt;
* Interfaces&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
* Ability to create first class objects(http://en.wikipedia.org/wiki/First-class_object) ie reification (http://en.wikipedia.org/wiki/Reification_(computer_science)). &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53046</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53046"/>
		<updated>2011-10-20T14:36:39Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
In the simple illustration provided below in java we can see how the name of a class can be obtained from the class. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
 public class Fclass{&lt;br /&gt;
   public static void main(String[] args){&lt;br /&gt;
   Class cls = java.lang.Integer.class;&lt;br /&gt;
   String info;&lt;br /&gt;
   info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
   System.out.println(info);&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
* Ability to create first class objects(http://en.wikipedia.org/wiki/First-class_object) ie reification (http://en.wikipedia.org/wiki/Reification_(computer_science)). &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53045</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53045"/>
		<updated>2011-10-20T14:35:11Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
import java.lang.reflect.*;&lt;br /&gt;
 public class Fclass{&lt;br /&gt;
   public static void main(String[] args){&lt;br /&gt;
   Class cls = java.lang.Integer.class;&lt;br /&gt;
   String info;&lt;br /&gt;
   info = cls.getName(); // It will show java.lang.Integer&lt;br /&gt;
   System.out.println(info);&lt;br /&gt;
   }&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
* Ability to create first class objects(http://en.wikipedia.org/wiki/First-class_object) ie reification (http://en.wikipedia.org/wiki/Reification_(computer_science)). &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53044</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53044"/>
		<updated>2011-10-20T14:24:56Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Applications of Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
* Ability to create first class objects(http://en.wikipedia.org/wiki/First-class_object) ie reification (http://en.wikipedia.org/wiki/Reification_(computer_science)). &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
*Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
*Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
*Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
&lt;br /&gt;
*Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
*Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
*Reflection is very useful when the software is upgraded regularly. It provides an easy method to check for available methods and classes. This prevents the errors caused by the absense of methods and classes when they are deprecated.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53043</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53043"/>
		<updated>2011-10-20T14:18:52Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class. Since the program need not have all the information at compile time it makes the program more dynamic.&lt;br /&gt;
&lt;br /&gt;
Common languages that exhibit reflection to varying degrees are Ruby, Java, Smalltalk, C# and more.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
* Ability to create first class objects(http://en.wikipedia.org/wiki/First-class_object) ie reification (http://en.wikipedia.org/wiki/Reification_(computer_science)). &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53042</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53042"/>
		<updated>2011-10-20T14:13:30Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Disadvantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It also provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
* Ability to create first class objects(http://en.wikipedia.org/wiki/First-class_object) ie reification (http://en.wikipedia.org/wiki/Reification_(computer_science)). &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
* Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
* Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
* Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53041</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53041"/>
		<updated>2011-10-20T14:13:08Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Advantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It also provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
* Ability to create first class objects(http://en.wikipedia.org/wiki/First-class_object) ie reification (http://en.wikipedia.org/wiki/Reification_(computer_science)). &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
* Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
* Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
* Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
* Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
1. Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
2. Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
3. Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53040</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53040"/>
		<updated>2011-10-20T14:12:34Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It also provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
* Ability to create first class objects(http://en.wikipedia.org/wiki/First-class_object) ie reification (http://en.wikipedia.org/wiki/Reification_(computer_science)). &lt;br /&gt;
&lt;br /&gt;
* Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
* Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
1.Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
2.Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
3.Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
4.Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
1. Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
2. Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
3. Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53039</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53039"/>
		<updated>2011-10-20T14:11:29Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Advantages and disadvantages of refletion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It also provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
1. Ability to create first class objects(http://en.wikipedia.org/wiki/First-class_object) ie reification (http://en.wikipedia.org/wiki/Reification_(computer_science)). &lt;br /&gt;
&lt;br /&gt;
2. Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
3. Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
&lt;br /&gt;
===Advantages===&lt;br /&gt;
1.Extensibility: Reflection provides the capability of using external and user defined classes by instantiation of extensibility objects using their fully qualified names.&lt;br /&gt;
2.Class browsers in IDEs: The ability to examine the members of classes makes implementation of visual aids , auto-completion and documentation easy in development tools for programmers.&lt;br /&gt;
3.Debugging: Reflection allows the user to observe the private members in classes. This capability can be used to debug classes and their interactions.&lt;br /&gt;
4.Test Harness : Reflection can be used to call a set of testing APIs defined on a class for maximum coverage of testing.&lt;br /&gt;
&lt;br /&gt;
===Disadvantages===&lt;br /&gt;
1. Reflection introduces lot of performance overhead when compared to non-reflective code. Hence it should be used judiciously.&lt;br /&gt;
2. Since it provides access to the internals of a class or an encapsulated object security becomes a major issue.&lt;br /&gt;
3. Since it is run-time binding we lose the security of compile time checks and verification.&lt;br /&gt;
&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53038</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53038"/>
		<updated>2011-10-20T14:10:37Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Applications of Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It also provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
1. Ability to create first class objects(http://en.wikipedia.org/wiki/First-class_object) ie reification (http://en.wikipedia.org/wiki/Reification_(computer_science)). &lt;br /&gt;
&lt;br /&gt;
2. Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
3. Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
Reflection has become invaluable to programmers who need to connect code with data. For example in a GUI environment a button might need to invoke different methods in different classes. Reflection can be used here to call the method on any given class. &lt;br /&gt;
&lt;br /&gt;
Programmers who deal with a multitude of classes at the same time can use reflection to create a “serializer” that for a given class uses reflection to go through all the instance variables and processes them accordingly.&lt;br /&gt;
&lt;br /&gt;
Reflection is used in large test frameworks where reflection helps in identifying the test methods for different scenarios.&lt;br /&gt;
Reflection provides the ability to morph the code based on dynamic situations. This provides a sense of artificial intelligence to the program as whole.&lt;br /&gt;
&lt;br /&gt;
Reflection can be used to debug and verify code as it provides access to the insides of a program.&lt;br /&gt;
&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53037</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53037"/>
		<updated>2011-10-20T14:08:48Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Implementation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It also provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
There are many challenges faced by designers of reflective languages. They must provide as much leeway as possible for late binging and at the same time they must optimize the compilation of the static components so that they are ready for run-time. Some of the critical components required for implementing reflection is as follows:&lt;br /&gt;
&lt;br /&gt;
1. Ability to create first class objects(http://en.wikipedia.org/wiki/First-class_object) ie reification (http://en.wikipedia.org/wiki/Reification_(computer_science)). &lt;br /&gt;
&lt;br /&gt;
2. Ability to convert a string that denotes a class or a method into its corresponding    reference or invocation.&lt;br /&gt;
&lt;br /&gt;
3. Ability to use and create symbolic links to methods and classes.&lt;br /&gt;
&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53036</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53036"/>
		<updated>2011-10-20T14:07:51Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Reflection */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
Reflection is the ability of a program or a computation to examine and modify itself at run time even though it does not have enough information at compile time. For example in a high level object oriented language the ability to inspect its class , interfaces and methods at run time without knowing their names at compile time. It also provides the ability to modify , instantiate and access to methods such as getter's and setter's of a class.&lt;br /&gt;
&lt;br /&gt;
==Implementation==&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53035</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53035"/>
		<updated>2011-10-20T14:06:13Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.The modifications can be any aspect of the programming language .i.e syntax, semantics, or implementation.&lt;br /&gt;
&lt;br /&gt;
Reflection as a concept was first introduced in the doctoral dissertation of Dr. Brian Cantwell Smith in 1992.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
==Implementation==&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53024</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53024"/>
		<updated>2011-10-20T13:41:55Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
Reflection is a relatively common computer programming concept where in the program has the inherant ability to examine itself at runtime. Based on its observations the program can modify it's behaviour for the given situation.&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
==Implementation==&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53023</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53023"/>
		<updated>2011-10-20T13:37:46Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
&lt;br /&gt;
==Reflection==&lt;br /&gt;
==Implementation==&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53021</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53021"/>
		<updated>2011-10-20T13:34:22Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;br /&gt;
==Reflection==&lt;br /&gt;
==Implementation==&lt;br /&gt;
==Reflection by example==&lt;br /&gt;
==Applications of Reflection==&lt;br /&gt;
==Advantages and disadvantages of refletion==&lt;br /&gt;
==Additional Reading==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53018</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53018"/>
		<updated>2011-10-20T13:31:22Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Introduction==&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53017</id>
		<title>CSC/ECE 517 Fall 2011/ch4 4f rs</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch4_4f_rs&amp;diff=53017"/>
		<updated>2011-10-20T13:29:40Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: Created page with &amp;quot;=Introduction=&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Introduction=&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011&amp;diff=53015</id>
		<title>CSC/ECE 517 Fall 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011&amp;diff=53015"/>
		<updated>2011-10-20T13:27:32Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[Link title]]&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1a ms]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1a cs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1a ri]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1a lj]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1b sa]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1b ds]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1b tj]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1c cm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1c sj]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1c ka]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1d sr]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e vs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e aa]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1a sc]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e dm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e an]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e sa]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e lm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1g vn]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1f rs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1f sv]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1g jn]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1h ps]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1e sm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1i zf]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1g rn]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1i cl]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1d ss]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1i lj]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1h hs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 1d gs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2b ns]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2b jp]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2a av]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2f jm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2e ad]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2e kt]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2e gp]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2b qu]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2c bs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2c rs]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2a ca]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch1 2b rv]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2c ds]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2b sa]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2f vh]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch2 2e ps]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch3 3a oe]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch3 3h rr]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch3 3h ss]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch3 4b js]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch3 4b ms]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4b ds]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4i aa]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4i sd]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4d mt]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4d ls]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4d ch]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4c ap]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4h sv]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4e cl]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4a ga]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4f sl]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4i js]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4f ss]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4c dm]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4g nv]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4j fw]]&lt;br /&gt;
&lt;br /&gt;
*[[CSC/ECE 517 Fall 2011/ch4 4f rs]]&lt;br /&gt;
&lt;br /&gt;
*[[trial]]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48697</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1e sa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48697"/>
		<updated>2011-09-15T21:02:36Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Block Structured code example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;'''Block vs Object-Oriented Programming Languages'''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
In computer science, computer programming languages exhibit variance in syntax and structure in order to effectively solve problems. Two of these variances can be seen between '''block structure''' and '''object-oriented structure'''. A programming language with block structure allows the programmer to group lines of code for convenient use throughout the rest of the program. Object-oriented structure meanwhile goes further to allow the programmer to associate data with its actions in a hierarchical manner. Object-oriented structure has many advantages which generally make it more effective and durable than block-structured languages, but object-oriented languages also benefit from the core ideas present in block structure programming.&lt;br /&gt;
&lt;br /&gt;
==Block structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Block-structured programming languages are task-centric, high-level languages. Operations on data sets are emphasized in an attempt to logically organize program operation. The design and implementation involves breaking down the problem into discrete blocks or units which can be nested to any depth or not at all. Each block generally consists of a set of delimiters such as braces or keywords that separate them from other blocks. Each of these blocks contains a set of (optional) declarations and logic to solve a particular problem. Declarations inside of nested blocks introduces the concept of variable scope, which frees the programmer from having to worry about name collisions and other variable maintenance tasks.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Block_(programming) Block (programming)] at Wikipedia&amp;lt;/ref&amp;gt; A [[CSC/ECE_517_Fall_2011/ch1_1e_sa#C.2FC.2B.2B_Code_Example|code example]] of a block structured program is provided later in the article.&lt;br /&gt;
&lt;br /&gt;
Overall, block-structured languages can be summarized as having the following features:&lt;br /&gt;
* Modular - Lines of code/functionality are grouped together&lt;br /&gt;
* Scoped - Variables are limited to the group of code they are declared in&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Top down] - Modules are created as necessary to meet the program's requirements &lt;br /&gt;
* Simple - It is generally simpler to &amp;quot;cobble together&amp;quot; modules of code that accomplish a simple, well-defined task.&lt;br /&gt;
&lt;br /&gt;
===History===&lt;br /&gt;
Block-structured languages were first conceived in the 1950s with the advent of [http://en.wikipedia.org/wiki/ALGOL ALGOL], one of the first [http://en.wikipedia.org/wiki/Imperative_programming imperative programming languages]. An evolution of block structuring was created as the &amp;quot;GOTO&amp;quot; logic of programs became more and more difficult to understand and maintain. In 1968, famed computer scientist [http://en.wikipedia.org/wiki/Edsger_W._Dijkstra Edsger Dijkstra] wrote [http://dx.doi.org/10.1145%2F362929.362947 a letter] and [http://dx.doi.org/10.1145%2F355604.361591 follow-up article] on the ideas and motivation behind &amp;quot;[http://en.wikipedia.org/wiki/Structured_programming structured programming],&amp;quot; where the program exhibits “[http://en.wikipedia.org/wiki/Separation_of_concerns separation of concerns],&amp;quot; single point of entry but multiple points of exit, and ideas of data structures. It was Dijkstra’s and others’ which helped propel this basic idea of block structure programming into the mainstream.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Structured_programming Structured programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
Block-structured programming languages dominate the general purpose, imperative programming language arena. Indeed most programming languages in modern use enjoy some of the benefits of block structure with grouping of code and scope of variables. Indeed, ignoring their object-oriented aspects, all of [http://en.wikipedia.org/wiki/C_(programming_language) C], [http://en.wikipedia.org/wiki/C%2B%2B C++], [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#], [http://en.wikipedia.org/wiki/Java_(programming_language) Java], [http://en.wikipedia.org/wiki/PHP PHP] and [http://en.wikipedia.org/wiki/Visual_Basic Visual Basic] – for example – contain elements of block structure.&lt;br /&gt;
====Block Structured code example====&lt;br /&gt;
The code snippet given below is an ALGOL example that calculates the mean.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin&lt;br /&gt;
  integer N;&lt;br /&gt;
  Read Int(N);&lt;br /&gt;
&lt;br /&gt;
  begin&lt;br /&gt;
    real array Data[1:N];&lt;br /&gt;
    real sum, avg;&lt;br /&gt;
    integer i;&lt;br /&gt;
    sum:=0;&lt;br /&gt;
&lt;br /&gt;
    for i:=1 step 1 until N do&lt;br /&gt;
      begin real val;&lt;br /&gt;
        Read Real(val);&lt;br /&gt;
        Data[i]:=if val&amp;lt;0 then -val else val&lt;br /&gt;
      end;&lt;br /&gt;
&lt;br /&gt;
    for i:=1 step 1 until N do&lt;br /&gt;
      sum:=sum + Data[i];&lt;br /&gt;
    avg:=sum/N;&lt;br /&gt;
    Print Real(avg)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object-oriented structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Object-oriented languages have an important overall goal and foster major design principles.&lt;br /&gt;
====Description====&lt;br /&gt;
Object-oriented structured languages are data-centric, high-level languages. This is in contrast to block structure languages, which are task-centric. Compared to block-structure languages, logical organization of &amp;lt;i&amp;gt;data&amp;lt;/i&amp;gt; and the methods associated with them are emphasized. It is a way of grouping data with executable code. These groups are called &amp;quot;[http://en.wikipedia.org/wiki/Object_(computer_science) objects].&amp;quot; Objects utilize their data and interact with other objects such that a hierarchy is established (called &amp;quot;[http://en.wikipedia.org/wiki/Class_(computer_science) classes]&amp;quot; in popular languages). Toward this end and depending on the language, objects can be interrelated and defined so that their relationships can produce code that is well-organized, easy to read, and reusable.&amp;lt;ref name=&amp;quot;oopref&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Principles====&lt;br /&gt;
=====Encapsulation=====&lt;br /&gt;
Also referred to as &amp;quot;data hiding,&amp;quot; [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) encapsulation] shields the programmer from the implementation details of an object. These implementation details would include [http://en.wikipedia.org/wiki/Local_variable private variables], special [http://en.wikipedia.org/wiki/Library_(computing) libraries], and [http://en.wikipedia.org/wiki/Data_structure data structures] that the programmer does not need to know in order to utilize the functionality offered by the object.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation (object-oriented programming)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Inheritance=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance] introduces the idea of objects sharing functionality in data or methods that are common. [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses Subclasses] can inherit data structures, functions, and attributes of their [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses superclasses] in order to create an object or [http://en.wikipedia.org/wiki/Class_hierarchy class hierarchy] that is effective in organizing data and methods in a logical manner.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance (computer science)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Polymorphism=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism] describes the idea of interfaces, where one data type can be defined that allows other dissimilar types to implement a common set of [http://en.wikipedia.org/wiki/Method_(computer_programming) methods] and [http://en.wikipedia.org/wiki/Field_(computer_science) fields]. This allows a high level of [http://en.wikipedia.org/wiki/Abstraction_(computer_science) abstraction] that allows programmers to write easily maintainable code.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism in object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===History and transition===&lt;br /&gt;
Early forms of object oriented programming languages were created in the early 1960s with the creation of [http://en.wikipedia.org/wiki/Lisp_(programming_language) LISP] and an early form of ALGOL, with [http://en.wikipedia.org/wiki/Simula Simula 67] signaling the actual beginning of the object-oriented &amp;quot;revolution.&amp;quot; The development of object-oriented languages progressed through other languages like [http://en.wikipedia.org/wiki/Simula Smalltalk] and the archetypal C++ to arrive at many of the object oriented languages we have today.&amp;lt;ref name=&amp;quot;oopref&amp;quot;/&amp;gt; As processing capability has matured, so too have the capabilities of programming languages. More and more though, [http://en.wikipedia.org/wiki/Dynamic_programming_language dynamic programming languages] like [http://en.wikipedia.org/wiki/Ruby_(programming_language) Ruby] are being treated as &amp;quot;true&amp;quot; object-oriented languages because of their rapid prototpying ability and strong [http://en.wikipedia.org/wiki/Object-oriented_analysis_and_design object model].&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
A complete list of object oriented languages is outside the scope of this document, but some major examples are [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo], C++, C#, [http://en.wikipedia.org/wiki/COBOL COBOL 2002], [http://en.wikipedia.org/wiki/F_Sharp_(programming_language) F#], [http://en.wikipedia.org/wiki/Fortran Fortran 2003], Java, [http://en.wikipedia.org/wiki/Matlab MATLAB], [http://en.wikipedia.org/wiki/Objective_c Objective-C], [http://en.wikipedia.org/wiki/PHP PHP 5], [http://en.wikipedia.org/wiki/Python_(programming_language) Python], Ruby, and Visual Basic.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/List_of_object-oriented_programming_languages List of object-oriented programming languages] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
====Object-oriented code example====&lt;br /&gt;
The code snippet given below is a simple example from a purely object-oriented language called Ruby.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AdderGen&lt;br /&gt;
  def initialize(n)&lt;br /&gt;
    @classVar1 = lambda {|a| n+a}&lt;br /&gt;
    @classVar2 = lambda {|a| a*a}&lt;br /&gt;
  end&lt;br /&gt;
  def addVal(a)&lt;br /&gt;
    return @classVar1.call(a)&lt;br /&gt;
  end&lt;br /&gt;
  def squareVal(a)&lt;br /&gt;
    return @classVar2.call(a)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
a = AdderGen.new(5)&lt;br /&gt;
puts a.addVal(6)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Structure comparison==&lt;br /&gt;
===Advantages and disadvantages===&lt;br /&gt;
==== Block-structured languages ====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* Simplicity&lt;br /&gt;
* Reduced coding and turnover time&lt;br /&gt;
* Dynamic lifetime of variables ([http://en.wikipedia.org/wiki/Scope_(computer_science) Scope]) provide efficient usage of memory since allocation and deletion occur at the entrance and exit of each block&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* Commercial projects are difficult to manage due to very large [http://en.wikipedia.org/wiki/Codebase codebase] sizes&lt;br /&gt;
* Reduced code [http://en.wikipedia.org/wiki/Reusability reusability]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Computer_security Security] concerns, espcially in the realm of [http://en.wikipedia.org/wiki/Array#In_computer_science arrays] and accessing [http://en.wikipedia.org/wiki/Value_(computer_science) elements] that are [http://en.wikipedia.org/wiki/Privilege_(computing) out of bounds]&lt;br /&gt;
&lt;br /&gt;
====Object-Oriented languages====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* The software objects model real world objects so program composition is well defined and structured&lt;br /&gt;
* Each object's definition and internal implementation is decoupled from other objects, making the system design inherently modular ([http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation])&lt;br /&gt;
* Adding new features becomes easier because of inheritance, allowing the new class to contain the new feature in addition to all old features from the inherited class&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Debugging Debugging] is easier since each object's internal mechanisms are independent of each other, which helps in isolating errors and fixing them&lt;br /&gt;
* Enhanced code reusability&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* The complexity of object-oriented design becomes prohibitive when working on small projects&lt;br /&gt;
* Object-oriented programming paradigm is preferable for dynamic environments rather than simple environments&lt;br /&gt;
* Reduced time efficiency compared to block-structured languages&lt;br /&gt;
&lt;br /&gt;
===Summary of important differences===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Difference&lt;br /&gt;
! Block Structured Languages&lt;br /&gt;
! Object-Oriented Languages&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem approach'''&lt;br /&gt;
| Top-down approach is followed&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Bottom-up] approach is followed&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem focus'''&lt;br /&gt;
| Focus is on the [http://en.wikipedia.org/wiki/Algorithm#Computer_algorithms algorithm] to solve the problem&lt;br /&gt;
| Focus is on getting the object design right&lt;br /&gt;
|-&lt;br /&gt;
| '''View of data and functions'''&lt;br /&gt;
| Views data and functions as separate entities&lt;br /&gt;
| Views data and functions as single entity&lt;br /&gt;
|-&lt;br /&gt;
| '''Cost of maintenance'''&lt;br /&gt;
| Maintenance is costly &lt;br /&gt;
| Maintenance is relatively cheaper&lt;br /&gt;
|-&lt;br /&gt;
| '''Software reuse'''&lt;br /&gt;
| Software reuse is not possible&lt;br /&gt;
| Software reuse is possible &lt;br /&gt;
|-&lt;br /&gt;
| '''Abstraction'''&lt;br /&gt;
| Function abstraction is used&lt;br /&gt;
| Data abstraction is used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Effectiveness and durability of object oriented languages over block structured languages ===&lt;br /&gt;
&lt;br /&gt;
Although block structured languages were simpler and faster for smaller projects, when it comes to large commercial undertaking the manpower and tools required to maintain the code base is very prohibitive. It was very difficult to fix issues, add new features, and at the same time to make sure that the integrity of the code base is intact. Many projects were perpetually stagnant at 90% completion with issues coming up at the eleventh hour. All these problems led to the hastening of the move to object-oriented languages which showed it had the solutions to all the problems that block structured languages could not solve. The following four points are the most important reasons why object-oriented languages were more effective and durable that block structured languages:&lt;br /&gt;
* Maintenance - In block structured languages, especially in large projects, system maintenance became a challenge. Object oriented languages could counter this by providing clear demarcation between the objects and making it easier to work on individual aspects of the system without disturbing the other components.&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Information_hiding Data hiding] - In block structured language system the data usually has global scope. Hence it is very difficult to monitor or supervise data access. This was solved by object-oriented languages by providing data encapsulation. The data and the corresponding attributes are put into a nice little package that was much easier to control and monitor.&lt;br /&gt;
* Code reuse - Object oriented languages are proponents of code reuse. Hence the code size could be reduced sufficiently enough when it comes to large projects to warrant a shift from block structured to object oriented languages.&lt;br /&gt;
* Feature additions - Object oriented languages provide a very cost effective and safe way to add new features to the existing system without causing the whole system to collapse. This feature is very important for large scale software vendors who provide various customizations.&lt;br /&gt;
&lt;br /&gt;
===Applicability between paradigms===&lt;br /&gt;
Object-oriented languages have solved many problems that block structured languages introduced. But all is not lost with block structured languages. They boast some very important features that are needed in any programming language. The simplicity and readability of code in block structured languages are enviable features indeed. Because of this very simplicity we find that block structured languages are very efficient in terms of speed and performance. Such a language would also provide the flexibility in moving legacy block structured systems to the object oriented paradigm seamlessly. A language that can capture both sides of the argument would be a formidable entry into the growing list of programming languages. This explains why we see C++ emerging as one of the most popular object oriented languages. It has both the block structured features of C and the object-oriented concepts built into it, thereby making it a very versatile and efficient programming language.&lt;br /&gt;
&lt;br /&gt;
==C/C++ Code Example==&lt;br /&gt;
{{Expand section}}&lt;br /&gt;
Below is a code example highlighting key differences between a block structured program and an object oriented program all in one source file.&lt;br /&gt;
&amp;lt;pre&amp;gt;// For block structure, leave the below line commented to compile in C&lt;br /&gt;
// For object oriented structure, uncomment the line to compile in C++&lt;br /&gt;
//#define USING_CPP&lt;br /&gt;
&lt;br /&gt;
#ifndef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C standard header files&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define the messages of each persona&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Define the function prototypes for delivering the different messages&lt;br /&gt;
char *getKingMessage();&lt;br /&gt;
char *getJesterMessage();&lt;br /&gt;
char *getPeonMessage();&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Go through and make each function call for...&lt;br /&gt;
	// The King&lt;br /&gt;
	printf(&amp;quot;And now a message from the king: %s\n&amp;quot;, getKingMessage());&lt;br /&gt;
	printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// The Court Jester&lt;br /&gt;
	printf(&amp;quot;And now a message from the court jester: %s\n&amp;quot;, getJesterMessage());&lt;br /&gt;
	printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// A Peon&lt;br /&gt;
	printf(&amp;quot;And now a message from a peon: %s\n&amp;quot;, getPeonMessage());&lt;br /&gt;
	printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
	&lt;br /&gt;
	// Wait for user input before exiting&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the king&lt;br /&gt;
char *getKingMessage()&lt;br /&gt;
{&lt;br /&gt;
	return KING_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the court jester&lt;br /&gt;
char *getJesterMessage()&lt;br /&gt;
{&lt;br /&gt;
	return JESTER_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by all peons&lt;br /&gt;
char *getPeonMessage()&lt;br /&gt;
{&lt;br /&gt;
	return PEON_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#ifdef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C++ standard headers&lt;br /&gt;
#include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define what each persona should say&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Keep all classes clearly separated from other sections of code&lt;br /&gt;
namespace Monarchy&lt;br /&gt;
{&lt;br /&gt;
	// Define a basic class where a person has a label and something they want to say&lt;br /&gt;
	class Person&lt;br /&gt;
	{&lt;br /&gt;
	private:&lt;br /&gt;
		char *szMessage;&lt;br /&gt;
		char *szLabel;&lt;br /&gt;
&lt;br /&gt;
	public:&lt;br /&gt;
		// Allow a person to deliver their message&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			printf(&amp;quot;A now a message from %s: %s\n&amp;quot;, this-&amp;gt;szLabel, this-&amp;gt;szMessage);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// A person needs to be initialized with a label and a message&lt;br /&gt;
		Person(char*label, char *msg)&lt;br /&gt;
		{&lt;br /&gt;
			this-&amp;gt;szLabel = label;&lt;br /&gt;
			this-&amp;gt;szMessage = msg;&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// The King is a person (and thus inherits from it)&lt;br /&gt;
	class King : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// The king has the same label, but his message might change according to the political winds&lt;br /&gt;
		King(char *msg) : Person(&amp;quot;the king&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Here, the function is being overridden...&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			// .. but the base class's DeliverMessage is still being called, in addition to the tag line&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A peon is a person (and thus inherits from it)&lt;br /&gt;
	class Peon : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change according to his or her attitude toward the king&lt;br /&gt;
		Peon(char *msg) : Person(&amp;quot;a peon&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Like above, deliver the message, but always provide a common tag line&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A jester is a person (and thus inherits from it)&lt;br /&gt;
	class Jester : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change if the king is sick of his jokes&lt;br /&gt;
		Jester(char *msg) : Person(&amp;quot;the court jester&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Might as well call him Fozzie ;)&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Initialize some monarchy objects&lt;br /&gt;
	Monarchy::King TheKing(KING_MESSAGE);&lt;br /&gt;
	Monarchy::Jester Borat(JESTER_MESSAGE);&lt;br /&gt;
	Monarchy::Peon Bruno(PEON_MESSAGE);&lt;br /&gt;
&lt;br /&gt;
	// Let them deliver their messages&lt;br /&gt;
	TheKing.DeliverMessage();&lt;br /&gt;
	Borat.DeliverMessage();&lt;br /&gt;
	Bruno.DeliverMessage();&lt;br /&gt;
&lt;br /&gt;
	// Wait for user input&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
#endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Imperative_programming Imperative programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Functional_programming Functional programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Programming_paradigm Programming paradigm] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Class-based_programming Class-based programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Prototype-based_programming Prototype-based programming] at Wikipedia&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further reading==&lt;br /&gt;
* Freeman, Eric, Elisabeth Freeman, Kathy Sierra, and Bert Bates. ''Head First Design Patterns''. Sebastopol, CA: O'Reilly, 2004. Print.&lt;br /&gt;
* Liberty, Jesse. ''Sams Teach Yourself C++ in 24 Hours''. Indianapolis, IN: Sams, 2002. Print.&lt;br /&gt;
* ''Microsoft Visual C++ Language Reference''. Redmond, WA: Microsoft, 1997. Print.&lt;br /&gt;
* Weiss, Mark Allen. ''Data Structures &amp;amp; Algorithm Analysis in Java''. Reading, MA: Addison-Wesley, 1999. Print.&lt;br /&gt;
* Mohamed Fayad, Mauri Laitinen. &amp;quot;TRANSITION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://www.slideshare.net/spajus/object-oriented-programming-presentation-933801 Object Oriented Programming] at slide'''share'''&lt;br /&gt;
* [http://www.developer.com/java/other/article.php/3493761/The-Evolution-of-Object-Oriented-Languages.htm The Evolution of Object-Oriented Languages]&lt;br /&gt;
* [http://www.xp2003.org/the-history-of-oop.htm The History of OOP]&lt;br /&gt;
* [http://www.brighthub.com/internet/web-development/articles/82024.aspx Structured vs. Object-Oriented Programming: A Comparison]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48696</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1e sa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48696"/>
		<updated>2011-09-15T21:01:42Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Object-oriented structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;'''Block vs Object-Oriented Programming Languages'''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
In computer science, computer programming languages exhibit variance in syntax and structure in order to effectively solve problems. Two of these variances can be seen between '''block structure''' and '''object-oriented structure'''. A programming language with block structure allows the programmer to group lines of code for convenient use throughout the rest of the program. Object-oriented structure meanwhile goes further to allow the programmer to associate data with its actions in a hierarchical manner. Object-oriented structure has many advantages which generally make it more effective and durable than block-structured languages, but object-oriented languages also benefit from the core ideas present in block structure programming.&lt;br /&gt;
&lt;br /&gt;
==Block structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Block-structured programming languages are task-centric, high-level languages. Operations on data sets are emphasized in an attempt to logically organize program operation. The design and implementation involves breaking down the problem into discrete blocks or units which can be nested to any depth or not at all. Each block generally consists of a set of delimiters such as braces or keywords that separate them from other blocks. Each of these blocks contains a set of (optional) declarations and logic to solve a particular problem. Declarations inside of nested blocks introduces the concept of variable scope, which frees the programmer from having to worry about name collisions and other variable maintenance tasks.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Block_(programming) Block (programming)] at Wikipedia&amp;lt;/ref&amp;gt; A [[CSC/ECE_517_Fall_2011/ch1_1e_sa#C.2FC.2B.2B_Code_Example|code example]] of a block structured program is provided later in the article.&lt;br /&gt;
&lt;br /&gt;
Overall, block-structured languages can be summarized as having the following features:&lt;br /&gt;
* Modular - Lines of code/functionality are grouped together&lt;br /&gt;
* Scoped - Variables are limited to the group of code they are declared in&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Top down] - Modules are created as necessary to meet the program's requirements &lt;br /&gt;
* Simple - It is generally simpler to &amp;quot;cobble together&amp;quot; modules of code that accomplish a simple, well-defined task.&lt;br /&gt;
&lt;br /&gt;
===History===&lt;br /&gt;
Block-structured languages were first conceived in the 1950s with the advent of [http://en.wikipedia.org/wiki/ALGOL ALGOL], one of the first [http://en.wikipedia.org/wiki/Imperative_programming imperative programming languages]. An evolution of block structuring was created as the &amp;quot;GOTO&amp;quot; logic of programs became more and more difficult to understand and maintain. In 1968, famed computer scientist [http://en.wikipedia.org/wiki/Edsger_W._Dijkstra Edsger Dijkstra] wrote [http://dx.doi.org/10.1145%2F362929.362947 a letter] and [http://dx.doi.org/10.1145%2F355604.361591 follow-up article] on the ideas and motivation behind &amp;quot;[http://en.wikipedia.org/wiki/Structured_programming structured programming],&amp;quot; where the program exhibits “[http://en.wikipedia.org/wiki/Separation_of_concerns separation of concerns],&amp;quot; single point of entry but multiple points of exit, and ideas of data structures. It was Dijkstra’s and others’ which helped propel this basic idea of block structure programming into the mainstream.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Structured_programming Structured programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
Block-structured programming languages dominate the general purpose, imperative programming language arena. Indeed most programming languages in modern use enjoy some of the benefits of block structure with grouping of code and scope of variables. Indeed, ignoring their object-oriented aspects, all of [http://en.wikipedia.org/wiki/C_(programming_language) C], [http://en.wikipedia.org/wiki/C%2B%2B C++], [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#], [http://en.wikipedia.org/wiki/Java_(programming_language) Java], [http://en.wikipedia.org/wiki/PHP PHP] and [http://en.wikipedia.org/wiki/Visual_Basic Visual Basic] – for example – contain elements of block structure.&lt;br /&gt;
====Block Structured code example====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin&lt;br /&gt;
  integer N;&lt;br /&gt;
  Read Int(N);&lt;br /&gt;
&lt;br /&gt;
  begin&lt;br /&gt;
    real array Data[1:N];&lt;br /&gt;
    real sum, avg;&lt;br /&gt;
    integer i;&lt;br /&gt;
    sum:=0;&lt;br /&gt;
&lt;br /&gt;
    for i:=1 step 1 until N do&lt;br /&gt;
      begin real val;&lt;br /&gt;
        Read Real(val);&lt;br /&gt;
        Data[i]:=if val&amp;lt;0 then -val else val&lt;br /&gt;
      end;&lt;br /&gt;
&lt;br /&gt;
    for i:=1 step 1 until N do&lt;br /&gt;
      sum:=sum + Data[i];&lt;br /&gt;
    avg:=sum/N;&lt;br /&gt;
    Print Real(avg)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object-oriented structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Object-oriented languages have an important overall goal and foster major design principles.&lt;br /&gt;
====Description====&lt;br /&gt;
Object-oriented structured languages are data-centric, high-level languages. This is in contrast to block structure languages, which are task-centric. Compared to block-structure languages, logical organization of &amp;lt;i&amp;gt;data&amp;lt;/i&amp;gt; and the methods associated with them are emphasized. It is a way of grouping data with executable code. These groups are called &amp;quot;[http://en.wikipedia.org/wiki/Object_(computer_science) objects].&amp;quot; Objects utilize their data and interact with other objects such that a hierarchy is established (called &amp;quot;[http://en.wikipedia.org/wiki/Class_(computer_science) classes]&amp;quot; in popular languages). Toward this end and depending on the language, objects can be interrelated and defined so that their relationships can produce code that is well-organized, easy to read, and reusable.&amp;lt;ref name=&amp;quot;oopref&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Principles====&lt;br /&gt;
=====Encapsulation=====&lt;br /&gt;
Also referred to as &amp;quot;data hiding,&amp;quot; [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) encapsulation] shields the programmer from the implementation details of an object. These implementation details would include [http://en.wikipedia.org/wiki/Local_variable private variables], special [http://en.wikipedia.org/wiki/Library_(computing) libraries], and [http://en.wikipedia.org/wiki/Data_structure data structures] that the programmer does not need to know in order to utilize the functionality offered by the object.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation (object-oriented programming)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Inheritance=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance] introduces the idea of objects sharing functionality in data or methods that are common. [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses Subclasses] can inherit data structures, functions, and attributes of their [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses superclasses] in order to create an object or [http://en.wikipedia.org/wiki/Class_hierarchy class hierarchy] that is effective in organizing data and methods in a logical manner.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance (computer science)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Polymorphism=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism] describes the idea of interfaces, where one data type can be defined that allows other dissimilar types to implement a common set of [http://en.wikipedia.org/wiki/Method_(computer_programming) methods] and [http://en.wikipedia.org/wiki/Field_(computer_science) fields]. This allows a high level of [http://en.wikipedia.org/wiki/Abstraction_(computer_science) abstraction] that allows programmers to write easily maintainable code.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism in object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===History and transition===&lt;br /&gt;
Early forms of object oriented programming languages were created in the early 1960s with the creation of [http://en.wikipedia.org/wiki/Lisp_(programming_language) LISP] and an early form of ALGOL, with [http://en.wikipedia.org/wiki/Simula Simula 67] signaling the actual beginning of the object-oriented &amp;quot;revolution.&amp;quot; The development of object-oriented languages progressed through other languages like [http://en.wikipedia.org/wiki/Simula Smalltalk] and the archetypal C++ to arrive at many of the object oriented languages we have today.&amp;lt;ref name=&amp;quot;oopref&amp;quot;/&amp;gt; As processing capability has matured, so too have the capabilities of programming languages. More and more though, [http://en.wikipedia.org/wiki/Dynamic_programming_language dynamic programming languages] like [http://en.wikipedia.org/wiki/Ruby_(programming_language) Ruby] are being treated as &amp;quot;true&amp;quot; object-oriented languages because of their rapid prototpying ability and strong [http://en.wikipedia.org/wiki/Object-oriented_analysis_and_design object model].&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
A complete list of object oriented languages is outside the scope of this document, but some major examples are [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo], C++, C#, [http://en.wikipedia.org/wiki/COBOL COBOL 2002], [http://en.wikipedia.org/wiki/F_Sharp_(programming_language) F#], [http://en.wikipedia.org/wiki/Fortran Fortran 2003], Java, [http://en.wikipedia.org/wiki/Matlab MATLAB], [http://en.wikipedia.org/wiki/Objective_c Objective-C], [http://en.wikipedia.org/wiki/PHP PHP 5], [http://en.wikipedia.org/wiki/Python_(programming_language) Python], Ruby, and Visual Basic.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/List_of_object-oriented_programming_languages List of object-oriented programming languages] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
====Object-oriented code example====&lt;br /&gt;
The code snippet given below is a simple example from a purely object-oriented language called Ruby.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class AdderGen&lt;br /&gt;
  def initialize(n)&lt;br /&gt;
    @classVar1 = lambda {|a| n+a}&lt;br /&gt;
    @classVar2 = lambda {|a| a*a}&lt;br /&gt;
  end&lt;br /&gt;
  def addVal(a)&lt;br /&gt;
    return @classVar1.call(a)&lt;br /&gt;
  end&lt;br /&gt;
  def squareVal(a)&lt;br /&gt;
    return @classVar2.call(a)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&lt;br /&gt;
a = AdderGen.new(5)&lt;br /&gt;
puts a.addVal(6)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Structure comparison==&lt;br /&gt;
===Advantages and disadvantages===&lt;br /&gt;
==== Block-structured languages ====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* Simplicity&lt;br /&gt;
* Reduced coding and turnover time&lt;br /&gt;
* Dynamic lifetime of variables ([http://en.wikipedia.org/wiki/Scope_(computer_science) Scope]) provide efficient usage of memory since allocation and deletion occur at the entrance and exit of each block&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* Commercial projects are difficult to manage due to very large [http://en.wikipedia.org/wiki/Codebase codebase] sizes&lt;br /&gt;
* Reduced code [http://en.wikipedia.org/wiki/Reusability reusability]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Computer_security Security] concerns, espcially in the realm of [http://en.wikipedia.org/wiki/Array#In_computer_science arrays] and accessing [http://en.wikipedia.org/wiki/Value_(computer_science) elements] that are [http://en.wikipedia.org/wiki/Privilege_(computing) out of bounds]&lt;br /&gt;
&lt;br /&gt;
====Object-Oriented languages====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* The software objects model real world objects so program composition is well defined and structured&lt;br /&gt;
* Each object's definition and internal implementation is decoupled from other objects, making the system design inherently modular ([http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation])&lt;br /&gt;
* Adding new features becomes easier because of inheritance, allowing the new class to contain the new feature in addition to all old features from the inherited class&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Debugging Debugging] is easier since each object's internal mechanisms are independent of each other, which helps in isolating errors and fixing them&lt;br /&gt;
* Enhanced code reusability&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* The complexity of object-oriented design becomes prohibitive when working on small projects&lt;br /&gt;
* Object-oriented programming paradigm is preferable for dynamic environments rather than simple environments&lt;br /&gt;
* Reduced time efficiency compared to block-structured languages&lt;br /&gt;
&lt;br /&gt;
===Summary of important differences===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Difference&lt;br /&gt;
! Block Structured Languages&lt;br /&gt;
! Object-Oriented Languages&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem approach'''&lt;br /&gt;
| Top-down approach is followed&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Bottom-up] approach is followed&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem focus'''&lt;br /&gt;
| Focus is on the [http://en.wikipedia.org/wiki/Algorithm#Computer_algorithms algorithm] to solve the problem&lt;br /&gt;
| Focus is on getting the object design right&lt;br /&gt;
|-&lt;br /&gt;
| '''View of data and functions'''&lt;br /&gt;
| Views data and functions as separate entities&lt;br /&gt;
| Views data and functions as single entity&lt;br /&gt;
|-&lt;br /&gt;
| '''Cost of maintenance'''&lt;br /&gt;
| Maintenance is costly &lt;br /&gt;
| Maintenance is relatively cheaper&lt;br /&gt;
|-&lt;br /&gt;
| '''Software reuse'''&lt;br /&gt;
| Software reuse is not possible&lt;br /&gt;
| Software reuse is possible &lt;br /&gt;
|-&lt;br /&gt;
| '''Abstraction'''&lt;br /&gt;
| Function abstraction is used&lt;br /&gt;
| Data abstraction is used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Effectiveness and durability of object oriented languages over block structured languages ===&lt;br /&gt;
&lt;br /&gt;
Although block structured languages were simpler and faster for smaller projects, when it comes to large commercial undertaking the manpower and tools required to maintain the code base is very prohibitive. It was very difficult to fix issues, add new features, and at the same time to make sure that the integrity of the code base is intact. Many projects were perpetually stagnant at 90% completion with issues coming up at the eleventh hour. All these problems led to the hastening of the move to object-oriented languages which showed it had the solutions to all the problems that block structured languages could not solve. The following four points are the most important reasons why object-oriented languages were more effective and durable that block structured languages:&lt;br /&gt;
* Maintenance - In block structured languages, especially in large projects, system maintenance became a challenge. Object oriented languages could counter this by providing clear demarcation between the objects and making it easier to work on individual aspects of the system without disturbing the other components.&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Information_hiding Data hiding] - In block structured language system the data usually has global scope. Hence it is very difficult to monitor or supervise data access. This was solved by object-oriented languages by providing data encapsulation. The data and the corresponding attributes are put into a nice little package that was much easier to control and monitor.&lt;br /&gt;
* Code reuse - Object oriented languages are proponents of code reuse. Hence the code size could be reduced sufficiently enough when it comes to large projects to warrant a shift from block structured to object oriented languages.&lt;br /&gt;
* Feature additions - Object oriented languages provide a very cost effective and safe way to add new features to the existing system without causing the whole system to collapse. This feature is very important for large scale software vendors who provide various customizations.&lt;br /&gt;
&lt;br /&gt;
===Applicability between paradigms===&lt;br /&gt;
Object-oriented languages have solved many problems that block structured languages introduced. But all is not lost with block structured languages. They boast some very important features that are needed in any programming language. The simplicity and readability of code in block structured languages are enviable features indeed. Because of this very simplicity we find that block structured languages are very efficient in terms of speed and performance. Such a language would also provide the flexibility in moving legacy block structured systems to the object oriented paradigm seamlessly. A language that can capture both sides of the argument would be a formidable entry into the growing list of programming languages. This explains why we see C++ emerging as one of the most popular object oriented languages. It has both the block structured features of C and the object-oriented concepts built into it, thereby making it a very versatile and efficient programming language.&lt;br /&gt;
&lt;br /&gt;
==C/C++ Code Example==&lt;br /&gt;
{{Expand section}}&lt;br /&gt;
Below is a code example highlighting key differences between a block structured program and an object oriented program all in one source file.&lt;br /&gt;
&amp;lt;pre&amp;gt;// For block structure, leave the below line commented to compile in C&lt;br /&gt;
// For object oriented structure, uncomment the line to compile in C++&lt;br /&gt;
//#define USING_CPP&lt;br /&gt;
&lt;br /&gt;
#ifndef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C standard header files&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define the messages of each persona&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Define the function prototypes for delivering the different messages&lt;br /&gt;
char *getKingMessage();&lt;br /&gt;
char *getJesterMessage();&lt;br /&gt;
char *getPeonMessage();&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Go through and make each function call for...&lt;br /&gt;
	// The King&lt;br /&gt;
	printf(&amp;quot;And now a message from the king: %s\n&amp;quot;, getKingMessage());&lt;br /&gt;
	printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// The Court Jester&lt;br /&gt;
	printf(&amp;quot;And now a message from the court jester: %s\n&amp;quot;, getJesterMessage());&lt;br /&gt;
	printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// A Peon&lt;br /&gt;
	printf(&amp;quot;And now a message from a peon: %s\n&amp;quot;, getPeonMessage());&lt;br /&gt;
	printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
	&lt;br /&gt;
	// Wait for user input before exiting&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the king&lt;br /&gt;
char *getKingMessage()&lt;br /&gt;
{&lt;br /&gt;
	return KING_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the court jester&lt;br /&gt;
char *getJesterMessage()&lt;br /&gt;
{&lt;br /&gt;
	return JESTER_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by all peons&lt;br /&gt;
char *getPeonMessage()&lt;br /&gt;
{&lt;br /&gt;
	return PEON_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#ifdef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C++ standard headers&lt;br /&gt;
#include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define what each persona should say&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Keep all classes clearly separated from other sections of code&lt;br /&gt;
namespace Monarchy&lt;br /&gt;
{&lt;br /&gt;
	// Define a basic class where a person has a label and something they want to say&lt;br /&gt;
	class Person&lt;br /&gt;
	{&lt;br /&gt;
	private:&lt;br /&gt;
		char *szMessage;&lt;br /&gt;
		char *szLabel;&lt;br /&gt;
&lt;br /&gt;
	public:&lt;br /&gt;
		// Allow a person to deliver their message&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			printf(&amp;quot;A now a message from %s: %s\n&amp;quot;, this-&amp;gt;szLabel, this-&amp;gt;szMessage);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// A person needs to be initialized with a label and a message&lt;br /&gt;
		Person(char*label, char *msg)&lt;br /&gt;
		{&lt;br /&gt;
			this-&amp;gt;szLabel = label;&lt;br /&gt;
			this-&amp;gt;szMessage = msg;&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// The King is a person (and thus inherits from it)&lt;br /&gt;
	class King : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// The king has the same label, but his message might change according to the political winds&lt;br /&gt;
		King(char *msg) : Person(&amp;quot;the king&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Here, the function is being overridden...&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			// .. but the base class's DeliverMessage is still being called, in addition to the tag line&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A peon is a person (and thus inherits from it)&lt;br /&gt;
	class Peon : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change according to his or her attitude toward the king&lt;br /&gt;
		Peon(char *msg) : Person(&amp;quot;a peon&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Like above, deliver the message, but always provide a common tag line&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A jester is a person (and thus inherits from it)&lt;br /&gt;
	class Jester : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change if the king is sick of his jokes&lt;br /&gt;
		Jester(char *msg) : Person(&amp;quot;the court jester&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Might as well call him Fozzie ;)&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Initialize some monarchy objects&lt;br /&gt;
	Monarchy::King TheKing(KING_MESSAGE);&lt;br /&gt;
	Monarchy::Jester Borat(JESTER_MESSAGE);&lt;br /&gt;
	Monarchy::Peon Bruno(PEON_MESSAGE);&lt;br /&gt;
&lt;br /&gt;
	// Let them deliver their messages&lt;br /&gt;
	TheKing.DeliverMessage();&lt;br /&gt;
	Borat.DeliverMessage();&lt;br /&gt;
	Bruno.DeliverMessage();&lt;br /&gt;
&lt;br /&gt;
	// Wait for user input&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
#endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Imperative_programming Imperative programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Functional_programming Functional programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Programming_paradigm Programming paradigm] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Class-based_programming Class-based programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Prototype-based_programming Prototype-based programming] at Wikipedia&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further reading==&lt;br /&gt;
* Freeman, Eric, Elisabeth Freeman, Kathy Sierra, and Bert Bates. ''Head First Design Patterns''. Sebastopol, CA: O'Reilly, 2004. Print.&lt;br /&gt;
* Liberty, Jesse. ''Sams Teach Yourself C++ in 24 Hours''. Indianapolis, IN: Sams, 2002. Print.&lt;br /&gt;
* ''Microsoft Visual C++ Language Reference''. Redmond, WA: Microsoft, 1997. Print.&lt;br /&gt;
* Weiss, Mark Allen. ''Data Structures &amp;amp; Algorithm Analysis in Java''. Reading, MA: Addison-Wesley, 1999. Print.&lt;br /&gt;
* Mohamed Fayad, Mauri Laitinen. &amp;quot;TRANSITION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://www.slideshare.net/spajus/object-oriented-programming-presentation-933801 Object Oriented Programming] at slide'''share'''&lt;br /&gt;
* [http://www.developer.com/java/other/article.php/3493761/The-Evolution-of-Object-Oriented-Languages.htm The Evolution of Object-Oriented Languages]&lt;br /&gt;
* [http://www.xp2003.org/the-history-of-oop.htm The History of OOP]&lt;br /&gt;
* [http://www.brighthub.com/internet/web-development/articles/82024.aspx Structured vs. Object-Oriented Programming: A Comparison]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48695</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1e sa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48695"/>
		<updated>2011-09-15T20:55:06Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Block structure */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;'''Block vs Object-Oriented Programming Languages'''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
In computer science, computer programming languages exhibit variance in syntax and structure in order to effectively solve problems. Two of these variances can be seen between '''block structure''' and '''object-oriented structure'''. A programming language with block structure allows the programmer to group lines of code for convenient use throughout the rest of the program. Object-oriented structure meanwhile goes further to allow the programmer to associate data with its actions in a hierarchical manner. Object-oriented structure has many advantages which generally make it more effective and durable than block-structured languages, but object-oriented languages also benefit from the core ideas present in block structure programming.&lt;br /&gt;
&lt;br /&gt;
==Block structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Block-structured programming languages are task-centric, high-level languages. Operations on data sets are emphasized in an attempt to logically organize program operation. The design and implementation involves breaking down the problem into discrete blocks or units which can be nested to any depth or not at all. Each block generally consists of a set of delimiters such as braces or keywords that separate them from other blocks. Each of these blocks contains a set of (optional) declarations and logic to solve a particular problem. Declarations inside of nested blocks introduces the concept of variable scope, which frees the programmer from having to worry about name collisions and other variable maintenance tasks.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Block_(programming) Block (programming)] at Wikipedia&amp;lt;/ref&amp;gt; A [[CSC/ECE_517_Fall_2011/ch1_1e_sa#C.2FC.2B.2B_Code_Example|code example]] of a block structured program is provided later in the article.&lt;br /&gt;
&lt;br /&gt;
Overall, block-structured languages can be summarized as having the following features:&lt;br /&gt;
* Modular - Lines of code/functionality are grouped together&lt;br /&gt;
* Scoped - Variables are limited to the group of code they are declared in&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Top down] - Modules are created as necessary to meet the program's requirements &lt;br /&gt;
* Simple - It is generally simpler to &amp;quot;cobble together&amp;quot; modules of code that accomplish a simple, well-defined task.&lt;br /&gt;
&lt;br /&gt;
===History===&lt;br /&gt;
Block-structured languages were first conceived in the 1950s with the advent of [http://en.wikipedia.org/wiki/ALGOL ALGOL], one of the first [http://en.wikipedia.org/wiki/Imperative_programming imperative programming languages]. An evolution of block structuring was created as the &amp;quot;GOTO&amp;quot; logic of programs became more and more difficult to understand and maintain. In 1968, famed computer scientist [http://en.wikipedia.org/wiki/Edsger_W._Dijkstra Edsger Dijkstra] wrote [http://dx.doi.org/10.1145%2F362929.362947 a letter] and [http://dx.doi.org/10.1145%2F355604.361591 follow-up article] on the ideas and motivation behind &amp;quot;[http://en.wikipedia.org/wiki/Structured_programming structured programming],&amp;quot; where the program exhibits “[http://en.wikipedia.org/wiki/Separation_of_concerns separation of concerns],&amp;quot; single point of entry but multiple points of exit, and ideas of data structures. It was Dijkstra’s and others’ which helped propel this basic idea of block structure programming into the mainstream.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Structured_programming Structured programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
Block-structured programming languages dominate the general purpose, imperative programming language arena. Indeed most programming languages in modern use enjoy some of the benefits of block structure with grouping of code and scope of variables. Indeed, ignoring their object-oriented aspects, all of [http://en.wikipedia.org/wiki/C_(programming_language) C], [http://en.wikipedia.org/wiki/C%2B%2B C++], [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#], [http://en.wikipedia.org/wiki/Java_(programming_language) Java], [http://en.wikipedia.org/wiki/PHP PHP] and [http://en.wikipedia.org/wiki/Visual_Basic Visual Basic] – for example – contain elements of block structure.&lt;br /&gt;
====Block Structured code example====&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin&lt;br /&gt;
  integer N;&lt;br /&gt;
  Read Int(N);&lt;br /&gt;
&lt;br /&gt;
  begin&lt;br /&gt;
    real array Data[1:N];&lt;br /&gt;
    real sum, avg;&lt;br /&gt;
    integer i;&lt;br /&gt;
    sum:=0;&lt;br /&gt;
&lt;br /&gt;
    for i:=1 step 1 until N do&lt;br /&gt;
      begin real val;&lt;br /&gt;
        Read Real(val);&lt;br /&gt;
        Data[i]:=if val&amp;lt;0 then -val else val&lt;br /&gt;
      end;&lt;br /&gt;
&lt;br /&gt;
    for i:=1 step 1 until N do&lt;br /&gt;
      sum:=sum + Data[i];&lt;br /&gt;
    avg:=sum/N;&lt;br /&gt;
    Print Real(avg)&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Object-oriented structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Object-oriented languages have an important overall goal and foster major design principles.&lt;br /&gt;
====Description====&lt;br /&gt;
Object-oriented structured languages are data-centric, high-level languages. This is in contrast to block structure languages, which are task-centric. Compared to block-structure languages, logical organization of &amp;lt;i&amp;gt;data&amp;lt;/i&amp;gt; and the methods associated with them are emphasized. It is a way of grouping data with executable code. These groups are called &amp;quot;[http://en.wikipedia.org/wiki/Object_(computer_science) objects].&amp;quot; Objects utilize their data and interact with other objects such that a hierarchy is established (called &amp;quot;[http://en.wikipedia.org/wiki/Class_(computer_science) classes]&amp;quot; in popular languages). Toward this end and depending on the language, objects can be interrelated and defined so that their relationships can produce code that is well-organized, easy to read, and reusable.&amp;lt;ref name=&amp;quot;oopref&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Principles====&lt;br /&gt;
=====Encapsulation=====&lt;br /&gt;
Also referred to as &amp;quot;data hiding,&amp;quot; [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) encapsulation] shields the programmer from the implementation details of an object. These implementation details would include [http://en.wikipedia.org/wiki/Local_variable private variables], special [http://en.wikipedia.org/wiki/Library_(computing) libraries], and [http://en.wikipedia.org/wiki/Data_structure data structures] that the programmer does not need to know in order to utilize the functionality offered by the object.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation (object-oriented programming)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Inheritance=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance] introduces the idea of objects sharing functionality in data or methods that are common. [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses Subclasses] can inherit data structures, functions, and attributes of their [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses superclasses] in order to create an object or [http://en.wikipedia.org/wiki/Class_hierarchy class hierarchy] that is effective in organizing data and methods in a logical manner.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance (computer science)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Polymorphism=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism] describes the idea of interfaces, where one data type can be defined that allows other dissimilar types to implement a common set of [http://en.wikipedia.org/wiki/Method_(computer_programming) methods] and [http://en.wikipedia.org/wiki/Field_(computer_science) fields]. This allows a high level of [http://en.wikipedia.org/wiki/Abstraction_(computer_science) abstraction] that allows programmers to write easily maintainable code.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism in object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===History and transition===&lt;br /&gt;
Early forms of object oriented programming languages were created in the early 1960s with the creation of [http://en.wikipedia.org/wiki/Lisp_(programming_language) LISP] and an early form of ALGOL, with [http://en.wikipedia.org/wiki/Simula Simula 67] signaling the actual beginning of the object-oriented &amp;quot;revolution.&amp;quot; The development of object-oriented languages progressed through other languages like [http://en.wikipedia.org/wiki/Simula Smalltalk] and the archetypal C++ to arrive at many of the object oriented languages we have today.&amp;lt;ref name=&amp;quot;oopref&amp;quot;/&amp;gt; As processing capability has matured, so too have the capabilities of programming languages. More and more though, [http://en.wikipedia.org/wiki/Dynamic_programming_language dynamic programming languages] like [http://en.wikipedia.org/wiki/Ruby_(programming_language) Ruby] are being treated as &amp;quot;true&amp;quot; object-oriented languages because of their rapid prototpying ability and strong [http://en.wikipedia.org/wiki/Object-oriented_analysis_and_design object model].&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
A complete list of object oriented languages is outside the scope of this document, but some major examples are [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo], C++, C#, [http://en.wikipedia.org/wiki/COBOL COBOL 2002], [http://en.wikipedia.org/wiki/F_Sharp_(programming_language) F#], [http://en.wikipedia.org/wiki/Fortran Fortran 2003], Java, [http://en.wikipedia.org/wiki/Matlab MATLAB], [http://en.wikipedia.org/wiki/Objective_c Objective-C], [http://en.wikipedia.org/wiki/PHP PHP 5], [http://en.wikipedia.org/wiki/Python_(programming_language) Python], Ruby, and Visual Basic.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/List_of_object-oriented_programming_languages List of object-oriented programming languages] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Structure comparison==&lt;br /&gt;
===Advantages and disadvantages===&lt;br /&gt;
==== Block-structured languages ====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* Simplicity&lt;br /&gt;
* Reduced coding and turnover time&lt;br /&gt;
* Dynamic lifetime of variables ([http://en.wikipedia.org/wiki/Scope_(computer_science) Scope]) provide efficient usage of memory since allocation and deletion occur at the entrance and exit of each block&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* Commercial projects are difficult to manage due to very large [http://en.wikipedia.org/wiki/Codebase codebase] sizes&lt;br /&gt;
* Reduced code [http://en.wikipedia.org/wiki/Reusability reusability]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Computer_security Security] concerns, espcially in the realm of [http://en.wikipedia.org/wiki/Array#In_computer_science arrays] and accessing [http://en.wikipedia.org/wiki/Value_(computer_science) elements] that are [http://en.wikipedia.org/wiki/Privilege_(computing) out of bounds]&lt;br /&gt;
&lt;br /&gt;
====Object-Oriented languages====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* The software objects model real world objects so program composition is well defined and structured&lt;br /&gt;
* Each object's definition and internal implementation is decoupled from other objects, making the system design inherently modular ([http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation])&lt;br /&gt;
* Adding new features becomes easier because of inheritance, allowing the new class to contain the new feature in addition to all old features from the inherited class&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Debugging Debugging] is easier since each object's internal mechanisms are independent of each other, which helps in isolating errors and fixing them&lt;br /&gt;
* Enhanced code reusability&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* The complexity of object-oriented design becomes prohibitive when working on small projects&lt;br /&gt;
* Object-oriented programming paradigm is preferable for dynamic environments rather than simple environments&lt;br /&gt;
* Reduced time efficiency compared to block-structured languages&lt;br /&gt;
&lt;br /&gt;
===Summary of important differences===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Difference&lt;br /&gt;
! Block Structured Languages&lt;br /&gt;
! Object-Oriented Languages&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem approach'''&lt;br /&gt;
| Top-down approach is followed&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Bottom-up] approach is followed&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem focus'''&lt;br /&gt;
| Focus is on the [http://en.wikipedia.org/wiki/Algorithm#Computer_algorithms algorithm] to solve the problem&lt;br /&gt;
| Focus is on getting the object design right&lt;br /&gt;
|-&lt;br /&gt;
| '''View of data and functions'''&lt;br /&gt;
| Views data and functions as separate entities&lt;br /&gt;
| Views data and functions as single entity&lt;br /&gt;
|-&lt;br /&gt;
| '''Cost of maintenance'''&lt;br /&gt;
| Maintenance is costly &lt;br /&gt;
| Maintenance is relatively cheaper&lt;br /&gt;
|-&lt;br /&gt;
| '''Software reuse'''&lt;br /&gt;
| Software reuse is not possible&lt;br /&gt;
| Software reuse is possible &lt;br /&gt;
|-&lt;br /&gt;
| '''Abstraction'''&lt;br /&gt;
| Function abstraction is used&lt;br /&gt;
| Data abstraction is used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Effectiveness and durability of object oriented languages over block structured languages ===&lt;br /&gt;
&lt;br /&gt;
Although block structured languages were simpler and faster for smaller projects, when it comes to large commercial undertaking the manpower and tools required to maintain the code base is very prohibitive. It was very difficult to fix issues, add new features, and at the same time to make sure that the integrity of the code base is intact. Many projects were perpetually stagnant at 90% completion with issues coming up at the eleventh hour. All these problems led to the hastening of the move to object-oriented languages which showed it had the solutions to all the problems that block structured languages could not solve. The following four points are the most important reasons why object-oriented languages were more effective and durable that block structured languages:&lt;br /&gt;
* Maintenance - In block structured languages, especially in large projects, system maintenance became a challenge. Object oriented languages could counter this by providing clear demarcation between the objects and making it easier to work on individual aspects of the system without disturbing the other components.&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Information_hiding Data hiding] - In block structured language system the data usually has global scope. Hence it is very difficult to monitor or supervise data access. This was solved by object-oriented languages by providing data encapsulation. The data and the corresponding attributes are put into a nice little package that was much easier to control and monitor.&lt;br /&gt;
* Code reuse - Object oriented languages are proponents of code reuse. Hence the code size could be reduced sufficiently enough when it comes to large projects to warrant a shift from block structured to object oriented languages.&lt;br /&gt;
* Feature additions - Object oriented languages provide a very cost effective and safe way to add new features to the existing system without causing the whole system to collapse. This feature is very important for large scale software vendors who provide various customizations.&lt;br /&gt;
&lt;br /&gt;
===Applicability between paradigms===&lt;br /&gt;
Object-oriented languages have solved many problems that block structured languages introduced. But all is not lost with block structured languages. They boast some very important features that are needed in any programming language. The simplicity and readability of code in block structured languages are enviable features indeed. Because of this very simplicity we find that block structured languages are very efficient in terms of speed and performance. Such a language would also provide the flexibility in moving legacy block structured systems to the object oriented paradigm seamlessly. A language that can capture both sides of the argument would be a formidable entry into the growing list of programming languages. This explains why we see C++ emerging as one of the most popular object oriented languages. It has both the block structured features of C and the object-oriented concepts built into it, thereby making it a very versatile and efficient programming language.&lt;br /&gt;
&lt;br /&gt;
==C/C++ Code Example==&lt;br /&gt;
{{Expand section}}&lt;br /&gt;
Below is a code example highlighting key differences between a block structured program and an object oriented program all in one source file.&lt;br /&gt;
&amp;lt;pre&amp;gt;// For block structure, leave the below line commented to compile in C&lt;br /&gt;
// For object oriented structure, uncomment the line to compile in C++&lt;br /&gt;
//#define USING_CPP&lt;br /&gt;
&lt;br /&gt;
#ifndef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C standard header files&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define the messages of each persona&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Define the function prototypes for delivering the different messages&lt;br /&gt;
char *getKingMessage();&lt;br /&gt;
char *getJesterMessage();&lt;br /&gt;
char *getPeonMessage();&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Go through and make each function call for...&lt;br /&gt;
	// The King&lt;br /&gt;
	printf(&amp;quot;And now a message from the king: %s\n&amp;quot;, getKingMessage());&lt;br /&gt;
	printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// The Court Jester&lt;br /&gt;
	printf(&amp;quot;And now a message from the court jester: %s\n&amp;quot;, getJesterMessage());&lt;br /&gt;
	printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// A Peon&lt;br /&gt;
	printf(&amp;quot;And now a message from a peon: %s\n&amp;quot;, getPeonMessage());&lt;br /&gt;
	printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
	&lt;br /&gt;
	// Wait for user input before exiting&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the king&lt;br /&gt;
char *getKingMessage()&lt;br /&gt;
{&lt;br /&gt;
	return KING_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the court jester&lt;br /&gt;
char *getJesterMessage()&lt;br /&gt;
{&lt;br /&gt;
	return JESTER_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by all peons&lt;br /&gt;
char *getPeonMessage()&lt;br /&gt;
{&lt;br /&gt;
	return PEON_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#ifdef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C++ standard headers&lt;br /&gt;
#include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define what each persona should say&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Keep all classes clearly separated from other sections of code&lt;br /&gt;
namespace Monarchy&lt;br /&gt;
{&lt;br /&gt;
	// Define a basic class where a person has a label and something they want to say&lt;br /&gt;
	class Person&lt;br /&gt;
	{&lt;br /&gt;
	private:&lt;br /&gt;
		char *szMessage;&lt;br /&gt;
		char *szLabel;&lt;br /&gt;
&lt;br /&gt;
	public:&lt;br /&gt;
		// Allow a person to deliver their message&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			printf(&amp;quot;A now a message from %s: %s\n&amp;quot;, this-&amp;gt;szLabel, this-&amp;gt;szMessage);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// A person needs to be initialized with a label and a message&lt;br /&gt;
		Person(char*label, char *msg)&lt;br /&gt;
		{&lt;br /&gt;
			this-&amp;gt;szLabel = label;&lt;br /&gt;
			this-&amp;gt;szMessage = msg;&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// The King is a person (and thus inherits from it)&lt;br /&gt;
	class King : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// The king has the same label, but his message might change according to the political winds&lt;br /&gt;
		King(char *msg) : Person(&amp;quot;the king&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Here, the function is being overridden...&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			// .. but the base class's DeliverMessage is still being called, in addition to the tag line&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A peon is a person (and thus inherits from it)&lt;br /&gt;
	class Peon : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change according to his or her attitude toward the king&lt;br /&gt;
		Peon(char *msg) : Person(&amp;quot;a peon&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Like above, deliver the message, but always provide a common tag line&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A jester is a person (and thus inherits from it)&lt;br /&gt;
	class Jester : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change if the king is sick of his jokes&lt;br /&gt;
		Jester(char *msg) : Person(&amp;quot;the court jester&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Might as well call him Fozzie ;)&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Initialize some monarchy objects&lt;br /&gt;
	Monarchy::King TheKing(KING_MESSAGE);&lt;br /&gt;
	Monarchy::Jester Borat(JESTER_MESSAGE);&lt;br /&gt;
	Monarchy::Peon Bruno(PEON_MESSAGE);&lt;br /&gt;
&lt;br /&gt;
	// Let them deliver their messages&lt;br /&gt;
	TheKing.DeliverMessage();&lt;br /&gt;
	Borat.DeliverMessage();&lt;br /&gt;
	Bruno.DeliverMessage();&lt;br /&gt;
&lt;br /&gt;
	// Wait for user input&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
#endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Imperative_programming Imperative programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Functional_programming Functional programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Programming_paradigm Programming paradigm] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Class-based_programming Class-based programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Prototype-based_programming Prototype-based programming] at Wikipedia&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further reading==&lt;br /&gt;
* Freeman, Eric, Elisabeth Freeman, Kathy Sierra, and Bert Bates. ''Head First Design Patterns''. Sebastopol, CA: O'Reilly, 2004. Print.&lt;br /&gt;
* Liberty, Jesse. ''Sams Teach Yourself C++ in 24 Hours''. Indianapolis, IN: Sams, 2002. Print.&lt;br /&gt;
* ''Microsoft Visual C++ Language Reference''. Redmond, WA: Microsoft, 1997. Print.&lt;br /&gt;
* Weiss, Mark Allen. ''Data Structures &amp;amp; Algorithm Analysis in Java''. Reading, MA: Addison-Wesley, 1999. Print.&lt;br /&gt;
* Mohamed Fayad, Mauri Laitinen. &amp;quot;TRANSITION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://www.slideshare.net/spajus/object-oriented-programming-presentation-933801 Object Oriented Programming] at slide'''share'''&lt;br /&gt;
* [http://www.developer.com/java/other/article.php/3493761/The-Evolution-of-Object-Oriented-Languages.htm The Evolution of Object-Oriented Languages]&lt;br /&gt;
* [http://www.xp2003.org/the-history-of-oop.htm The History of OOP]&lt;br /&gt;
* [http://www.brighthub.com/internet/web-development/articles/82024.aspx Structured vs. Object-Oriented Programming: A Comparison]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48694</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1e sa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48694"/>
		<updated>2011-09-15T20:51:22Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Effectiveness and durability of object oriented languages over block structured languages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;'''Block vs Object-Oriented Programming Languages'''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
In computer science, computer programming languages exhibit variance in syntax and structure in order to effectively solve problems. Two of these variances can be seen between '''block structure''' and '''object-oriented structure'''. A programming language with block structure allows the programmer to group lines of code for convenient use throughout the rest of the program. Object-oriented structure meanwhile goes further to allow the programmer to associate data with its actions in a hierarchical manner. Object-oriented structure has many advantages which generally make it more effective and durable than block-structured languages, but object-oriented languages also benefit from the core ideas present in block structure programming.&lt;br /&gt;
&lt;br /&gt;
==Block structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Block-structured programming languages are task-centric, high-level languages. Operations on data sets are emphasized in an attempt to logically organize program operation. The design and implementation involves breaking down the problem into discrete blocks or units which can be nested to any depth or not at all. Each block generally consists of a set of delimiters such as braces or keywords that separate them from other blocks. Each of these blocks contains a set of (optional) declarations and logic to solve a particular problem. Declarations inside of nested blocks introduces the concept of variable scope, which frees the programmer from having to worry about name collisions and other variable maintenance tasks.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Block_(programming) Block (programming)] at Wikipedia&amp;lt;/ref&amp;gt; A [[CSC/ECE_517_Fall_2011/ch1_1e_sa#C.2FC.2B.2B_Code_Example|code example]] of a block structured program is provided later in the article.&lt;br /&gt;
&lt;br /&gt;
Overall, block-structured languages can be summarized as having the following features:&lt;br /&gt;
* Modular - Lines of code/functionality are grouped together&lt;br /&gt;
* Scoped - Variables are limited to the group of code they are declared in&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Top down] - Modules are created as necessary to meet the program's requirements &lt;br /&gt;
* Simple - It is generally simpler to &amp;quot;cobble together&amp;quot; modules of code that accomplish a simple, well-defined task.&lt;br /&gt;
&lt;br /&gt;
===History===&lt;br /&gt;
Block-structured languages were first conceived in the 1950s with the advent of [http://en.wikipedia.org/wiki/ALGOL ALGOL], one of the first [http://en.wikipedia.org/wiki/Imperative_programming imperative programming languages]. An evolution of block structuring was created as the &amp;quot;GOTO&amp;quot; logic of programs became more and more difficult to understand and maintain. In 1968, famed computer scientist [http://en.wikipedia.org/wiki/Edsger_W._Dijkstra Edsger Dijkstra] wrote [http://dx.doi.org/10.1145%2F362929.362947 a letter] and [http://dx.doi.org/10.1145%2F355604.361591 follow-up article] on the ideas and motivation behind &amp;quot;[http://en.wikipedia.org/wiki/Structured_programming structured programming],&amp;quot; where the program exhibits “[http://en.wikipedia.org/wiki/Separation_of_concerns separation of concerns],&amp;quot; single point of entry but multiple points of exit, and ideas of data structures. It was Dijkstra’s and others’ which helped propel this basic idea of block structure programming into the mainstream.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Structured_programming Structured programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
Block-structured programming languages dominate the general purpose, imperative programming language arena. Indeed most programming languages in modern use enjoy some of the benefits of block structure with grouping of code and scope of variables. Indeed, ignoring their object-oriented aspects, all of [http://en.wikipedia.org/wiki/C_(programming_language) C], [http://en.wikipedia.org/wiki/C%2B%2B C++], [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#], [http://en.wikipedia.org/wiki/Java_(programming_language) Java], [http://en.wikipedia.org/wiki/PHP PHP] and [http://en.wikipedia.org/wiki/Visual_Basic Visual Basic] – for example – contain elements of block structure.&lt;br /&gt;
&lt;br /&gt;
==Object-oriented structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Object-oriented languages have an important overall goal and foster major design principles.&lt;br /&gt;
====Description====&lt;br /&gt;
Object-oriented structured languages are data-centric, high-level languages. This is in contrast to block structure languages, which are task-centric. Compared to block-structure languages, logical organization of &amp;lt;i&amp;gt;data&amp;lt;/i&amp;gt; and the methods associated with them are emphasized. It is a way of grouping data with executable code. These groups are called &amp;quot;[http://en.wikipedia.org/wiki/Object_(computer_science) objects].&amp;quot; Objects utilize their data and interact with other objects such that a hierarchy is established (called &amp;quot;[http://en.wikipedia.org/wiki/Class_(computer_science) classes]&amp;quot; in popular languages). Toward this end and depending on the language, objects can be interrelated and defined so that their relationships can produce code that is well-organized, easy to read, and reusable.&amp;lt;ref name=&amp;quot;oopref&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Principles====&lt;br /&gt;
=====Encapsulation=====&lt;br /&gt;
Also referred to as &amp;quot;data hiding,&amp;quot; [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) encapsulation] shields the programmer from the implementation details of an object. These implementation details would include [http://en.wikipedia.org/wiki/Local_variable private variables], special [http://en.wikipedia.org/wiki/Library_(computing) libraries], and [http://en.wikipedia.org/wiki/Data_structure data structures] that the programmer does not need to know in order to utilize the functionality offered by the object.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation (object-oriented programming)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Inheritance=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance] introduces the idea of objects sharing functionality in data or methods that are common. [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses Subclasses] can inherit data structures, functions, and attributes of their [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses superclasses] in order to create an object or [http://en.wikipedia.org/wiki/Class_hierarchy class hierarchy] that is effective in organizing data and methods in a logical manner.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance (computer science)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Polymorphism=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism] describes the idea of interfaces, where one data type can be defined that allows other dissimilar types to implement a common set of [http://en.wikipedia.org/wiki/Method_(computer_programming) methods] and [http://en.wikipedia.org/wiki/Field_(computer_science) fields]. This allows a high level of [http://en.wikipedia.org/wiki/Abstraction_(computer_science) abstraction] that allows programmers to write easily maintainable code.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism in object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===History and transition===&lt;br /&gt;
Early forms of object oriented programming languages were created in the early 1960s with the creation of [http://en.wikipedia.org/wiki/Lisp_(programming_language) LISP] and an early form of ALGOL, with [http://en.wikipedia.org/wiki/Simula Simula 67] signaling the actual beginning of the object-oriented &amp;quot;revolution.&amp;quot; The development of object-oriented languages progressed through other languages like [http://en.wikipedia.org/wiki/Simula Smalltalk] and the archetypal C++ to arrive at many of the object oriented languages we have today.&amp;lt;ref name=&amp;quot;oopref&amp;quot;/&amp;gt; As processing capability has matured, so too have the capabilities of programming languages. More and more though, [http://en.wikipedia.org/wiki/Dynamic_programming_language dynamic programming languages] like [http://en.wikipedia.org/wiki/Ruby_(programming_language) Ruby] are being treated as &amp;quot;true&amp;quot; object-oriented languages because of their rapid prototpying ability and strong [http://en.wikipedia.org/wiki/Object-oriented_analysis_and_design object model].&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
A complete list of object oriented languages is outside the scope of this document, but some major examples are [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo], C++, C#, [http://en.wikipedia.org/wiki/COBOL COBOL 2002], [http://en.wikipedia.org/wiki/F_Sharp_(programming_language) F#], [http://en.wikipedia.org/wiki/Fortran Fortran 2003], Java, [http://en.wikipedia.org/wiki/Matlab MATLAB], [http://en.wikipedia.org/wiki/Objective_c Objective-C], [http://en.wikipedia.org/wiki/PHP PHP 5], [http://en.wikipedia.org/wiki/Python_(programming_language) Python], Ruby, and Visual Basic.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/List_of_object-oriented_programming_languages List of object-oriented programming languages] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Structure comparison==&lt;br /&gt;
===Advantages and disadvantages===&lt;br /&gt;
==== Block-structured languages ====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* Simplicity&lt;br /&gt;
* Reduced coding and turnover time&lt;br /&gt;
* Dynamic lifetime of variables ([http://en.wikipedia.org/wiki/Scope_(computer_science) Scope]) provide efficient usage of memory since allocation and deletion occur at the entrance and exit of each block&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* Commercial projects are difficult to manage due to very large [http://en.wikipedia.org/wiki/Codebase codebase] sizes&lt;br /&gt;
* Reduced code [http://en.wikipedia.org/wiki/Reusability reusability]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Computer_security Security] concerns, espcially in the realm of [http://en.wikipedia.org/wiki/Array#In_computer_science arrays] and accessing [http://en.wikipedia.org/wiki/Value_(computer_science) elements] that are [http://en.wikipedia.org/wiki/Privilege_(computing) out of bounds]&lt;br /&gt;
&lt;br /&gt;
====Object-Oriented languages====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* The software objects model real world objects so program composition is well defined and structured&lt;br /&gt;
* Each object's definition and internal implementation is decoupled from other objects, making the system design inherently modular ([http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation])&lt;br /&gt;
* Adding new features becomes easier because of inheritance, allowing the new class to contain the new feature in addition to all old features from the inherited class&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Debugging Debugging] is easier since each object's internal mechanisms are independent of each other, which helps in isolating errors and fixing them&lt;br /&gt;
* Enhanced code reusability&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* The complexity of object-oriented design becomes prohibitive when working on small projects&lt;br /&gt;
* Object-oriented programming paradigm is preferable for dynamic environments rather than simple environments&lt;br /&gt;
* Reduced time efficiency compared to block-structured languages&lt;br /&gt;
&lt;br /&gt;
===Summary of important differences===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Difference&lt;br /&gt;
! Block Structured Languages&lt;br /&gt;
! Object-Oriented Languages&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem approach'''&lt;br /&gt;
| Top-down approach is followed&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Bottom-up] approach is followed&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem focus'''&lt;br /&gt;
| Focus is on the [http://en.wikipedia.org/wiki/Algorithm#Computer_algorithms algorithm] to solve the problem&lt;br /&gt;
| Focus is on getting the object design right&lt;br /&gt;
|-&lt;br /&gt;
| '''View of data and functions'''&lt;br /&gt;
| Views data and functions as separate entities&lt;br /&gt;
| Views data and functions as single entity&lt;br /&gt;
|-&lt;br /&gt;
| '''Cost of maintenance'''&lt;br /&gt;
| Maintenance is costly &lt;br /&gt;
| Maintenance is relatively cheaper&lt;br /&gt;
|-&lt;br /&gt;
| '''Software reuse'''&lt;br /&gt;
| Software reuse is not possible&lt;br /&gt;
| Software reuse is possible &lt;br /&gt;
|-&lt;br /&gt;
| '''Abstraction'''&lt;br /&gt;
| Function abstraction is used&lt;br /&gt;
| Data abstraction is used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Effectiveness and durability of object oriented languages over block structured languages ===&lt;br /&gt;
&lt;br /&gt;
Although block structured languages were simpler and faster for smaller projects, when it comes to large commercial undertaking the manpower and tools required to maintain the code base is very prohibitive. It was very difficult to fix issues, add new features, and at the same time to make sure that the integrity of the code base is intact. Many projects were perpetually stagnant at 90% completion with issues coming up at the eleventh hour. All these problems led to the hastening of the move to object-oriented languages which showed it had the solutions to all the problems that block structured languages could not solve. The following four points are the most important reasons why object-oriented languages were more effective and durable that block structured languages:&lt;br /&gt;
* Maintenance - In block structured languages, especially in large projects, system maintenance became a challenge. Object oriented languages could counter this by providing clear demarcation between the objects and making it easier to work on individual aspects of the system without disturbing the other components.&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Information_hiding Data hiding] - In block structured language system the data usually has global scope. Hence it is very difficult to monitor or supervise data access. This was solved by object-oriented languages by providing data encapsulation. The data and the corresponding attributes are put into a nice little package that was much easier to control and monitor.&lt;br /&gt;
* Code reuse - Object oriented languages are proponents of code reuse. Hence the code size could be reduced sufficiently enough when it comes to large projects to warrant a shift from block structured to object oriented languages.&lt;br /&gt;
* Feature additions - Object oriented languages provide a very cost effective and safe way to add new features to the existing system without causing the whole system to collapse. This feature is very important for large scale software vendors who provide various customizations.&lt;br /&gt;
&lt;br /&gt;
===Applicability between paradigms===&lt;br /&gt;
Object-oriented languages have solved many problems that block structured languages introduced. But all is not lost with block structured languages. They boast some very important features that are needed in any programming language. The simplicity and readability of code in block structured languages are enviable features indeed. Because of this very simplicity we find that block structured languages are very efficient in terms of speed and performance. Such a language would also provide the flexibility in moving legacy block structured systems to the object oriented paradigm seamlessly. A language that can capture both sides of the argument would be a formidable entry into the growing list of programming languages. This explains why we see C++ emerging as one of the most popular object oriented languages. It has both the block structured features of C and the object-oriented concepts built into it, thereby making it a very versatile and efficient programming language.&lt;br /&gt;
&lt;br /&gt;
==C/C++ Code Example==&lt;br /&gt;
{{Expand section}}&lt;br /&gt;
Below is a code example highlighting key differences between a block structured program and an object oriented program all in one source file.&lt;br /&gt;
&amp;lt;pre&amp;gt;// For block structure, leave the below line commented to compile in C&lt;br /&gt;
// For object oriented structure, uncomment the line to compile in C++&lt;br /&gt;
//#define USING_CPP&lt;br /&gt;
&lt;br /&gt;
#ifndef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C standard header files&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define the messages of each persona&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Define the function prototypes for delivering the different messages&lt;br /&gt;
char *getKingMessage();&lt;br /&gt;
char *getJesterMessage();&lt;br /&gt;
char *getPeonMessage();&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Go through and make each function call for...&lt;br /&gt;
	// The King&lt;br /&gt;
	printf(&amp;quot;And now a message from the king: %s\n&amp;quot;, getKingMessage());&lt;br /&gt;
	printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// The Court Jester&lt;br /&gt;
	printf(&amp;quot;And now a message from the court jester: %s\n&amp;quot;, getJesterMessage());&lt;br /&gt;
	printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// A Peon&lt;br /&gt;
	printf(&amp;quot;And now a message from a peon: %s\n&amp;quot;, getPeonMessage());&lt;br /&gt;
	printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
	&lt;br /&gt;
	// Wait for user input before exiting&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the king&lt;br /&gt;
char *getKingMessage()&lt;br /&gt;
{&lt;br /&gt;
	return KING_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the court jester&lt;br /&gt;
char *getJesterMessage()&lt;br /&gt;
{&lt;br /&gt;
	return JESTER_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by all peons&lt;br /&gt;
char *getPeonMessage()&lt;br /&gt;
{&lt;br /&gt;
	return PEON_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#ifdef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C++ standard headers&lt;br /&gt;
#include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define what each persona should say&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Keep all classes clearly separated from other sections of code&lt;br /&gt;
namespace Monarchy&lt;br /&gt;
{&lt;br /&gt;
	// Define a basic class where a person has a label and something they want to say&lt;br /&gt;
	class Person&lt;br /&gt;
	{&lt;br /&gt;
	private:&lt;br /&gt;
		char *szMessage;&lt;br /&gt;
		char *szLabel;&lt;br /&gt;
&lt;br /&gt;
	public:&lt;br /&gt;
		// Allow a person to deliver their message&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			printf(&amp;quot;A now a message from %s: %s\n&amp;quot;, this-&amp;gt;szLabel, this-&amp;gt;szMessage);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// A person needs to be initialized with a label and a message&lt;br /&gt;
		Person(char*label, char *msg)&lt;br /&gt;
		{&lt;br /&gt;
			this-&amp;gt;szLabel = label;&lt;br /&gt;
			this-&amp;gt;szMessage = msg;&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// The King is a person (and thus inherits from it)&lt;br /&gt;
	class King : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// The king has the same label, but his message might change according to the political winds&lt;br /&gt;
		King(char *msg) : Person(&amp;quot;the king&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Here, the function is being overridden...&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			// .. but the base class's DeliverMessage is still being called, in addition to the tag line&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A peon is a person (and thus inherits from it)&lt;br /&gt;
	class Peon : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change according to his or her attitude toward the king&lt;br /&gt;
		Peon(char *msg) : Person(&amp;quot;a peon&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Like above, deliver the message, but always provide a common tag line&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A jester is a person (and thus inherits from it)&lt;br /&gt;
	class Jester : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change if the king is sick of his jokes&lt;br /&gt;
		Jester(char *msg) : Person(&amp;quot;the court jester&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Might as well call him Fozzie ;)&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Initialize some monarchy objects&lt;br /&gt;
	Monarchy::King TheKing(KING_MESSAGE);&lt;br /&gt;
	Monarchy::Jester Borat(JESTER_MESSAGE);&lt;br /&gt;
	Monarchy::Peon Bruno(PEON_MESSAGE);&lt;br /&gt;
&lt;br /&gt;
	// Let them deliver their messages&lt;br /&gt;
	TheKing.DeliverMessage();&lt;br /&gt;
	Borat.DeliverMessage();&lt;br /&gt;
	Bruno.DeliverMessage();&lt;br /&gt;
&lt;br /&gt;
	// Wait for user input&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
#endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Imperative_programming Imperative programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Functional_programming Functional programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Programming_paradigm Programming paradigm] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Class-based_programming Class-based programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Prototype-based_programming Prototype-based programming] at Wikipedia&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further reading==&lt;br /&gt;
* Freeman, Eric, Elisabeth Freeman, Kathy Sierra, and Bert Bates. ''Head First Design Patterns''. Sebastopol, CA: O'Reilly, 2004. Print.&lt;br /&gt;
* Liberty, Jesse. ''Sams Teach Yourself C++ in 24 Hours''. Indianapolis, IN: Sams, 2002. Print.&lt;br /&gt;
* ''Microsoft Visual C++ Language Reference''. Redmond, WA: Microsoft, 1997. Print.&lt;br /&gt;
* Weiss, Mark Allen. ''Data Structures &amp;amp; Algorithm Analysis in Java''. Reading, MA: Addison-Wesley, 1999. Print.&lt;br /&gt;
* Mohamed Fayad, Mauri Laitinen. &amp;quot;TRANSITION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://www.slideshare.net/spajus/object-oriented-programming-presentation-933801 Object Oriented Programming] at slide'''share'''&lt;br /&gt;
* [http://www.developer.com/java/other/article.php/3493761/The-Evolution-of-Object-Oriented-Languages.htm The Evolution of Object-Oriented Languages]&lt;br /&gt;
* [http://www.xp2003.org/the-history-of-oop.htm The History of OOP]&lt;br /&gt;
* [http://www.brighthub.com/internet/web-development/articles/82024.aspx Structured vs. Object-Oriented Programming: A Comparison]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48693</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1e sa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48693"/>
		<updated>2011-09-15T20:11:21Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Advantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;'''Block vs Object-Oriented Programming Languages'''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
In computer science, computer programming languages exhibit variance in syntax and structure in order to effectively solve problems. Two of these variances can be seen between '''block structure''' and '''object-oriented structure'''. A programming language with block structure allows the programmer to group lines of code for convenient use throughout the rest of the program. Object-oriented structure meanwhile goes further to allow the programmer to associate data with its actions in a hierarchical manner. Object-oriented structure has many advantages which generally make it more effective and durable than block-structured languages, but object-oriented languages also benefit from the core ideas present in block structure programming.&lt;br /&gt;
&lt;br /&gt;
==Block structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Block-structured programming languages are task-centric, high-level languages. Operations on data sets are emphasized in an attempt to logically organize program operation. The design and implementation involves breaking down the problem into discrete blocks or units which can be nested to any depth or not at all. Each block generally consists of a set of delimiters such as braces or keywords that separate them from other blocks. Each of these blocks contains a set of (optional) declarations and logic to solve a particular problem. Declarations inside of nested blocks introduces the concept of variable scope, which frees the programmer from having to worry about name collisions and other variable maintenance tasks.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Block_(programming) Block (programming)] at Wikipedia&amp;lt;/ref&amp;gt; A [[CSC/ECE_517_Fall_2011/ch1_1e_sa#C.2FC.2B.2B_Code_Example|code example]] of a block structured program is provided later in the article.&lt;br /&gt;
&lt;br /&gt;
Overall, block-structured languages can be summarized as having the following features:&lt;br /&gt;
* Modular - Lines of code/functionality are grouped together&lt;br /&gt;
* Scoped - Variables are limited to the group of code they are declared in&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Top down] - Modules are created as necessary to meet the program's requirements &lt;br /&gt;
* Simple - It is generally simpler to &amp;quot;cobble together&amp;quot; modules of code that accomplish a simple, well-defined task.&lt;br /&gt;
&lt;br /&gt;
===History===&lt;br /&gt;
Block-structured languages were first conceived in the 1950s with the advent of [http://en.wikipedia.org/wiki/ALGOL ALGOL], one of the first [http://en.wikipedia.org/wiki/Imperative_programming imperative programming languages]. An evolution of block structuring was created as the &amp;quot;GOTO&amp;quot; logic of programs became more and more difficult to understand and maintain. In 1968, famed computer scientist [http://en.wikipedia.org/wiki/Edsger_W._Dijkstra Edsger Dijkstra] wrote [http://dx.doi.org/10.1145%2F362929.362947 a letter] and [http://dx.doi.org/10.1145%2F355604.361591 follow-up article] on the ideas and motivation behind &amp;quot;[http://en.wikipedia.org/wiki/Structured_programming structured programming],&amp;quot; where the program exhibits “[http://en.wikipedia.org/wiki/Separation_of_concerns separation of concerns],&amp;quot; single point of entry but multiple points of exit, and ideas of data structures. It was Dijkstra’s and others’ which helped propel this basic idea of block structure programming into the mainstream.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Structured_programming Structured programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
Block-structured programming languages dominate the general purpose, imperative programming language arena. Indeed most programming languages in modern use enjoy some of the benefits of block structure with grouping of code and scope of variables. Indeed, ignoring their object-oriented aspects, all of [http://en.wikipedia.org/wiki/C_(programming_language) C], [http://en.wikipedia.org/wiki/C%2B%2B C++], [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#], [http://en.wikipedia.org/wiki/Java_(programming_language) Java], [http://en.wikipedia.org/wiki/PHP PHP] and [http://en.wikipedia.org/wiki/Visual_Basic Visual Basic] – for example – contain elements of block structure.&lt;br /&gt;
&lt;br /&gt;
==Object-oriented structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Object-oriented languages have an important overall goal and foster major design principles.&lt;br /&gt;
====Description====&lt;br /&gt;
Object-oriented structured languages are data-centric, high-level languages. This is in contrast to block structure languages, which are task-centric. Compared to block-structure languages, logical organization of &amp;lt;i&amp;gt;data&amp;lt;/i&amp;gt; and the methods associated with them are emphasized. It is a way of grouping data with executable code. These groups are called &amp;quot;[http://en.wikipedia.org/wiki/Object_(computer_science) objects].&amp;quot; Objects utilize their data and interact with other objects such that a hierarchy is established (called &amp;quot;[http://en.wikipedia.org/wiki/Class_(computer_science) classes]&amp;quot; in popular languages). Toward this end and depending on the language, objects can be interrelated and defined so that their relationships can produce code that is well-organized, easy to read, and reusable.&amp;lt;ref name=&amp;quot;oopref&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Principles====&lt;br /&gt;
=====Encapsulation=====&lt;br /&gt;
Also referred to as &amp;quot;data hiding,&amp;quot; [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) encapsulation] shields the programmer from the implementation details of an object. These implementation details would include [http://en.wikipedia.org/wiki/Local_variable private variables], special [http://en.wikipedia.org/wiki/Library_(computing) libraries], and [http://en.wikipedia.org/wiki/Data_structure data structures] that the programmer does not need to know in order to utilize the functionality offered by the object.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation (object-oriented programming)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Inheritance=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance] introduces the idea of objects sharing functionality in data or methods that are common. [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses Subclasses] can inherit data structures, functions, and attributes of their [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses superclasses] in order to create an object or [http://en.wikipedia.org/wiki/Class_hierarchy class hierarchy] that is effective in organizing data and methods in a logical manner.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance (computer science)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Polymorphism=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism] describes the idea of interfaces, where one data type can be defined that allows other dissimilar types to implement a common set of [http://en.wikipedia.org/wiki/Method_(computer_programming) methods] and [http://en.wikipedia.org/wiki/Field_(computer_science) fields]. This allows a high level of [http://en.wikipedia.org/wiki/Abstraction_(computer_science) abstraction] that allows programmers to write easily maintainable code.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism in object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===History and transition===&lt;br /&gt;
Early forms of object oriented programming languages were created in the early 1960s with the creation of [http://en.wikipedia.org/wiki/Lisp_(programming_language) LISP] and an early form of ALGOL, with [http://en.wikipedia.org/wiki/Simula Simula 67] signaling the actual beginning of the object-oriented &amp;quot;revolution.&amp;quot; The development of object-oriented languages progressed through other languages like [http://en.wikipedia.org/wiki/Simula Smalltalk] and the archetypal C++ to arrive at many of the object oriented languages we have today.&amp;lt;ref name=&amp;quot;oopref&amp;quot;/&amp;gt; As processing capability has matured, so too have the capabilities of programming languages. More and more though, [http://en.wikipedia.org/wiki/Dynamic_programming_language dynamic programming languages] like [http://en.wikipedia.org/wiki/Ruby_(programming_language) Ruby] are being treated as &amp;quot;true&amp;quot; object-oriented languages because of their rapid prototpying ability and strong [http://en.wikipedia.org/wiki/Object-oriented_analysis_and_design object model].&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
A complete list of object oriented languages is outside the scope of this document, but some major examples are [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo], C++, C#, [http://en.wikipedia.org/wiki/COBOL COBOL 2002], [http://en.wikipedia.org/wiki/F_Sharp_(programming_language) F#], [http://en.wikipedia.org/wiki/Fortran Fortran 2003], Java, [http://en.wikipedia.org/wiki/Matlab MATLAB], [http://en.wikipedia.org/wiki/Objective_c Objective-C], [http://en.wikipedia.org/wiki/PHP PHP 5], [http://en.wikipedia.org/wiki/Python_(programming_language) Python], Ruby, and Visual Basic.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/List_of_object-oriented_programming_languages List of object-oriented programming languages] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Structure comparison==&lt;br /&gt;
===Advantages and disadvantages===&lt;br /&gt;
==== Block-structured languages ====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* Simplicity&lt;br /&gt;
* Reduced coding and turnover time&lt;br /&gt;
* Dynamic lifetime of variables ([http://en.wikipedia.org/wiki/Scope_(computer_science) Scope]) provide efficient usage of memory since allocation and deletion occur at the entrance and exit of each block&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* Commercial projects are difficult to manage due to very large [http://en.wikipedia.org/wiki/Codebase codebase] sizes&lt;br /&gt;
* Reduced code [http://en.wikipedia.org/wiki/Reusability reusability]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Computer_security Security] concerns, espcially in the realm of [http://en.wikipedia.org/wiki/Array#In_computer_science arrays] and accessing [http://en.wikipedia.org/wiki/Value_(computer_science) elements] that are [http://en.wikipedia.org/wiki/Privilege_(computing) out of bounds]&lt;br /&gt;
&lt;br /&gt;
====Object-Oriented languages====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* The software objects model real world objects so program composition is well defined and structured&lt;br /&gt;
* Each object's definition and internal implementation is decoupled from other objects, making the system design inherently modular ([http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation])&lt;br /&gt;
* Adding new features becomes easier because of inheritance, allowing the new class to contain the new feature in addition to all old features from the inherited class&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Debugging Debugging] is easier since each object's internal mechanisms are independent of each other, which helps in isolating errors and fixing them&lt;br /&gt;
* Enhanced code reusability&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* The complexity of object-oriented design becomes prohibitive when working on small projects&lt;br /&gt;
* Object-oriented programming paradigm is preferable for dynamic environments rather than simple environments&lt;br /&gt;
* Reduced time efficiency compared to block-structured languages&lt;br /&gt;
&lt;br /&gt;
===Summary of important differences===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Difference&lt;br /&gt;
! Block Structured Languages&lt;br /&gt;
! Object-Oriented Languages&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem approach'''&lt;br /&gt;
| Top-down approach is followed&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Bottom-up] approach is followed&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem focus'''&lt;br /&gt;
| Focus is on the [http://en.wikipedia.org/wiki/Algorithm#Computer_algorithms algorithm] to solve the problem&lt;br /&gt;
| Focus is on getting the object design right&lt;br /&gt;
|-&lt;br /&gt;
| '''View of data and functions'''&lt;br /&gt;
| Views data and functions as separate entities&lt;br /&gt;
| Views data and functions as single entity&lt;br /&gt;
|-&lt;br /&gt;
| '''Cost of maintenance'''&lt;br /&gt;
| Maintenance is costly &lt;br /&gt;
| Maintenance is relatively cheaper&lt;br /&gt;
|-&lt;br /&gt;
| '''Software reuse'''&lt;br /&gt;
| Software reuse is not possible&lt;br /&gt;
| Software reuse is possible &lt;br /&gt;
|-&lt;br /&gt;
| '''Abstraction'''&lt;br /&gt;
| Function abstraction is used&lt;br /&gt;
| Data abstraction is used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Effectiveness and durability of object oriented languages over block structured languages ===&lt;br /&gt;
&lt;br /&gt;
Although block structured languages were simpler and faster for smaller projects, when it comes to large commercial undertaking the manpower and tools required to maintain the code base is very prohibitive. It was very difficult to fix issues, add new features, and at the same time to make sure that the integrity of the code base is intact. Many projects were perpetually stagnant at 90% completion with issues coming up at the eleventh hour. All these problems led to the hastening of the move to object-oriented languages which showed it had the solutions to all the problems that block structured languages could not solve. The following four points are the most important reasons why object-oriented languages were more effective and durable that block structured languages:&lt;br /&gt;
* Maintenance - In block structured languages, especially in large projects, system maintenance became a challenge. Object oriented languages could counter this by providing clear demarcation between the objects and making it easier to work on individual aspects of the system without disturbing the other components.&lt;br /&gt;
* Data hiding - In block structured language system the data usually has global scope. Hence it is very difficult to monitor or supervise data access. This was solved by object-oriented languages by providing data encapsulation. The data and the corresponding attributes are put into a nice little package that was much easier to control and monitor.&lt;br /&gt;
* Code reuse - Object oriented languages are proponents of code reuse. Hence the code size could be reduced sufficiently enough when it comes to large projects to warrant a shift from block structured to object oriented languages.&lt;br /&gt;
* Feature additions - Object oriented languages provide a very cost effective and safe way to add new features to the existing system without causing the whole system to collapse. This feature is very important for large scale software vendors who provide various customizations.&lt;br /&gt;
&lt;br /&gt;
===Applicability between paradigms===&lt;br /&gt;
Object-oriented languages have solved many problems that block structured languages introduced. But all is not lost with block structured languages. They boast some very important features that are needed in any programming language. The simplicity and readability of code in block structured languages are enviable features indeed. Because of this very simplicity we find that block structured languages are very efficient in terms of speed and performance. Such a language would also provide the flexibility in moving legacy block structured systems to the object oriented paradigm seamlessly. A language that can capture both sides of the argument would be a formidable entry into the growing list of programming languages. This explains why we see C++ emerging as one of the most popular object oriented languages. It has both the block structured features of C and the object-oriented concepts built into it, thereby making it a very versatile and efficient programming language.&lt;br /&gt;
&lt;br /&gt;
==C/C++ Code Example==&lt;br /&gt;
{{Expand section}}&lt;br /&gt;
Below is a code example highlighting key differences between a block structured program and an object oriented program all in one source file.&lt;br /&gt;
&amp;lt;pre&amp;gt;// For block structure, leave the below line commented to compile in C&lt;br /&gt;
// For object oriented structure, uncomment the line to compile in C++&lt;br /&gt;
//#define USING_CPP&lt;br /&gt;
&lt;br /&gt;
#ifndef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C standard header files&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define the messages of each persona&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Define the function prototypes for delivering the different messages&lt;br /&gt;
char *getKingMessage();&lt;br /&gt;
char *getJesterMessage();&lt;br /&gt;
char *getPeonMessage();&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Go through and make each function call for...&lt;br /&gt;
	// The King&lt;br /&gt;
	printf(&amp;quot;And now a message from the king: %s\n&amp;quot;, getKingMessage());&lt;br /&gt;
	printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// The Court Jester&lt;br /&gt;
	printf(&amp;quot;And now a message from the court jester: %s\n&amp;quot;, getJesterMessage());&lt;br /&gt;
	printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// A Peon&lt;br /&gt;
	printf(&amp;quot;And now a message from a peon: %s\n&amp;quot;, getPeonMessage());&lt;br /&gt;
	printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
	&lt;br /&gt;
	// Wait for user input before exiting&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the king&lt;br /&gt;
char *getKingMessage()&lt;br /&gt;
{&lt;br /&gt;
	return KING_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the court jester&lt;br /&gt;
char *getJesterMessage()&lt;br /&gt;
{&lt;br /&gt;
	return JESTER_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by all peons&lt;br /&gt;
char *getPeonMessage()&lt;br /&gt;
{&lt;br /&gt;
	return PEON_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#ifdef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C++ standard headers&lt;br /&gt;
#include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define what each persona should say&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Keep all classes clearly separated from other sections of code&lt;br /&gt;
namespace Monarchy&lt;br /&gt;
{&lt;br /&gt;
	// Define a basic class where a person has a label and something they want to say&lt;br /&gt;
	class Person&lt;br /&gt;
	{&lt;br /&gt;
	private:&lt;br /&gt;
		char *szMessage;&lt;br /&gt;
		char *szLabel;&lt;br /&gt;
&lt;br /&gt;
	public:&lt;br /&gt;
		// Allow a person to deliver their message&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			printf(&amp;quot;A now a message from %s: %s\n&amp;quot;, this-&amp;gt;szLabel, this-&amp;gt;szMessage);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// A person needs to be initialized with a label and a message&lt;br /&gt;
		Person(char*label, char *msg)&lt;br /&gt;
		{&lt;br /&gt;
			this-&amp;gt;szLabel = label;&lt;br /&gt;
			this-&amp;gt;szMessage = msg;&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// The King is a person (and thus inherits from it)&lt;br /&gt;
	class King : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// The king has the same label, but his message might change according to the political winds&lt;br /&gt;
		King(char *msg) : Person(&amp;quot;the king&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Here, the function is being overridden...&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			// .. but the base class's DeliverMessage is still being called, in addition to the tag line&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A peon is a person (and thus inherits from it)&lt;br /&gt;
	class Peon : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change according to his or her attitude toward the king&lt;br /&gt;
		Peon(char *msg) : Person(&amp;quot;a peon&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Like above, deliver the message, but always provide a common tag line&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A jester is a person (and thus inherits from it)&lt;br /&gt;
	class Jester : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change if the king is sick of his jokes&lt;br /&gt;
		Jester(char *msg) : Person(&amp;quot;the court jester&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Might as well call him Fozzie ;)&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Initialize some monarchy objects&lt;br /&gt;
	Monarchy::King TheKing(KING_MESSAGE);&lt;br /&gt;
	Monarchy::Jester Borat(JESTER_MESSAGE);&lt;br /&gt;
	Monarchy::Peon Bruno(PEON_MESSAGE);&lt;br /&gt;
&lt;br /&gt;
	// Let them deliver their messages&lt;br /&gt;
	TheKing.DeliverMessage();&lt;br /&gt;
	Borat.DeliverMessage();&lt;br /&gt;
	Bruno.DeliverMessage();&lt;br /&gt;
&lt;br /&gt;
	// Wait for user input&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
#endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Imperative_programming Imperative programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Functional_programming Functional programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Programming_paradigm Programming paradigm] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Class-based_programming Class-based programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Prototype-based_programming Prototype-based programming] at Wikipedia&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further reading==&lt;br /&gt;
* Freeman, Eric, Elisabeth Freeman, Kathy Sierra, and Bert Bates. ''Head First Design Patterns''. Sebastopol, CA: O'Reilly, 2004. Print.&lt;br /&gt;
* Liberty, Jesse. ''Sams Teach Yourself C++ in 24 Hours''. Indianapolis, IN: Sams, 2002. Print.&lt;br /&gt;
* ''Microsoft Visual C++ Language Reference''. Redmond, WA: Microsoft, 1997. Print.&lt;br /&gt;
* Weiss, Mark Allen. ''Data Structures &amp;amp; Algorithm Analysis in Java''. Reading, MA: Addison-Wesley, 1999. Print.&lt;br /&gt;
* Mohamed Fayad, Mauri Laitinen. &amp;quot;TRANSITION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://www.slideshare.net/spajus/object-oriented-programming-presentation-933801 Object Oriented Programming] at slide'''share'''&lt;br /&gt;
* [http://www.developer.com/java/other/article.php/3493761/The-Evolution-of-Object-Oriented-Languages.htm The Evolution of Object-Oriented Languages]&lt;br /&gt;
* [http://www.xp2003.org/the-history-of-oop.htm The History of OOP]&lt;br /&gt;
* [http://www.brighthub.com/internet/web-development/articles/82024.aspx Structured vs. Object-Oriented Programming: A Comparison]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48692</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1e sa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48692"/>
		<updated>2011-09-15T20:10:29Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Disadvantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;'''Block vs Object-Oriented Programming Languages'''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
In computer science, computer programming languages exhibit variance in syntax and structure in order to effectively solve problems. Two of these variances can be seen between '''block structure''' and '''object-oriented structure'''. A programming language with block structure allows the programmer to group lines of code for convenient use throughout the rest of the program. Object-oriented structure meanwhile goes further to allow the programmer to associate data with its actions in a hierarchical manner. Object-oriented structure has many advantages which generally make it more effective and durable than block-structured languages, but object-oriented languages also benefit from the core ideas present in block structure programming.&lt;br /&gt;
&lt;br /&gt;
==Block structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Block-structured programming languages are task-centric, high-level languages. Operations on data sets are emphasized in an attempt to logically organize program operation. The design and implementation involves breaking down the problem into discrete blocks or units which can be nested to any depth or not at all. Each block generally consists of a set of delimiters such as braces or keywords that separate them from other blocks. Each of these blocks contains a set of (optional) declarations and logic to solve a particular problem. Declarations inside of nested blocks introduces the concept of variable scope, which frees the programmer from having to worry about name collisions and other variable maintenance tasks.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Block_(programming) Block (programming)] at Wikipedia&amp;lt;/ref&amp;gt; A [[CSC/ECE_517_Fall_2011/ch1_1e_sa#C.2FC.2B.2B_Code_Example|code example]] of a block structured program is provided later in the article.&lt;br /&gt;
&lt;br /&gt;
Overall, block-structured languages can be summarized as having the following features:&lt;br /&gt;
* Modular - Lines of code/functionality are grouped together&lt;br /&gt;
* Scoped - Variables are limited to the group of code they are declared in&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Top down] - Modules are created as necessary to meet the program's requirements &lt;br /&gt;
* Simple - It is generally simpler to &amp;quot;cobble together&amp;quot; modules of code that accomplish a simple, well-defined task.&lt;br /&gt;
&lt;br /&gt;
===History===&lt;br /&gt;
Block-structured languages were first conceived in the 1950s with the advent of [http://en.wikipedia.org/wiki/ALGOL ALGOL], one of the first [http://en.wikipedia.org/wiki/Imperative_programming imperative programming languages]. An evolution of block structuring was created as the &amp;quot;GOTO&amp;quot; logic of programs became more and more difficult to understand and maintain. In 1968, famed computer scientist [http://en.wikipedia.org/wiki/Edsger_W._Dijkstra Edsger Dijkstra] wrote [http://dx.doi.org/10.1145%2F362929.362947 a letter] and [http://dx.doi.org/10.1145%2F355604.361591 follow-up article] on the ideas and motivation behind &amp;quot;[http://en.wikipedia.org/wiki/Structured_programming structured programming],&amp;quot; where the program exhibits “[http://en.wikipedia.org/wiki/Separation_of_concerns separation of concerns],&amp;quot; single point of entry but multiple points of exit, and ideas of data structures. It was Dijkstra’s and others’ which helped propel this basic idea of block structure programming into the mainstream.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Structured_programming Structured programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
Block-structured programming languages dominate the general purpose, imperative programming language arena. Indeed most programming languages in modern use enjoy some of the benefits of block structure with grouping of code and scope of variables. Indeed, ignoring their object-oriented aspects, all of [http://en.wikipedia.org/wiki/C_(programming_language) C], [http://en.wikipedia.org/wiki/C%2B%2B C++], [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#], [http://en.wikipedia.org/wiki/Java_(programming_language) Java], [http://en.wikipedia.org/wiki/PHP PHP] and [http://en.wikipedia.org/wiki/Visual_Basic Visual Basic] – for example – contain elements of block structure.&lt;br /&gt;
&lt;br /&gt;
==Object-oriented structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Object-oriented languages have an important overall goal and foster major design principles.&lt;br /&gt;
====Description====&lt;br /&gt;
Object-oriented structured languages are data-centric, high-level languages. This is in contrast to block structure languages, which are task-centric. Compared to block-structure languages, logical organization of &amp;lt;i&amp;gt;data&amp;lt;/i&amp;gt; and the methods associated with them are emphasized. It is a way of grouping data with executable code. These groups are called &amp;quot;[http://en.wikipedia.org/wiki/Object_(computer_science) objects].&amp;quot; Objects utilize their data and interact with other objects such that a hierarchy is established (called &amp;quot;[http://en.wikipedia.org/wiki/Class_(computer_science) classes]&amp;quot; in popular languages). Toward this end and depending on the language, objects can be interrelated and defined so that their relationships can produce code that is well-organized, easy to read, and reusable.&amp;lt;ref name=&amp;quot;oopref&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Principles====&lt;br /&gt;
=====Encapsulation=====&lt;br /&gt;
Also referred to as &amp;quot;data hiding,&amp;quot; [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) encapsulation] shields the programmer from the implementation details of an object. These implementation details would include [http://en.wikipedia.org/wiki/Local_variable private variables], special [http://en.wikipedia.org/wiki/Library_(computing) libraries], and [http://en.wikipedia.org/wiki/Data_structure data structures] that the programmer does not need to know in order to utilize the functionality offered by the object.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation (object-oriented programming)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Inheritance=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance] introduces the idea of objects sharing functionality in data or methods that are common. [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses Subclasses] can inherit data structures, functions, and attributes of their [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses superclasses] in order to create an object or [http://en.wikipedia.org/wiki/Class_hierarchy class hierarchy] that is effective in organizing data and methods in a logical manner.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance (computer science)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Polymorphism=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism] describes the idea of interfaces, where one data type can be defined that allows other dissimilar types to implement a common set of [http://en.wikipedia.org/wiki/Method_(computer_programming) methods] and [http://en.wikipedia.org/wiki/Field_(computer_science) fields]. This allows a high level of [http://en.wikipedia.org/wiki/Abstraction_(computer_science) abstraction] that allows programmers to write easily maintainable code.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism in object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===History and transition===&lt;br /&gt;
Early forms of object oriented programming languages were created in the early 1960s with the creation of [http://en.wikipedia.org/wiki/Lisp_(programming_language) LISP] and an early form of ALGOL, with [http://en.wikipedia.org/wiki/Simula Simula 67] signaling the actual beginning of the object-oriented &amp;quot;revolution.&amp;quot; The development of object-oriented languages progressed through other languages like [http://en.wikipedia.org/wiki/Simula Smalltalk] and the archetypal C++ to arrive at many of the object oriented languages we have today.&amp;lt;ref name=&amp;quot;oopref&amp;quot;/&amp;gt; As processing capability has matured, so too have the capabilities of programming languages. More and more though, [http://en.wikipedia.org/wiki/Dynamic_programming_language dynamic programming languages] like [http://en.wikipedia.org/wiki/Ruby_(programming_language) Ruby] are being treated as &amp;quot;true&amp;quot; object-oriented languages because of their rapid prototpying ability and strong [http://en.wikipedia.org/wiki/Object-oriented_analysis_and_design object model].&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
A complete list of object oriented languages is outside the scope of this document, but some major examples are [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo], C++, C#, [http://en.wikipedia.org/wiki/COBOL COBOL 2002], [http://en.wikipedia.org/wiki/F_Sharp_(programming_language) F#], [http://en.wikipedia.org/wiki/Fortran Fortran 2003], Java, [http://en.wikipedia.org/wiki/Matlab MATLAB], [http://en.wikipedia.org/wiki/Objective_c Objective-C], [http://en.wikipedia.org/wiki/PHP PHP 5], [http://en.wikipedia.org/wiki/Python_(programming_language) Python], Ruby, and Visual Basic.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/List_of_object-oriented_programming_languages List of object-oriented programming languages] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Structure comparison==&lt;br /&gt;
===Advantages and disadvantages===&lt;br /&gt;
==== Block-structured languages ====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* Simplicity&lt;br /&gt;
* Reduced coding and turnover time&lt;br /&gt;
* Dynamic lifetime of variables ([http://en.wikipedia.org/wiki/Scope_(computer_science) Scope]) provide efficient usage of memory since allocation and deletion occur at the entrance and exit of each block&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* Commercial projects are difficult to manage due to very large [http://en.wikipedia.org/wiki/Codebase codebase] sizes&lt;br /&gt;
* Reduced code [http://en.wikipedia.org/wiki/Reusability reusability]&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Computer_security Security] concerns, espcially in the realm of [http://en.wikipedia.org/wiki/Array#In_computer_science arrays] and accessing [http://en.wikipedia.org/wiki/Value_(computer_science) elements] that are [http://en.wikipedia.org/wiki/Privilege_(computing) out of bounds]&lt;br /&gt;
&lt;br /&gt;
====Object-Oriented languages====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* The software objects model real world objects so program composition is well defined and structured&lt;br /&gt;
* Each object's definition and internal implementation is decoupled from other objects, making the system design inherently modular ([http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation])&lt;br /&gt;
* Adding new features becomes easier because of inheritance, allowing the new class to contain the new feature in addition to all old features from the inherited class&lt;br /&gt;
* Debugging is easier since each object's internal mechanisms are independent of each other, which helps in isolating errors and fixing them&lt;br /&gt;
* Enhanced code reusability&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* The complexity of object-oriented design becomes prohibitive when working on small projects&lt;br /&gt;
* Object-oriented programming paradigm is preferable for dynamic environments rather than simple environments&lt;br /&gt;
* Reduced time efficiency compared to block-structured languages&lt;br /&gt;
&lt;br /&gt;
===Summary of important differences===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Difference&lt;br /&gt;
! Block Structured Languages&lt;br /&gt;
! Object-Oriented Languages&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem approach'''&lt;br /&gt;
| Top-down approach is followed&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Bottom-up] approach is followed&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem focus'''&lt;br /&gt;
| Focus is on the [http://en.wikipedia.org/wiki/Algorithm#Computer_algorithms algorithm] to solve the problem&lt;br /&gt;
| Focus is on getting the object design right&lt;br /&gt;
|-&lt;br /&gt;
| '''View of data and functions'''&lt;br /&gt;
| Views data and functions as separate entities&lt;br /&gt;
| Views data and functions as single entity&lt;br /&gt;
|-&lt;br /&gt;
| '''Cost of maintenance'''&lt;br /&gt;
| Maintenance is costly &lt;br /&gt;
| Maintenance is relatively cheaper&lt;br /&gt;
|-&lt;br /&gt;
| '''Software reuse'''&lt;br /&gt;
| Software reuse is not possible&lt;br /&gt;
| Software reuse is possible &lt;br /&gt;
|-&lt;br /&gt;
| '''Abstraction'''&lt;br /&gt;
| Function abstraction is used&lt;br /&gt;
| Data abstraction is used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Effectiveness and durability of object oriented languages over block structured languages ===&lt;br /&gt;
&lt;br /&gt;
Although block structured languages were simpler and faster for smaller projects, when it comes to large commercial undertaking the manpower and tools required to maintain the code base is very prohibitive. It was very difficult to fix issues, add new features, and at the same time to make sure that the integrity of the code base is intact. Many projects were perpetually stagnant at 90% completion with issues coming up at the eleventh hour. All these problems led to the hastening of the move to object-oriented languages which showed it had the solutions to all the problems that block structured languages could not solve. The following four points are the most important reasons why object-oriented languages were more effective and durable that block structured languages:&lt;br /&gt;
* Maintenance - In block structured languages, especially in large projects, system maintenance became a challenge. Object oriented languages could counter this by providing clear demarcation between the objects and making it easier to work on individual aspects of the system without disturbing the other components.&lt;br /&gt;
* Data hiding - In block structured language system the data usually has global scope. Hence it is very difficult to monitor or supervise data access. This was solved by object-oriented languages by providing data encapsulation. The data and the corresponding attributes are put into a nice little package that was much easier to control and monitor.&lt;br /&gt;
* Code reuse - Object oriented languages are proponents of code reuse. Hence the code size could be reduced sufficiently enough when it comes to large projects to warrant a shift from block structured to object oriented languages.&lt;br /&gt;
* Feature additions - Object oriented languages provide a very cost effective and safe way to add new features to the existing system without causing the whole system to collapse. This feature is very important for large scale software vendors who provide various customizations.&lt;br /&gt;
&lt;br /&gt;
===Applicability between paradigms===&lt;br /&gt;
Object-oriented languages have solved many problems that block structured languages introduced. But all is not lost with block structured languages. They boast some very important features that are needed in any programming language. The simplicity and readability of code in block structured languages are enviable features indeed. Because of this very simplicity we find that block structured languages are very efficient in terms of speed and performance. Such a language would also provide the flexibility in moving legacy block structured systems to the object oriented paradigm seamlessly. A language that can capture both sides of the argument would be a formidable entry into the growing list of programming languages. This explains why we see C++ emerging as one of the most popular object oriented languages. It has both the block structured features of C and the object-oriented concepts built into it, thereby making it a very versatile and efficient programming language.&lt;br /&gt;
&lt;br /&gt;
==C/C++ Code Example==&lt;br /&gt;
{{Expand section}}&lt;br /&gt;
Below is a code example highlighting key differences between a block structured program and an object oriented program all in one source file.&lt;br /&gt;
&amp;lt;pre&amp;gt;// For block structure, leave the below line commented to compile in C&lt;br /&gt;
// For object oriented structure, uncomment the line to compile in C++&lt;br /&gt;
//#define USING_CPP&lt;br /&gt;
&lt;br /&gt;
#ifndef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C standard header files&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define the messages of each persona&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Define the function prototypes for delivering the different messages&lt;br /&gt;
char *getKingMessage();&lt;br /&gt;
char *getJesterMessage();&lt;br /&gt;
char *getPeonMessage();&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Go through and make each function call for...&lt;br /&gt;
	// The King&lt;br /&gt;
	printf(&amp;quot;And now a message from the king: %s\n&amp;quot;, getKingMessage());&lt;br /&gt;
	printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// The Court Jester&lt;br /&gt;
	printf(&amp;quot;And now a message from the court jester: %s\n&amp;quot;, getJesterMessage());&lt;br /&gt;
	printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// A Peon&lt;br /&gt;
	printf(&amp;quot;And now a message from a peon: %s\n&amp;quot;, getPeonMessage());&lt;br /&gt;
	printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
	&lt;br /&gt;
	// Wait for user input before exiting&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the king&lt;br /&gt;
char *getKingMessage()&lt;br /&gt;
{&lt;br /&gt;
	return KING_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the court jester&lt;br /&gt;
char *getJesterMessage()&lt;br /&gt;
{&lt;br /&gt;
	return JESTER_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by all peons&lt;br /&gt;
char *getPeonMessage()&lt;br /&gt;
{&lt;br /&gt;
	return PEON_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#ifdef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C++ standard headers&lt;br /&gt;
#include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define what each persona should say&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Keep all classes clearly separated from other sections of code&lt;br /&gt;
namespace Monarchy&lt;br /&gt;
{&lt;br /&gt;
	// Define a basic class where a person has a label and something they want to say&lt;br /&gt;
	class Person&lt;br /&gt;
	{&lt;br /&gt;
	private:&lt;br /&gt;
		char *szMessage;&lt;br /&gt;
		char *szLabel;&lt;br /&gt;
&lt;br /&gt;
	public:&lt;br /&gt;
		// Allow a person to deliver their message&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			printf(&amp;quot;A now a message from %s: %s\n&amp;quot;, this-&amp;gt;szLabel, this-&amp;gt;szMessage);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// A person needs to be initialized with a label and a message&lt;br /&gt;
		Person(char*label, char *msg)&lt;br /&gt;
		{&lt;br /&gt;
			this-&amp;gt;szLabel = label;&lt;br /&gt;
			this-&amp;gt;szMessage = msg;&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// The King is a person (and thus inherits from it)&lt;br /&gt;
	class King : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// The king has the same label, but his message might change according to the political winds&lt;br /&gt;
		King(char *msg) : Person(&amp;quot;the king&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Here, the function is being overridden...&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			// .. but the base class's DeliverMessage is still being called, in addition to the tag line&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A peon is a person (and thus inherits from it)&lt;br /&gt;
	class Peon : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change according to his or her attitude toward the king&lt;br /&gt;
		Peon(char *msg) : Person(&amp;quot;a peon&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Like above, deliver the message, but always provide a common tag line&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A jester is a person (and thus inherits from it)&lt;br /&gt;
	class Jester : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change if the king is sick of his jokes&lt;br /&gt;
		Jester(char *msg) : Person(&amp;quot;the court jester&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Might as well call him Fozzie ;)&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Initialize some monarchy objects&lt;br /&gt;
	Monarchy::King TheKing(KING_MESSAGE);&lt;br /&gt;
	Monarchy::Jester Borat(JESTER_MESSAGE);&lt;br /&gt;
	Monarchy::Peon Bruno(PEON_MESSAGE);&lt;br /&gt;
&lt;br /&gt;
	// Let them deliver their messages&lt;br /&gt;
	TheKing.DeliverMessage();&lt;br /&gt;
	Borat.DeliverMessage();&lt;br /&gt;
	Bruno.DeliverMessage();&lt;br /&gt;
&lt;br /&gt;
	// Wait for user input&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
#endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Imperative_programming Imperative programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Functional_programming Functional programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Programming_paradigm Programming paradigm] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Class-based_programming Class-based programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Prototype-based_programming Prototype-based programming] at Wikipedia&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further reading==&lt;br /&gt;
* Freeman, Eric, Elisabeth Freeman, Kathy Sierra, and Bert Bates. ''Head First Design Patterns''. Sebastopol, CA: O'Reilly, 2004. Print.&lt;br /&gt;
* Liberty, Jesse. ''Sams Teach Yourself C++ in 24 Hours''. Indianapolis, IN: Sams, 2002. Print.&lt;br /&gt;
* ''Microsoft Visual C++ Language Reference''. Redmond, WA: Microsoft, 1997. Print.&lt;br /&gt;
* Weiss, Mark Allen. ''Data Structures &amp;amp; Algorithm Analysis in Java''. Reading, MA: Addison-Wesley, 1999. Print.&lt;br /&gt;
* Mohamed Fayad, Mauri Laitinen. &amp;quot;TRANSITION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://www.slideshare.net/spajus/object-oriented-programming-presentation-933801 Object Oriented Programming] at slide'''share'''&lt;br /&gt;
* [http://www.developer.com/java/other/article.php/3493761/The-Evolution-of-Object-Oriented-Languages.htm The Evolution of Object-Oriented Languages]&lt;br /&gt;
* [http://www.xp2003.org/the-history-of-oop.htm The History of OOP]&lt;br /&gt;
* [http://www.brighthub.com/internet/web-development/articles/82024.aspx Structured vs. Object-Oriented Programming: A Comparison]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48691</id>
		<title>CSC/ECE 517 Fall 2011/ch1 1e sa</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Fall_2011/ch1_1e_sa&amp;diff=48691"/>
		<updated>2011-09-15T20:04:51Z</updated>

		<summary type="html">&lt;p&gt;Sramach5: /* Advantages */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&amp;quot;'''Block vs Object-Oriented Programming Languages'''&amp;quot;&lt;br /&gt;
&lt;br /&gt;
In computer science, computer programming languages exhibit variance in syntax and structure in order to effectively solve problems. Two of these variances can be seen between '''block structure''' and '''object-oriented structure'''. A programming language with block structure allows the programmer to group lines of code for convenient use throughout the rest of the program. Object-oriented structure meanwhile goes further to allow the programmer to associate data with its actions in a hierarchical manner. Object-oriented structure has many advantages which generally make it more effective and durable than block-structured languages, but object-oriented languages also benefit from the core ideas present in block structure programming.&lt;br /&gt;
&lt;br /&gt;
==Block structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Block-structured programming languages are task-centric, high-level languages. Operations on data sets are emphasized in an attempt to logically organize program operation. The design and implementation involves breaking down the problem into discrete blocks or units which can be nested to any depth or not at all. Each block generally consists of a set of delimiters such as braces or keywords that separate them from other blocks. Each of these blocks contains a set of (optional) declarations and logic to solve a particular problem. Declarations inside of nested blocks introduces the concept of variable scope, which frees the programmer from having to worry about name collisions and other variable maintenance tasks.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Block_(programming) Block (programming)] at Wikipedia&amp;lt;/ref&amp;gt; A [[CSC/ECE_517_Fall_2011/ch1_1e_sa#C.2FC.2B.2B_Code_Example|code example]] of a block structured program is provided later in the article.&lt;br /&gt;
&lt;br /&gt;
Overall, block-structured languages can be summarized as having the following features:&lt;br /&gt;
* Modular - Lines of code/functionality are grouped together&lt;br /&gt;
* Scoped - Variables are limited to the group of code they are declared in&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Top down] - Modules are created as necessary to meet the program's requirements &lt;br /&gt;
* Simple - It is generally simpler to &amp;quot;cobble together&amp;quot; modules of code that accomplish a simple, well-defined task.&lt;br /&gt;
&lt;br /&gt;
===History===&lt;br /&gt;
Block-structured languages were first conceived in the 1950s with the advent of [http://en.wikipedia.org/wiki/ALGOL ALGOL], one of the first [http://en.wikipedia.org/wiki/Imperative_programming imperative programming languages]. An evolution of block structuring was created as the &amp;quot;GOTO&amp;quot; logic of programs became more and more difficult to understand and maintain. In 1968, famed computer scientist [http://en.wikipedia.org/wiki/Edsger_W._Dijkstra Edsger Dijkstra] wrote [http://dx.doi.org/10.1145%2F362929.362947 a letter] and [http://dx.doi.org/10.1145%2F355604.361591 follow-up article] on the ideas and motivation behind &amp;quot;[http://en.wikipedia.org/wiki/Structured_programming structured programming],&amp;quot; where the program exhibits “[http://en.wikipedia.org/wiki/Separation_of_concerns separation of concerns],&amp;quot; single point of entry but multiple points of exit, and ideas of data structures. It was Dijkstra’s and others’ which helped propel this basic idea of block structure programming into the mainstream.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Structured_programming Structured programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
Block-structured programming languages dominate the general purpose, imperative programming language arena. Indeed most programming languages in modern use enjoy some of the benefits of block structure with grouping of code and scope of variables. Indeed, ignoring their object-oriented aspects, all of [http://en.wikipedia.org/wiki/C_(programming_language) C], [http://en.wikipedia.org/wiki/C%2B%2B C++], [http://en.wikipedia.org/wiki/C_Sharp_(programming_language) C#], [http://en.wikipedia.org/wiki/Java_(programming_language) Java], [http://en.wikipedia.org/wiki/PHP PHP] and [http://en.wikipedia.org/wiki/Visual_Basic Visual Basic] – for example – contain elements of block structure.&lt;br /&gt;
&lt;br /&gt;
==Object-oriented structure==&lt;br /&gt;
===Definition===&lt;br /&gt;
Object-oriented languages have an important overall goal and foster major design principles.&lt;br /&gt;
====Description====&lt;br /&gt;
Object-oriented structured languages are data-centric, high-level languages. This is in contrast to block structure languages, which are task-centric. Compared to block-structure languages, logical organization of &amp;lt;i&amp;gt;data&amp;lt;/i&amp;gt; and the methods associated with them are emphasized. It is a way of grouping data with executable code. These groups are called &amp;quot;[http://en.wikipedia.org/wiki/Object_(computer_science) objects].&amp;quot; Objects utilize their data and interact with other objects such that a hierarchy is established (called &amp;quot;[http://en.wikipedia.org/wiki/Class_(computer_science) classes]&amp;quot; in popular languages). Toward this end and depending on the language, objects can be interrelated and defined so that their relationships can produce code that is well-organized, easy to read, and reusable.&amp;lt;ref name=&amp;quot;oopref&amp;quot;&amp;gt;[http://en.wikipedia.org/wiki/Object-oriented_programming Object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Principles====&lt;br /&gt;
=====Encapsulation=====&lt;br /&gt;
Also referred to as &amp;quot;data hiding,&amp;quot; [http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) encapsulation] shields the programmer from the implementation details of an object. These implementation details would include [http://en.wikipedia.org/wiki/Local_variable private variables], special [http://en.wikipedia.org/wiki/Library_(computing) libraries], and [http://en.wikipedia.org/wiki/Data_structure data structures] that the programmer does not need to know in order to utilize the functionality offered by the object.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation (object-oriented programming)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Inheritance=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance] introduces the idea of objects sharing functionality in data or methods that are common. [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses Subclasses] can inherit data structures, functions, and attributes of their [http://en.wikipedia.org/wiki/Subclass_(computer_science)#Subclasses_and_superclasses superclasses] in order to create an object or [http://en.wikipedia.org/wiki/Class_hierarchy class hierarchy] that is effective in organizing data and methods in a logical manner.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Inheritance_(computer_science) Inheritance (computer science)] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=====Polymorphism=====&lt;br /&gt;
[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism] describes the idea of interfaces, where one data type can be defined that allows other dissimilar types to implement a common set of [http://en.wikipedia.org/wiki/Method_(computer_programming) methods] and [http://en.wikipedia.org/wiki/Field_(computer_science) fields]. This allows a high level of [http://en.wikipedia.org/wiki/Abstraction_(computer_science) abstraction] that allows programmers to write easily maintainable code.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming Polymorphism in object-oriented programming] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===History and transition===&lt;br /&gt;
Early forms of object oriented programming languages were created in the early 1960s with the creation of [http://en.wikipedia.org/wiki/Lisp_(programming_language) LISP] and an early form of ALGOL, with [http://en.wikipedia.org/wiki/Simula Simula 67] signaling the actual beginning of the object-oriented &amp;quot;revolution.&amp;quot; The development of object-oriented languages progressed through other languages like [http://en.wikipedia.org/wiki/Simula Smalltalk] and the archetypal C++ to arrive at many of the object oriented languages we have today.&amp;lt;ref name=&amp;quot;oopref&amp;quot;/&amp;gt; As processing capability has matured, so too have the capabilities of programming languages. More and more though, [http://en.wikipedia.org/wiki/Dynamic_programming_language dynamic programming languages] like [http://en.wikipedia.org/wiki/Ruby_(programming_language) Ruby] are being treated as &amp;quot;true&amp;quot; object-oriented languages because of their rapid prototpying ability and strong [http://en.wikipedia.org/wiki/Object-oriented_analysis_and_design object model].&lt;br /&gt;
&lt;br /&gt;
===Programming languages===&lt;br /&gt;
A complete list of object oriented languages is outside the scope of this document, but some major examples are [http://en.wikipedia.org/wiki/Boo_(programming_language) Boo], C++, C#, [http://en.wikipedia.org/wiki/COBOL COBOL 2002], [http://en.wikipedia.org/wiki/F_Sharp_(programming_language) F#], [http://en.wikipedia.org/wiki/Fortran Fortran 2003], Java, [http://en.wikipedia.org/wiki/Matlab MATLAB], [http://en.wikipedia.org/wiki/Objective_c Objective-C], [http://en.wikipedia.org/wiki/PHP PHP 5], [http://en.wikipedia.org/wiki/Python_(programming_language) Python], Ruby, and Visual Basic.&amp;lt;ref&amp;gt;[http://en.wikipedia.org/wiki/List_of_object-oriented_programming_languages List of object-oriented programming languages] at Wikipedia&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Structure comparison==&lt;br /&gt;
===Advantages and disadvantages===&lt;br /&gt;
==== Block-structured languages ====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* Simplicity&lt;br /&gt;
* Reduced coding and turnover time&lt;br /&gt;
* Dynamic lifetime of variables ([http://en.wikipedia.org/wiki/Scope_(computer_science) Scope]) provide efficient usage of memory since allocation and deletion occur at the entrance and exit of each block&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* Commercial projects are difficult to manage due to very large [http://en.wikipedia.org/wiki/Codebase codebase] sizes&lt;br /&gt;
* Reduced code reusability&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Computer_security Security] concerns, espcially in the realm of [http://en.wikipedia.org/wiki/Array#In_computer_science arrays] and accessing [http://en.wikipedia.org/wiki/Value_(computer_science) elements] that are [http://en.wikipedia.org/wiki/Privilege_(computing) out of bounds]&lt;br /&gt;
&lt;br /&gt;
====Object-Oriented languages====&lt;br /&gt;
=====Advantages=====&lt;br /&gt;
* The software objects model real world objects so program composition is well defined and structured&lt;br /&gt;
* Each object's definition and internal implementation is decoupled from other objects, making the system design inherently modular ([http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming) Encapsulation])&lt;br /&gt;
* Adding new features becomes easier because of inheritance, allowing the new class to contain the new feature in addition to all old features from the inherited class&lt;br /&gt;
* Debugging is easier since each object's internal mechanisms are independent of each other, which helps in isolating errors and fixing them&lt;br /&gt;
* Enhanced code reusability&lt;br /&gt;
&lt;br /&gt;
=====Disadvantages=====&lt;br /&gt;
* The complexity of object-oriented design becomes prohibitive when working on small projects&lt;br /&gt;
* Object-oriented programming paradigm is preferable for dynamic environments rather than simple environments&lt;br /&gt;
* Reduced time efficiency compared to block-structured languages&lt;br /&gt;
&lt;br /&gt;
===Summary of important differences===&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot; style=&amp;quot;font-size: 100%; text-align: center; width: auto;&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Difference&lt;br /&gt;
! Block Structured Languages&lt;br /&gt;
! Object-Oriented Languages&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem approach'''&lt;br /&gt;
| Top-down approach is followed&lt;br /&gt;
| [http://en.wikipedia.org/wiki/Top-down_and_bottom-up_design Bottom-up] approach is followed&lt;br /&gt;
|-&lt;br /&gt;
| '''Problem focus'''&lt;br /&gt;
| Focus is on the [http://en.wikipedia.org/wiki/Algorithm#Computer_algorithms algorithm] to solve the problem&lt;br /&gt;
| Focus is on getting the object design right&lt;br /&gt;
|-&lt;br /&gt;
| '''View of data and functions'''&lt;br /&gt;
| Views data and functions as separate entities&lt;br /&gt;
| Views data and functions as single entity&lt;br /&gt;
|-&lt;br /&gt;
| '''Cost of maintenance'''&lt;br /&gt;
| Maintenance is costly &lt;br /&gt;
| Maintenance is relatively cheaper&lt;br /&gt;
|-&lt;br /&gt;
| '''Software reuse'''&lt;br /&gt;
| Software reuse is not possible&lt;br /&gt;
| Software reuse is possible &lt;br /&gt;
|-&lt;br /&gt;
| '''Abstraction'''&lt;br /&gt;
| Function abstraction is used&lt;br /&gt;
| Data abstraction is used&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Effectiveness and durability of object oriented languages over block structured languages ===&lt;br /&gt;
&lt;br /&gt;
Although block structured languages were simpler and faster for smaller projects, when it comes to large commercial undertaking the manpower and tools required to maintain the code base is very prohibitive. It was very difficult to fix issues, add new features, and at the same time to make sure that the integrity of the code base is intact. Many projects were perpetually stagnant at 90% completion with issues coming up at the eleventh hour. All these problems led to the hastening of the move to object-oriented languages which showed it had the solutions to all the problems that block structured languages could not solve. The following four points are the most important reasons why object-oriented languages were more effective and durable that block structured languages:&lt;br /&gt;
* Maintenance - In block structured languages, especially in large projects, system maintenance became a challenge. Object oriented languages could counter this by providing clear demarcation between the objects and making it easier to work on individual aspects of the system without disturbing the other components.&lt;br /&gt;
* Data hiding - In block structured language system the data usually has global scope. Hence it is very difficult to monitor or supervise data access. This was solved by object-oriented languages by providing data encapsulation. The data and the corresponding attributes are put into a nice little package that was much easier to control and monitor.&lt;br /&gt;
* Code reuse - Object oriented languages are proponents of code reuse. Hence the code size could be reduced sufficiently enough when it comes to large projects to warrant a shift from block structured to object oriented languages.&lt;br /&gt;
* Feature additions - Object oriented languages provide a very cost effective and safe way to add new features to the existing system without causing the whole system to collapse. This feature is very important for large scale software vendors who provide various customizations.&lt;br /&gt;
&lt;br /&gt;
===Applicability between paradigms===&lt;br /&gt;
Object-oriented languages have solved many problems that block structured languages introduced. But all is not lost with block structured languages. They boast some very important features that are needed in any programming language. The simplicity and readability of code in block structured languages are enviable features indeed. Because of this very simplicity we find that block structured languages are very efficient in terms of speed and performance. Such a language would also provide the flexibility in moving legacy block structured systems to the object oriented paradigm seamlessly. A language that can capture both sides of the argument would be a formidable entry into the growing list of programming languages. This explains why we see C++ emerging as one of the most popular object oriented languages. It has both the block structured features of C and the object-oriented concepts built into it, thereby making it a very versatile and efficient programming language.&lt;br /&gt;
&lt;br /&gt;
==C/C++ Code Example==&lt;br /&gt;
{{Expand section}}&lt;br /&gt;
Below is a code example highlighting key differences between a block structured program and an object oriented program all in one source file.&lt;br /&gt;
&amp;lt;pre&amp;gt;// For block structure, leave the below line commented to compile in C&lt;br /&gt;
// For object oriented structure, uncomment the line to compile in C++&lt;br /&gt;
//#define USING_CPP&lt;br /&gt;
&lt;br /&gt;
#ifndef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C standard header files&lt;br /&gt;
#include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
#include &amp;lt;stdlib.h&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define the messages of each persona&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Define the function prototypes for delivering the different messages&lt;br /&gt;
char *getKingMessage();&lt;br /&gt;
char *getJesterMessage();&lt;br /&gt;
char *getPeonMessage();&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Go through and make each function call for...&lt;br /&gt;
	// The King&lt;br /&gt;
	printf(&amp;quot;And now a message from the king: %s\n&amp;quot;, getKingMessage());&lt;br /&gt;
	printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// The Court Jester&lt;br /&gt;
	printf(&amp;quot;And now a message from the court jester: %s\n&amp;quot;, getJesterMessage());&lt;br /&gt;
	printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	// A Peon&lt;br /&gt;
	printf(&amp;quot;And now a message from a peon: %s\n&amp;quot;, getPeonMessage());&lt;br /&gt;
	printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
	&lt;br /&gt;
	// Wait for user input before exiting&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the king&lt;br /&gt;
char *getKingMessage()&lt;br /&gt;
{&lt;br /&gt;
	return KING_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by the court jester&lt;br /&gt;
char *getJesterMessage()&lt;br /&gt;
{&lt;br /&gt;
	return JESTER_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Returns a string containing the text to be spoken by all peons&lt;br /&gt;
char *getPeonMessage()&lt;br /&gt;
{&lt;br /&gt;
	return PEON_MESSAGE;&lt;br /&gt;
}&lt;br /&gt;
#endif&lt;br /&gt;
&lt;br /&gt;
#ifdef USING_CPP&lt;br /&gt;
&lt;br /&gt;
// C++ standard headers&lt;br /&gt;
#include &amp;lt;cstdio&amp;gt;&lt;br /&gt;
#include &amp;lt;cstdlib&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// Define what each persona should say&lt;br /&gt;
#define KING_MESSAGE   &amp;quot;Read my lips: No new taxes&amp;quot;&lt;br /&gt;
#define JESTER_MESSAGE &amp;quot;My wife and I were happy for 20 years. Then we met.&amp;quot;&lt;br /&gt;
#define PEON_MESSAGE   &amp;quot;The king himself created his own worst enemy, just as tyrants everywhere do!&amp;quot;&lt;br /&gt;
&lt;br /&gt;
// Keep all classes clearly separated from other sections of code&lt;br /&gt;
namespace Monarchy&lt;br /&gt;
{&lt;br /&gt;
	// Define a basic class where a person has a label and something they want to say&lt;br /&gt;
	class Person&lt;br /&gt;
	{&lt;br /&gt;
	private:&lt;br /&gt;
		char *szMessage;&lt;br /&gt;
		char *szLabel;&lt;br /&gt;
&lt;br /&gt;
	public:&lt;br /&gt;
		// Allow a person to deliver their message&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			printf(&amp;quot;A now a message from %s: %s\n&amp;quot;, this-&amp;gt;szLabel, this-&amp;gt;szMessage);&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// A person needs to be initialized with a label and a message&lt;br /&gt;
		Person(char*label, char *msg)&lt;br /&gt;
		{&lt;br /&gt;
			this-&amp;gt;szLabel = label;&lt;br /&gt;
			this-&amp;gt;szMessage = msg;&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// The King is a person (and thus inherits from it)&lt;br /&gt;
	class King : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// The king has the same label, but his message might change according to the political winds&lt;br /&gt;
		King(char *msg) : Person(&amp;quot;the king&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Here, the function is being overridden...&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			// .. but the base class's DeliverMessage is still being called, in addition to the tag line&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;The King has spoken!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A peon is a person (and thus inherits from it)&lt;br /&gt;
	class Peon : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change according to his or her attitude toward the king&lt;br /&gt;
		Peon(char *msg) : Person(&amp;quot;a peon&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Like above, deliver the message, but always provide a common tag line&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;... but don't mind me!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
&lt;br /&gt;
	// A jester is a person (and thus inherits from it)&lt;br /&gt;
	class Jester : public Person&lt;br /&gt;
	{&lt;br /&gt;
	public:&lt;br /&gt;
		// A peon has the same label but his message might change if the king is sick of his jokes&lt;br /&gt;
		Jester(char *msg) : Person(&amp;quot;the court jester&amp;quot;, msg)&lt;br /&gt;
		{&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		// Might as well call him Fozzie ;)&lt;br /&gt;
		void DeliverMessage()&lt;br /&gt;
		{&lt;br /&gt;
			Person::DeliverMessage();&lt;br /&gt;
			printf(&amp;quot;Wocka wocka wocka!\n\n&amp;quot;);&lt;br /&gt;
		}&lt;br /&gt;
	};&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Main program entry point&lt;br /&gt;
int main()&lt;br /&gt;
{&lt;br /&gt;
	// Initialize some monarchy objects&lt;br /&gt;
	Monarchy::King TheKing(KING_MESSAGE);&lt;br /&gt;
	Monarchy::Jester Borat(JESTER_MESSAGE);&lt;br /&gt;
	Monarchy::Peon Bruno(PEON_MESSAGE);&lt;br /&gt;
&lt;br /&gt;
	// Let them deliver their messages&lt;br /&gt;
	TheKing.DeliverMessage();&lt;br /&gt;
	Borat.DeliverMessage();&lt;br /&gt;
	Bruno.DeliverMessage();&lt;br /&gt;
&lt;br /&gt;
	// Wait for user input&lt;br /&gt;
	system(&amp;quot;pause&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	return 0;&lt;br /&gt;
}&lt;br /&gt;
#endif&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Imperative_programming Imperative programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Functional_programming Functional programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Programming_paradigm Programming paradigm] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Class-based_programming Class-based programming] at Wikipedia&lt;br /&gt;
* [http://en.wikipedia.org/wiki/Prototype-based_programming Prototype-based programming] at Wikipedia&lt;br /&gt;
&lt;br /&gt;
==References==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Further reading==&lt;br /&gt;
* Freeman, Eric, Elisabeth Freeman, Kathy Sierra, and Bert Bates. ''Head First Design Patterns''. Sebastopol, CA: O'Reilly, 2004. Print.&lt;br /&gt;
* Liberty, Jesse. ''Sams Teach Yourself C++ in 24 Hours''. Indianapolis, IN: Sams, 2002. Print.&lt;br /&gt;
* ''Microsoft Visual C++ Language Reference''. Redmond, WA: Microsoft, 1997. Print.&lt;br /&gt;
* Weiss, Mark Allen. ''Data Structures &amp;amp; Algorithm Analysis in Java''. Reading, MA: Addison-Wesley, 1999. Print.&lt;br /&gt;
* Mohamed Fayad, Mauri Laitinen. &amp;quot;TRANSITION TO OBJECT-ORIENTED SOFTWARE DEVELOPMENT.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
==External links==&lt;br /&gt;
* [http://www.slideshare.net/spajus/object-oriented-programming-presentation-933801 Object Oriented Programming] at slide'''share'''&lt;br /&gt;
* [http://www.developer.com/java/other/article.php/3493761/The-Evolution-of-Object-Oriented-Languages.htm The Evolution of Object-Oriented Languages]&lt;br /&gt;
* [http://www.xp2003.org/the-history-of-oop.htm The History of OOP]&lt;br /&gt;
* [http://www.brighthub.com/internet/web-development/articles/82024.aspx Structured vs. Object-Oriented Programming: A Comparison]&lt;/div&gt;</summary>
		<author><name>Sramach5</name></author>
	</entry>
</feed>