Object oriented programming using

UNIT-1

Introduction: Approaches to Software Design, Evolution of the Object Model, Benefits of Object Programming; Object Model: Objects, Classes, Sub-classing and Inheritance, Polymorphism

Object Programming in Windowed Environments: Benefits of OOP in Windowed Application Environments, Application Frameworks and Class Libraries. ------Introduction

Software design is a process to conceptualize the software requirements into software implementation.

Software design takes the user requirements as challenges and tries to find optimum solution.

Number of Issues that must be addressed in software design that are maintainability, reusability, portability, security, integrity, and user friendliness of software products.

There are multiple variants of software design. Let us study them briefly:

Structured Design Structured design is a conceptualization of problem into several well-organized elements of solution.

It is basically concerned with the solution design.

Benefit of structured design is, it gives better understanding of how the problem is being solved.

Structured design is mostly based on ‘divide and conquer’ strategy where a problem is broken into several small problems and each small problem is individually solved until the whole problem is solved.

The small pieces of problem are solved by means of solution modules.

These modules are arranged in hierarchy. They communicate with each other.

A good structured design always follows some rules for communication among multiple modules, namely -

Cohesion - grouping of all functionally related elements.

Coupling - communication between different modules.

A good structured design has high cohesion and low coupling arrangements.

Function Oriented Design In function-oriented design, the system is comprised of many smaller sub- systems known as functions.

These functions are capable of performing significant task in the system.

Function oriented design inherits some properties of structured design where divide and conquer methodology is used.

This design mechanism divides the whole system into smaller functions, which provides means of abstraction by concealing the information and their operation.

These functional modules can share information among themselves by means of information passing and using information available globally.

Object Oriented Design Object oriented design works around the entities and their characteristics instead of functions involved in the software system.

The whole concept of software solution revolves around the engaged entities.

Let us see the important concepts of Object Oriented Design:

 Objects - All entities involved in the solution design are known as objects. For example, person, banks, company and customers are treated as objects. Every entity has some attributes associated to it and has some methods to perform on the attributes.

 Classes - A class is a generalized description of an object. An object is an instance of a class. Class defines all the attributes, which an object can have and methods, which defines the functionality of the object.

In the solution design, attributes are stored as variables and functionalities are defined by means of methods or procedures.

 Encapsulation - In OOD, the attributes (data variables) and methods (operation on the data) are bundled together is called encapsulation. Encapsulation not only bundles important information of an object together, but also restricts access of the data and methods from the outside world. This is called information hiding.

 Inheritance - OOD allows similar classes to stack up in hierarchical manner where the lower or sub-classes can import, implement and re- use allowed variables and methods from their immediate super classes. This property of OOD is known as inheritance. This makes it easier to define specific class and to create generalized classes from specific ones.  Polymorphism - OOD languages provide a mechanism where methods performing similar tasks but vary in arguments, can be assigned same name. This is called polymorphism, which allows a single interface performing tasks for different types. Depending upon how the function is invoked, respective portion of the code gets executed.

Software Design Approaches Here are two generic approaches for software designing:

Top down Design We know that a system is composed of more than one sub-systems and it contains a number of components.

Top-down design takes the whole software system as one entity and then decomposes it to achieve more than one sub-system or component based on some characteristics.

Each sub-system or component is then treated as a system and decomposed further.

This process keeps on running until the lowest level of system in the top-down hierarchy is achieved.

Top-down design starts with a generalized model of system and keeps on defining the more specific part of it. When all components are composed the whole system comes into existence.

Top-down design is more suitable when the software solution needs to be designed from scratch and specific details are unknown.

Bottom-up Design The bottom up design model starts with most specific and basic components. It proceeds with composing higher level of components by using basic or lower level components.

It keeps creating higher level components until the desired system is not evolved as one single component. With each higher level, the amount of abstraction is increased.

Bottom-up strategy is more suitable when a system needs to be created from some existing system, where the basic primitives can be used in the newer system.

Both, top-down and bottom-up approaches are not practical individually. Instead, a good combination of both is used.

The algorithms are designed using two approaches that are the top-down and bottom-up approach.

In the top-down approach, the complex module is divided into submodules.

On the other hand, bottom-up approach begins with elementary modules and then combine them further.

The prior purpose of an algorithm is to operate the data comprised in the datastructure.

In other words, an algorithm is used to perform the operations on the data inside the data structures.

Comparison Chart

BASIS FOR TOP-DOWN APPROACH BOTTOM-UP APPROACH COMPARISON

Basic Breaks the massive problem Solves the fundamental

into smaller sub problems. low-level problem and

integrates them into a

larger one.

Process Submodules are solitarily Examine what data is to

be encapsulated, and BASIS FOR TOP-DOWN APPROACH BOTTOM-UP APPROACH COMPARISON

analysed. implies the concept of

information hiding.

Communication Not required in the top-down Needs a specific amount

approach. of communication.

Redundancy Contain redundant Redundancy can be

information. eliminated.

Programming Structure/procedural oriented Object-oriented languages programming languages (i.e. C) programming languages

follows the top-down approach. (like C++, Java, etc.)

follows the bottom-up

approach.

Mainly used in Module documentation, test Testing

case creation, code

implementation and

debugging.

Evolution of the Object Model

Evolution & Overview of Java By the end of 1980s and the early 1990s, Object-oriented programming using C++ took hold. For a brief moment, it seemed as if programmers had found the perfect language finally. C++ was a language that could be used to create a wide range of programs. However, forces were brewing that would drive computer language evolution forward once again. Within few years WWW (World Wide Web) and the Internet would reach critical mass. This event would cause another revolution in programming.

Java is general purpose language which is used for developing either Stand alone Programs or either you can develop We Programs or Web Applets First of all program of java is Compiled then it is transferred into the byte codes For Executing java programs java name of the is used for Converting the java program into the byte code and then by using the interpreter we converts the Bytes code into the machine language.

If we simply execute the programs on our Machine then it is called as the Stand Alone Programs but if we using the Applets for which includes Graphical Environment then it is called as Web Applets.

JAVA History Every Languages have a history or Every Language has a past Java is Developed in 1991 in USA And it was Called as OAK and it is Developed by name of the Engineer of the Microsoft Sun Team. Java Was Developed For Developing the Electronics' things Like VCR, Televisions etc. The History of Java Includes.

In 1990 Sun Microsoft Team develop java for Electronics Things but in 1991 java was Comes with the new name Called as OAK then After that in 1992 java was come with the new idea of developing Software's for the Handheld Devices Like Mobile Phones ,Pagers etc.

But in 1993 Java Was So Popular in the World Wide Web or in the Internet For Developing Games and Graphical Applications with the help of Applets The Most Important usable thing in Graphical Programming.

Features of Java Compiled and Interpreter Java has both Compiled and Interpreter Feature Program of java is First Compiled and Then it is must to Interpret it .First of all The Program of java is Compiled then after Compilation it creates Bytes Codes rather than Machine Language Then After Bytes Codes are Converted into the Machine Language is Converted into the Machine Language with the help of the Interpreter So For Executing the java Program First of all it is necessary to Compile it then it must be Interpret.

Platform Independent Java Language is Platform Independent means program of java is Easily transferable because after Compilation of java program bytes code will be created then we have to just transfer the Code of Byte Code to another Computer This is not necessary for computers having same Operating System in which the code of the java is Created and Executed After Compilation of the Java Program We easily Convert the Program of the java top the another Computer for Execution.

Object-Oriented We Know that is purely OOP Language that is all the Code of the java Language is Written into the classes and Objects So For This feature java is Most Popular Language because it also Supports Code Reusability, Maintainability etc.

Robust and Secure The Code of java is Robust and Secure Means to first checks the reliability of the code before Execution When We trying to convert the higher data type into the Lower Then it Checks the Demotion of the Code the It Will Warns a User to Not to do this So it is called as Robust.

Secure When We convert the Code from One Machine to Another the First Check the Code either it is Effected by the Virus or not or it Checks the Safety of the Code if code contains the Virus then it will never Executed that code on to the Machine.

Distributed Java is Distributed Language Means because the program of java is compiled onto one machine can be easily transferred to another machine and Executes them on another machine because facility of Bytes Codes So java is Specially designed For Internet Users which uses the Remote Computers For Executing their Programs on local machine after transferring the Programs from Remote Computers or either from the internet.

Simple Small and Familiar Java is a simple Language Because it contains many features of other Languages like c and C++ and Java Removes Complexity because it doesn't use pointers, Storage Classes and Go to Statements and java Doesn't support Multiple Inheritance.

Multithreaded and Interactive Java uses Multithreaded Techniques For Execution Means Like in other in Structure Languages Code is Divided into the Small Parts Like These Code of java is divided into the Smaller parts those are Executed by java in Sequence and Timing Manner this is Called as Multithreaded In this Program of java is divided into the Small parts those are Executed by Compiler of java itself Java is Called as Interactive because Code of java Supports Also CUI and Also GUI Programs.

Dynamic and Extensible Code Java has Dynamic and Extensible Code Means With the Help of OOPS java Provides Inheritance and With the Help of Inheritance we Reuse the Code that is Pre-defined and Also uses all the built in Functions of java and Classes.

How Java Differs from C and C++?

C Uses header Files but java uses Packages. C Uses Pointers but java doesn't supports pointers. Java doesn't supports storage classes like auto, external etc. The Code of C Language is Converted into the Machine code after Compilation But in Java Code First Converted into the Bytes Codes then after it is converted into the Machine Code. C++ supports Operator Overloading but java doesn't Supports Operator Overloading. In C++ Multiple Inheritance is Possible but in java A Class Can not Inherit the features from the two classes in other words java doesn't supports Multiple Inheritance The Concept of Multiple Inheritances is Introduced in the Form of Interfaces. Java Uses import statement for including the contents of screen instead of #include. Java Doesn't uses goto. Java Doesn't have Destructor like C++ Instead Java Has finalize Method. Java Doesn't have Structure Union , enum data types.

Difference between C and C++ S. No. C C++ C is a structural or procedural C++ is an object oriented 1 programming language. programming language. Emphasis is on procedure or steps Emphasis is on objects rather than 2 to solve any problem. procedure. Functions are the fundamental Objects are the fundamental 3 building blocks. building blocks. Data is hidden and can’t be 4 In C, the data is not secured. accessed by external functions.

5 C follows top down approach. C++ follows bottom up approach C uses scanf() and printf() function C++ uses cin>> and cout<< for 6 for standard input and output. standard input and output. Variables must be defined at the beginning in the function. Modern C such as gcc support the C99 and C11 standards, which allow you to declare a variable Variables can be defined anywhere 7 anywhere. in the function. In C++, namespace feature is 8 In C, namespace feature is absent. present.

9 C is a middle level language. C++ is a high level language. Programs are divided into modules Programs are divided into classes 10 and functions. and functions. C doesn’t support exception handling directly. Can be done by C++ supports exception handling. 11 using some other functions. Done by using try and catch block. Features like function overloading and operator overloading is C++ supports function overloading 12 not present. and operator overloading. C program file is saved with .C C++ program file is saved with .CPP 13 extension. extension.

Comparison chart of C++ and Java C++ JAVA

C++ was developed by Bjarne Java was developed by James 1. Stroustrup. Development began in Gosling and his team. Development 1979. began in 1991. Java is both compiled and 2. C++ is a compiled language. interpreted. C++ supports conditional Java does not support conditional 3. compilation and inclusion. compilation.

Java programs are platform independent. Java programs are C++ programs are platform written for 4. dependent. They need to be (JVM) and wherever a JVM is compiled for a particular platform. installed, Java program will run without needing recompilation.

C++ does support operator Java does not support operator 5. overloading. Function overloading overloading. However, function is also available. overloading is possible.

Java has restricted support for pointers. Pointers are supported 6. C++ fully support pointers. internally you can not writer pointer programs. 7. C++ supports structures. Java does not support structures. 8. C++ supports unions. Java does not support unions. C++ does not have built-in support 9. Java fully supports threads. for threads. C++ supports manual object Java relies on automatic garbage 10. management through new collection. It does not support and delete keywords. destructors the way C++ does.

C++ supports goto statement Java does not support goto statement (however the use of goto is 11. (although gotois a reserved keyword discouraged as not considered a in Java) good practice) Java does not really support multiple C++ supports multiple inheritance. But similar results can 12. inheritance. be achieved through the use of interfaces. C++ provides support both for call 13. Java supports only call by value. by value and call by reference. C++ does not support comments In Java programs, you can write 14. within source code. comments using /** … */ C++ has no support for Java supports the unsigned right 15. the unsigned right shift operator shift >>> operator. ( >>> ). Comparison chart of C++ and Java C++ JAVA

Java does not support virtual keyword. All the non- C++ provides virtual keyword to 16. static Java functions are by default support function overriding. virtual in nature, and therefore, can be overridden.

Java and Internet Java is also most popular language on web because java provides us the facility of Applets those are used for Creating Graphical Applications From Internet a user can download any application and Execute in the Applet.

Java and World Wide Web About the time that the details of Java were being worked out, a second, and ultimately, more important, factor was emerging that would play a crucial role in the future of Java. This second force was, of course, the World Wide Web. Had the web not taken shape at about the same time Java was being implemented, with the emergence of the World Wide Web. Java was propelled to the forefront of computer language design, because the web, too demanded portable programs.

Java Environment Java Environment includes Classes and Several Methods in the Form Packages or we can also Called them as the Development Tools The Tools those provides us the Facility to create java Applications are also Known as the The Development Kit of the java Includes Several Classes and their methods and properties The Java Development Kit, name of the Development tools that is used for creating any applications.

Java Development Kit: Java Development Kit Comes with a collection of tools that are used for developing and Running java programs. 1) Javac :- Compiler used for Compiling java programs. 2) Java :- For Interpreting java programs. 3) Appletviewer :- For Running Applets. 4) Jdb:- For Connecting java to Database.

Process of building and running java application program

History of Java 1. History of Java 2. Java Version History

The history of Java is very interesting. Java was originally designed for interactive television, but it was too advanced technology for the digital cable television industry at the time. The history of java starts with Green Team. Java team members (also known as Green Team), initiated this project to develop a language for digital devices such as set-top boxes, televisions, etc. However, it was suited for internet programming. Later, Java technology was incorporated by Netscape.

The principles for creating Java programming were "Simple, Robust, Portable, Platform-independent, Secured, High Performance, Multithreaded, Architecture Neutral, Object-Oriented, Interpreted and Dynamic".

Currently, Java is used in internet programming, mobile devices, games, e- business solutions, etc. There are given the significant points that describe the history of Java. Java is a general-purpose computer-programming language that is concurrent, class-based, object-oriented,[15]and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers "write once, run anywhere" (WORA),[16] meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.[17] Java applications are typically compiled to bytecode that can run on any Java virtual machine (JVM) regardless of computer architecture. As of 2016, Java is one of the most popular programming languages in use,[18][19][20][21] particularly for client-server web applications, with a reported 9 million developers.[22] Java was originally developed by James Gosling at (which has since been acquired by ) and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.

Java is all-encompassing us, but that wasn’t the case; it had effortless starts. It all began in 1990 when Sun Microsystems engineer became more annoyed with the situation of Sun’s C++ and C and was granted the chance to create an alternative language as part of The Stealth Project.

The Stealth Project soon changed to the Green Project, with Mike Sheridan and James Gosling joining the ranks, and the group began developing new technology for programming next-generation smart appliances.

A compiled code was unproductive for other processors, and it had to be recompiled. So the partners of 5 also called as Green Team started to work towards generating an accessible and cost-efficient resolution. They worked for 18 months in establishing a flexible, platform-independent language that could create a code which can run on the diversity of processors under different environments. The above necessity led to the creation of Java.

1) James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project in June 1991. The small team of sun engineers called Green Team.

2) Originally designed for small, embedded systems in electronic appliances like set-top boxes.

3) Firstly, it was called "Greentalk" by James Gosling, and file extension was .gt.

4) After that, it was called Oak and was developed as a part of the Green project.

Why Java named "Oak"?

5) Why Oak? Oak is a symbol of strength and chosen as a national tree of many countries like U.S.A., France, Germany, Romania, etc.

6) In 1995, Oak was renamed as "Java" because it was already a trademark by Oak Technologies.

Why Java Programming named "Java"?

7) Why had they chosen java name for java language? The team gathered to choose a new name. The suggested words were "dynamic", "revolutionary", "Silk", "jolt", "DNA", etc. They wanted something that reflected the essence of the technology: revolutionary, dynamic, lively, cool, unique, and easy to spell and fun to say.

According to James Gosling, "Java was one of the top choices along with Silk". Since Java was so unique, most of the team members preferred Java than other names.

8) Java is an island of Indonesia where first coffee was produced (called java coffee).

9) Notice that Java is just a name, not an acronym. 10) Initially developed by James Gosling at Sun Microsystems (which is now a subsidiary of Oracle Corporation) and released in 1995.

11) In 1995, Time magazine called Java one of the Ten Best Products of 1995.

12) JDK 1.0 released in(January 23, 1996). Java Version History

Many java versions have been released till now. The current stable release of Java is Java SE 10.

1. JDK Alpha and Beta (1995) 2. JDK 1.0 (23rd Jan 1996) 3. JDK 1.1 (19th Feb 1997) 4. J2SE 1.2 (8th Dec 1998) 5. J2SE 1.3 (8th May 2000) 6. J2SE 1.4 (6th Feb 2002) 7. J2SE 5.0 (30th Sep 2004) 8. Java SE 6 (11th Dec 2006) 9. Java SE 7 (28th July 2011) 10. Java SE 8 (18th March 2014) 11. Java SE 9 (21st Sep 2017) 12. Java SE 10 (20th March 2018)

Benefits of OOPS:

The advantages of OOP are mentioned below:

 OOP provides a clear modular structure for programs.

 It is good for defining abstract data types.

 Implementation details are hidden from other modules and other modules has a clearly defined interface.

 It is easy to maintain and modify existing code as new objects can be created with small differences to existing ones.

 Objects, methods, instance, message passing, inheritance are some important properties provided by these particular languages.

 Encapsulation, polymorphism, abstraction are also counts in these fundamentals of programming language.

 It implements real life scenario.

 In OOP, programmer not only defines data types but also deals with operations applied for data structures. OOPs (Object-Oriented Programming System)

Object means a real-world entity such as a pen, chair, table, computer, watch, etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes and objects. It simplifies the software development and maintenance by providing some concepts:

o Object o Class o Inheritance o Polymorphism o Abstraction o Encapsulation

Object

Any entity that has state and behaviour is known as an object. For example a chair, pen, table, keyboard, bike, etc. It can be physical or logical.

An Object can be defined as an instance of a class. An object contains an address and takes up some space in memory. Objects can communicate without knowing the details of each other's data or code. The only necessary thing is the type of message accepted and the type of response returned by the objects.

Example: A dog is an object because it has states like color, name, breed, etc. as well as behaviours like wagging the tail, barking, eating, etc.

Class

Collection of objects is called class. It is a logical entity.

A class can also be defined as a blueprint from which you can create an individual object. Class doesn't consume any space.

Inheritance

When one object acquires all the properties and behaviours of a parent object, it is known as inheritance. It provides code reusability. It is used to achieve runtime polymorphism.

Polymorphism

If one task is performed by different ways, it is known as polymorphism. For example: to convince the customer differently, to draw something, for example, shape, triangle, rectangle, etc.

In Java, we use method overloading and method overriding to achieve polymorphism.

Another example can be to speak something; for example, a cat speaks meow, dog barks woof, etc.

Abstraction

Hiding internal details and showing functionality is known as abstraction. For example phone call, we don't know the internal processing.

In Java, we use abstract class and interface to achieve abstraction.

Encapsulation

Binding (or wrapping) code and data together into a single unit are known as encapsulation. For example capsule, it is wrapped with different medicines.

A java class is the example of encapsulation. Java bean is the fully encapsulated class because all the data members are private here.

Subclasses, Superclasses, and Inheritance

To recap what you've seen before, classes can be derived from other classes. The derived class (the class that is derived from another class) is called a subclass. The class from which it's derived is called the superclass. The following figure illustrates these two types of classes:

In fact, in Java, all classes must be derived from some class. Which leads to the question "Where does it all begin?" The top-most class, the class from which all other classes are derived, is the Object class defined in java.lang. Object is the root of a hierarchy of classes, as illustrated in the following figure.

The subclass inherits state and behaviour in the form of variables and methods from its superclass. The subclass can use just the items inherited from its superclass as is, or the subclass can modify or override it. So, as you drop down in the hierarchy, the classes become more and more specialized:

Environment Setup If you are still willing to set up your environment for Java programming language, then this section guides you on how to download and set up Java on your machine. Following are the steps to set up the environment.

Java SE is freely available from the link Download Java. You can download a version based on your operating system.

Follow the instructions to download Java and run the .exe to install Java on your machine. Once you installed Java on your machine, you will need to set environment variables to point to correct installation directories −

Setting Up the Path for Windows Assuming you have installed Java in c:\Program Files\java\jdk directory −

Right-click on 'My Computer' and select 'Properties'.

Click the 'Environment variables' button under the 'Advanced' tab.

Now, alter the 'Path' variable so that it also contains the path to the Java executable. Example, if the path is currently set to 'C:\WINDOWS\SYSTEM32', then change your path to read 'C:\WINDOWS\SYSTEM32;c:\Program Files\java\jdk\bin'.

Setting Up the Path for , UNIX, Solaris, FreeBSD Environment variable PATH should be set to point to where the Java binaries have been installed. Refer to your shell documentation, if you have trouble doing this.

Example, if you use bash as your shell, then you would add the following line to the end of your '.bashrc: export PATH = /path/to/java:$PATH'

In Windows inorder to set

Step 1 : Right Click on MyComputer and click on properties . Step 2 : Click on Advanced tab

Step 3: Click on Environment Variables

Step 4: Create a new class path for JAVA_HOME

Step 5: Enter the Variable name as JAVA_HOME and the value to your jdk bin path ie c:\Programfiles\Java\jdk-1.6\bin and NOTE Make sure u start with .; in the Value so that it doesn't corrupt the other environment variables which is already set.

Step 6 : Follow the Above step and edit the Path in System Variables add the following ;c:\Programfiles\Java\jdk-1.6\bin in the value column. Step 7 :Your are done setting up your environment variables for your Java , In order to test it go to command prompt and type java who will get a list of help doc

In order make sure whether compiler is setup Type in cmd

javac who will get a list related to javac

How to set path in Java 1. How to set the path of JDK in Windows OS 1. Setting Temporary Path of JDK 2. Setting Permanent Path of JDK 2. How to set the path of JDK in Linux OS

The path is required to be set for using tools such as javac, java, etc.

If you are saving the Java source file inside the JDK/bin directory, the path is not required to be set because all the tools will be available in the current directory.

However, if you have your Java file outside the JDK/bin folder, it is necessary to set the path of JDK.

There are two ways to set the path in Java:

1. Temporary 2. Permanent 1) How to set the Temporary Path of JDK in Windows

To set the temporary path of JDK, you need to follow the following steps:

o Open the command prompt o Copy the path of the JDK/bin directory o Write in command prompt: set path=copied_path

For Example:

set path=C:\Program Files\Java\jdk1.6.0_23\bin

Let's see it in the figure given below:

2) How to set Permanent Path of JDK in Windows

For setting the permanent path of JDK, you need to follow these steps:

o Go to MyComputer properties -> advanced tab -> environment variables -> new tab of user variable -> write path in variable name -> write path of bin folder in variable value -> ok -> ok -> ok

For Example:

1) Go to MyComputer properties

2) Click on the advanced tab

3) Click on environment variables

4) Click on the new tab of user variables

5) Write the path in the variable name

6) Copy the path of bin folder

7) Paste path of bin folder in the variable value

8) Click on ok button

9) Click on ok button

Now your permanent path is set. You can now execute any program of java from any drive.

Setting Java Path in Linux OS

Setting path in Linux OS is the same as setting the path in the Windows OS. But, here we use the export tool rather than set. Let's see how to set path in Linux OS:

export PATH=$PATH:/home/jdk1.6.01/bin/

Here, we have installed the JDK in the home directory under Root (/home).

Popular Java Editors To write your Java programs, you will need a text editor. There are even more sophisticated IDEs available in the market. But for now, you can consider one of the following −

Notepad − On Windows machine, you can use any simple text editor like Notepad (Recommended for this tutorial), TextPad.

Netbeans − A Java IDE that is open-source and free which can be downloaded from https://www.netbeans.org/index.html.

Eclipse − A Java IDE developed by the open-source community and can be downloaded from https://www.eclipse.org/.

Benefits of OO application frameworks

The primary benefits of OO application frameworks stem from the modularity, reusability, extensibility, and inversion of control they provide to developers, as described below:

 Modularity -- Frameworks enhance modularity by encapsulating volatile implementation details behind stable interfaces. Framework modularity helps improve software quality by localizing the impact of design and implementation changes. This localization reduces the effort required to understand and maintain existing software.  Reusability -- The stable interfaces provided by frameworks enhance reusability by defining generic components that can be reapplied to create new applications. Framework reusability leverages the domain knowledge and prior effort of experienced developers in order to avoid re- creating and re-validating common solutions to recurring application requirements and software design challenges. Reuse of framework components can yield substantial improvements in programmer productivity, as well as enhance the quality, performance, reliability and interoperability of software.  Extensibility -- A framework enhances extensibility by providing explicit hook methods [Pree:94] that allow applications to extend its stable interfaces. Hook methods systematically decouple the stable interfaces and behaviors of an application domain from the variations required by instantiations of an application in a particular context. Framework extensibility is essential to ensure timely customization of new application services and features.  Inversion of control -- The run-time architecture of a framework is characterized by an ``inversion of control.'' This architecture enables canonical application processing steps to be customized by event handler objects that are invoked via the framework's reactive dispatching mechanism. When events occur, the framework's dispatcher reacts by invoking hook methods on pre-registered handler objects, which perform application-specific processing on the events. Inversion of control allows the framework (rather than each application) to determine which set of application-specific methods to invoke in response to external events (such as window messages arriving from end-users or packets arriving on communication ports).

Application Framework

An application framework is a software that provides a fundamental structure to support the development of applications for a specific environment. An application framework acts as the skeletal support to build an application. The intention of designing application frameworks is to lessen the general issues faced during the development of applications. This is achieved through the use of code that can be shared across different modules of an application. Application frameworks are used not only in the (GUI) development, but also in other areas like web-based applications.

Application frameworks are not a recently emerged idea. Some of the old application frameworks that are still used today are the SmallTalk user interface framework, MacApp (for Macintosh), and Struts (for Web-based Java applications).

Application Framework Types Although the benefits and design principles underlying frameworks are largely independent of domain to which they are applied, we've found it useful to classify frameworks by their scope, as follows: • System infrastructure frameworks -- These frameworks simplify the development of portable and efficient system infrastructure such as operating system [Campbell-Islam:93] and communication frameworks [Schmidt:97], and frameworks for user interfaces and language processing tools. System infrastructure frameworks are primarily used internally within a software organization and are not sold to customers directly. • Middleware integration frameworks -- These frameworks are commonly used to integrate distributed applications and components. Middleware integration frameworks are designed to enhance the ability of software developers to modularize, reuse, and extend their software infrastructure to work seamlessly in a distributed environment. There is a thriving market for Middleware integration frameworks, which are rapidly becoming commodities. Common examples include ORB frameworks, message-oriented middleware, and transactional databases. • Enterprise application frameworks -- These frameworks address broad application domains (such as telecommunications, avionics, manufacturing, and financial engineering [Birrer:93]) and are the cornerstone of enterprise business activities [Fayad-Hamu:97]. Relative to System infrastructure and Middleware integration frameworks, Enterprise frameworks are expensive to develop and/or purchase. However, Enterprise frameworks can provide a substantial return on investment since they support the development of end- user applications and products directly. In contrast, System infrastructure and Middleware integration frameworks focus largely on internal software development concerns. Although these frameworks are essential to rapidly create high quality sofware, they typically don't generate substantial revenue for large enterprises. As a result, it's often more cost effective to buy System infrastructure and Middleware integration frameworks rather than build them in-house [Fayad-Hmau:97].

The (JCL) is a set of dynamically loadable libraries that Java applications can call at run time. Because the Java Platform is not dependent on a specific operating system, applications cannot rely on any of the platform-native libraries. Instead, the Java Platform provides a comprehensive set of standard class libraries, containing the functions common to modern operating systems.

JCL serves three purposes within the Java Platform:

Like other standard code libraries, they provide the programmer a well-known set of useful facilities, such as container classes and processing. The library provides an abstract interface to tasks that would normally depend heavily on the hardware and operating system, such as network access and file access. Some underlying platforms may not support all of the features a Java application expects. In these cases, the library implementation can either emulate those features or provide a consistent way to check for the presence of a specific feature.

This tutorial would cover package java.lang, which provides classes that are fundamental to the design of the Java programming language. The most important classes are Object, which is the root of the class hierarchy, and Class, instances of which represent classes at run time. Here is the list of classes of package java.lang. These classes are very important to know for a Java programmer. Click a class link to know more detail about that class. For a further drill, you can refer standard Java documentation. SN Methods with Description Boolean 1 Boolean Byte 2 The Byte class wraps a value of primitive type byte in an object. Character 3 The Character class wraps a value of the primitive type char in an object. Class 4 Instances of the class Class represent classes and interfaces in a running Java application. ClassLoader 5 A class loader is an object that is responsible for loading classes. Compiler 6 The Compiler class is provided to support Java-to-native-code compilers and related services. Double 7 The Double class wraps a value of the primitive type double in an object. Float 8 The Float class wraps a value of primitive type float in an object. Integer 9 The Integer class wraps a value of the primitive type int in an object. Long 10 The Long class wraps a value of the primitive type long in an object. Math The class Math contains methods for performing basic numeric operations 11 such as the elementary exponential, logarithm, square root, and trigonometric functions. Number 12 The abstract class Number is the superclass of classes BigDecimal, BigInteger, Byte, Double, Float, Integer, Long, and Short. Object 13 Class Object is the root of the class hierarchy. Package 14 Package objects contain version information about the implementation and specification of a Java package. Process The Runtime.exec methods create a native process and return an instance 15 of a subclass of Process that can be used to control the process and obtain information about it. Runtime Every Java application has a single instance of class Runtime that allows 16 the application to interface with the environment in which the application is running. RuntimePermission 17 This class is for runtime permissions. SecurityManager 18 The security manager is a class that allows applications to implement a security policy. Short 19 The Short class wraps a value of primitive type short in an object. StackTraceElement 20 An element in a stack trace, as returned by Throwable.getStackTrace(). 21 StrictMath The class StrictMath contains methods for performing basic numeric operations such as the elementary exponential, logarithm, square root, and trigonometric functions. String 22 The String class represents character strings. StringBuffer 23 A string buffer implements a mutable sequence of characters. System 24 The System class contains several useful class fields and methods. Thread 25 A thread is a thread of execution in a program. ThreadGroup 26 A thread group represents a set of threads. ThreadLocal 27 This class provides thread-local variables. Throwable 28 The Throwable class is the superclass of all errors and exceptions in the Java language. Void 29 The Void class is an uninstantiable placeholder class to hold a reference to the Class object representing the Java keyword void.

Example