Study for the day when you don't have to worry about price tags.
--Your friends at LectureNotes

Java Programming

by Rama Khandavilli
Institute: BPUT Course: B.Tech Specialization: Computer Science EngineeringDownloads: 156Views: 2425Uploaded: 7 months agoAdd to Favourite

Share it with your friends

Suggested Materials

Leave your Comments


Rama Khandavilli

Rama Khandavilli

1-UNIT Need for oop paradigm • The object oriented paradigm is a methodology for producing reusable software components • The object-oriented paradigm is a programming methodology that promotes the efficient design and development of software systems using reusable components that can be quickly and safely assembled into larger systems. • Object oriented programming has taken a completely different direction and will place an emphasis on object s and information. With object oriented programming, a problem will be broken down into a number of units .these are called objects .The foundation of oop is the fact that it will place an emphasis on objects and classes. There are number of advantages to be found with using the oop paradigm, and some of these are oop paradigm • Object oriented programming is a concept that was created because of the need to overcome the problems that were found with using structured programming techniques. While structured programming uses an approach which is top down, oop uses an approach which is bottom up. • A paradigm is a way in which a computer language looks at the problem to be solved. We divide computer languages into four paradigms: procedural, object-oriented, functional and declarative • A paradigm shift from a function-centric approach to an object-centric approach to software development • A program in a procedural paradigm is an active agent that uses passive objects that we refer to as data or data items. • The basic unit of code is the class which is a template for creating run-time objects. • Classes can be composed from other classes. For example, Clocks can be constructed as an aggregate of Counters. • The object-oriented paradigm deals with active objects instead of passive objects. We encounter many active objects in our daily life: a vehicle, an automatic door, a dishwasher and so on. The actions to be performed on these objects are included in the object: the objects need only to receive the appropriate stimulus from outside to perform one of the actions. • A file in an object-oriented paradigm can be packed with all the procedures—called methods in the object-oriented paradigm—to be performed by the file: printing, copying, SVECW IT DEPT Page 2
deleting and so on. The program in this paradigm just sends the corresponding request to the object • Java provides automatic garbage collection, relieving the programmer of the need to ensure that unreferenced memory is regularly deallocated.need Object Oriented Paradigm – Key Features • Encapsulation • Abstraction • Inheritance • Polymorphis A Way of viewing World- Agents • The word agent has found its way into a number of technologies. It has been applied to aspects of artificial intelligence research and to constructs developed for improving the experience provided by collaborative online social environments (MUDS, MOOs, and the like). It is a branch on the tree of distributed computing. There are agent development toolkits and agent programming languages. • The Agent Identity class defines agent identity. An instance of this class uniquely identifies an agent. Agents use this information to identify the agents with whom they are interested in collaborating. • The Agent Host class defines the agent host. An instance of this class keeps track of every agent executing in the system. It works with other hosts in order to transfer agents. • The Agent class defines the agent. An instance of this class exists for each agent executing on a given agent host. • OOP uses an approach of treating a real world agent as an object. • Object-oriented programming organizes a program around its data (that is, objects) and a set of well-defined interfaces to that data. • An object-oriented program can be characterized as data controlling access to code by switching the controlling entity to data. Responsibility • In object-oriented design, the chain-of-responsibility pattern is a design pattern consisting of • a source of command objects and a series of processing objects.. Each processing object contains logic that defines the types of command objects that it can handle; the rest are passed to the next processing object in the chain. A mechanism also exists for adding new processing objects to the end of this chain. SVECW IT DEPT Page 3
• • • • • Primary motivation is the need for a platform-independent (that is, architecture- neutral) language that could be used to create software to be embedded in various consumer electronic devices, such as microwave ovens and remote controls. Objects with clear responsibilities Each class should have a clear responsibility. If you can't state the purpose of a class in a single, clear sentence, then perhaps your class structure needs some thought. In object-oriented programming, the single responsibility principle states that every class should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility. Messages • • • • • • Message implements the Part interface. Message contains a set of attributes and a "content". Message objects are obtained either from a Folder or by constructing a new Message object of the appropriate subclass. Messages that have been received are normally retrieved from a folder named "INBOX". A Message object obtained from a folder is just a lightweight reference to the actual message. The Message is 'lazily' filled up (on demand) when each item is requested from the message. Note that certain folder implementations may return Message objects that are pre-filled with certain user-specified items. To send a message, an appropriate subclass of Message (e.g., Mime Message) is instantiated, the attributes and content are filled in, and the message is sent using the Transport. Send method. We all like to use programs that let us know what's going on. Programs that keep us informed often do so by displaying status and error messages. These messages need to be translated so they can be understood by end users around the world. • The Section discusses translatable text messages. Usually, you're done after you move a message String into a Resource Bundle. • If you've embedded variable data in a message, you'll have to take some extra steps to prepare it for translation. Methods • • • • The only required elements of a method declaration are the method's return type, name, a pair of parentheses, (), and a body between braces, {}. Two of the components of a method declaration comprise the method signature—the method's name and the parameter types. More generally, method declarations have six components, in order: Modifiers—such as public, private, and others you will learn about later. SVECW IT DEPT Page 4

Lecture Notes