Prior to modern networking solutions there existed workstations that were connected to a massive Mainframe computer that was solely responsible for memory management, processes and almost everything. The workstations would just render the information sent in from the Mainframe console.
But in the mid 90's, with the prices of Unix servers dropping, the trend was moving away from Mainframe computing toward Client-Server computing. This would enable rich clients to be developed on workstations while they would communicate with a centralized server, serving computers connected to it, to either communicate with other workstations also connected to it or it would request for database access or business logic stored on the server itself. The workstations were called clients.
This form of computing gave rise to the notion of the Front-end and Back-end programming. In it's hey-day, Java came up with different ways of making networking between computers possible. In this chapter, we would be looking at some of these ways. Listed below are two of the frameworks that Java uses to enable network programming. We would be exploring both of these in this chapter.
Tuesday, October 7, 2008
JAVA PROGRAMMING REFLECTION
Reflection is a new concept in Java, and did not exist in classical compiled languages like C, and C++. The idea is to discover an object's attributes and its methods progrematically.
Reflection is the mechanism by which Java exposes the features of a class during runtime, allowing Java programs to enumerate and access a class' methods, fields, and constructors as objects. In other words, there are object based mirrors which reflect the Java object model, and you can use these objects to access an object's features using runtime API constructs instead of compile time language constructs.
Each object instance has a getClass() method, inherited from java.lang.Object, which returns an object with the runtime representation of that object's class; this object is an instance of the java.lang.Class This object in turn has methods which return the fields, methods, constructors, superclass, and other properties of that class.
You can use these reflection objects to access fields, invoke methods, or instantiate instances, all without having compile time dependencies on those features. The Java runtime provides the corresponding classes for reflection. Most of the Java classes which support reflection are in the java.lang.reflect package.
Reflection is most useful for performing dynamic operations with Java - operations which are not hard coded into a source program but which are determined at run time. One of the most important aspects of reflection is dynamic class loading.
Reflection is the mechanism by which Java exposes the features of a class during runtime, allowing Java programs to enumerate and access a class' methods, fields, and constructors as objects. In other words, there are object based mirrors which reflect the Java object model, and you can use these objects to access an object's features using runtime API constructs instead of compile time language constructs.
Each object instance has a getClass() method, inherited from java.lang.Object, which returns an object with the runtime representation of that object's class; this object is an instance of the java.lang.Class This object in turn has methods which return the fields, methods, constructors, superclass, and other properties of that class.
You can use these reflection objects to access fields, invoke methods, or instantiate instances, all without having compile time dependencies on those features. The Java runtime provides the corresponding classes for reflection. Most of the Java classes which support reflection are in the java.lang.reflect package.
Reflection is most useful for performing dynamic operations with Java - operations which are not hard coded into a source program but which are determined at run time. One of the most important aspects of reflection is dynamic class loading.
Subscribe to:
Posts (Atom)