y
nl
O
se
U
tre
en
Session: 11 C
h
ec
Frameworks and Reflection
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited.
y
nl
Explain Software framework
O
List examples of Frameworks
se
Explain Microsoft .NET framework and Java AWT API
U
tre
List Advantages and Disadvantages of Framework
en
Explain Reflection
List examples of Reflection C
h
Explain Java and C# Reflection API
ec
List Advantages and Disadvantages of Reflection
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 2
y
nl
O
Framework
se
U
tre
en
C
h
ec
Basic Structure
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 3
y
When a building is under construction
nl
O
se
Framework
U
tre
en
C
h
ec
pt
rA
Fo
Basic Structure - Base
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 4
y
nl
In OOP, a framework is a set of reusable software
O
components or classes that form the basis of an
se
application.
U
tre
The two broad categories of methods in a class are:
en
Foundation Methods
Specialization Methods C
h
ec
pt
Frameworks consist of sections known as
rA
Fo
sections and sections.
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 5
y
nl
O
se
U
tre
en
C
h
ec
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 6
y
nl
Creates Windows-based as well as Web-based
O
applications
se
U
The .NET framework
tre
stack is shown in the
en
figure.
C
h
ec
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 7
y
The table shows the .NET framework versions and their
nl
compatible Visual Studio versions.
O
.NET Version Release Visual Studio Version Windows Default
se
Year
U
1.0 2002 Visual Studio.NET Windows XP Tablet and Media
Center Editions
tre
1.1 2003 Visual Studio 2003 Windows Server 2003
en
2.0 2005 Visual Studio 2005 Windows Server 2003 R2
3.0 2006 -
C Windows Vista, Windows
h
Server 2008
ec
3.5 2007 Visual Studio 2008 Windows 7, Windows Server
pt
2008 R2
rA
4.0 2010 Visual Studio 2010 Windows 7
Fo
4.5 (consumer 2012 Visual Studio ‘11’ Windows 8, Windows Server 8
preview)
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 8
y
nl
The higher versions of .NET Framework such as 3.0,
O
3.5, and 4.0 consist of new libraries such as:
se
U
tre
en
C
h
ec
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 9
y
nl
Used for creating GUIs for Java programs
O
se
The class
U
hierarchy of
tre
AWT is shown
en
in the figure.
C
h
ec
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 10
y
nl
A component is any object that can be displayed on the
O
screen with which the user can interact.
se
U
A Container is a special type of component that can
tre
hold other components within it.
en
C
h
ec
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 11
y
nl
A LayoutManager is an interface that designs the
O
display area of an application based on the type of
se
layout selected by the user.
U
tre
The hierarchy of the LayoutManager is shown in the
en
figure.
C
h
ec
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 12
y
nl
AWT provides another set of interfaces called listeners
O
to handle the actions done by users on these
se
components.
U
tre
The listener hierarchy is shown in the figure.
en
C
h
ec
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 13
y
nl
Mirror image of an object
O
se
The figure shows the mirror image or reflection of a
U
person in the mirror.
tre
en
C
h
ec
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 14
y
nl
O
Reflection enables the
se
code to retrieve information
U
regarding the fields,
tre
methods, constructors, and
en
other members of the class
C
and use that information to
h
ec
manipulate the internal
pt
properties of the program.
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 15
y
nl
Reflection is the ability of a code to retrieve its own
O
metadata for the purpose of finding modules,
se
assemblies, and type information at runtime.
U
tre
C# provides the ‘System.Reflection’ namespace and
en
Java provides the ‘java.lang.reflect’ package for
C
implementing reflection in the program.
h
ec
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 16
y
nl
A framework is a set of reusable software components
O
or classes that form the basis of an application.
se
Foundation methods are one that become a part of a
U
child class through inheritance but are not overridden
tre
in the child class.
en
Specialization methods are declared in the parent but
C
implemented in the child, that is, they are overridden
h
in the child class.
ec
pt
.NET Framework is a software framework that consists
rA
of a large library of classes and provides language
interoperability between the various languages
Fo
supported by the framework.
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 17
y
nl
Java provides the class library called Abstract Window
O
Toolkit (AWT) which is a collection of a number of
se
common graphical components used for designing the
U
GUI of a Java application.
tre
Reflection is the ability of a program to ‘examine’ or
en
‘introspect’ itself.
C
C# provides the ‘System.Reflection’ namespace and
h
Java provides the ‘java.lang.reflect’ package for
ec
implementing reflection in the program.
pt
rA
Fo
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 11 18