Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 328 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
328
Dung lượng
5,66 MB
Nội dung
[...]... introduction to the object- oriented world consisting of objects and object communication via the exchange of messages Object- oriented concepts and terminology used in object- oriented methodology are discussed in chapter 2 Chapter 3 shows how these concepts materialize in the form of Java code and representations It discusses the basic features and syntax of Java and builds upon the concepts using an incremental... instructor and students 2 Object, Class, Message and Method We had our first introduction to objects, message and method in Chapter 1 Another concept closely associated with the concept of objects is class In object- oriented programming, a class is a definition template for structuring and creating objects In this chapter, we will discuss the concept of object, message, method and class and how these... customers and salespersons behave differently—customers make orders and salespersons take orders 2.2 Message and Method Objects communicate with one another by sending messages A message is a method call from a message-sending object to a message-receiving object A messagesending object is a sender while a message-receiving object is a receiver 10 Object- Oriented Programming and Java An object responds... actual object interactions in real-world situations 4 Object- Oriented Programming and Java It is this ability for modeling real-world problems that identified object- oriented programming as being suitable for simulation The Simula programming language was designed in the early 1970s to provide simulation abilities using object- oriented concepts 1.5 Java Java was first introduced in 1995 as a simple and. .. procedural tasks carried out and the production of a system whose representation is based on the procedural flow of the processes Object- oriented programming, on the other hand, models objects and their interactions in the problem space and the production of a system based on these objects and their interactions Since the real-world problem domain is characterized by objects and their interactions, a... entities and their interactions in the problem-solving process Introduction 5 • Object- oriented concepts of object, message, and method • An overview of the Java programming language and the potential of productive software development 1.7 Exercises 1 Distinguish the programming approach used in procedural programming and object- oriented programming 2 Discuss the validity of the following statement: The object- oriented. .. object may have as many attributes and methods as required to effectively model the object In the most recent definition, objects of the class Counter have two attributes (number and reused, both with an initial value of 0 when created) and two methods (add() and initialize()) 3.3 Object Instantiation A class construct provides a description for objects of that class, and serves as a template for objects... in Java comes from understanding three key areas – object- oriented concepts, the syntax and semantics of the Java programming language and the Java Application Programming Interface (API) This is our emphasis when we conduct professional courses, and in this book as well Much of the material in this book is based on previous courses which we have conducted over the past two years to the industry and. .. 1.3 3 Objects and Their Interactions in Programming The interactions between Benjamin and Sean in the above real-world situation can be represented in object- oriented programming terms For instance, Benjamin and Sean are objects that interact by sending messages Benjamin is thus a message-sending object, while Sean is a message-receiving object Alternatively, we can label Benjamin as a sender and Sean... budget} name, address and budget are attributes while purchase() and getBudget() are methods of the two objects Note that both objects share a common definition of attributes and methods In fact, all customers of HomeCare share the same set of attribute and method definitions They all have attributes name, address and budget, and methods purchase() and getBudget() In defining these objects, a common definition . alt="" Object- Oriented Programming and Java Danny Poo Derek Kiong Swarnalatha Ashok Object- Oriented Second edition Programming and Java • . to abandon them completely. Effective programming in Java comes from understanding three key areas – object- oriented concepts, the syntax and semantics of the Java programming language and. object- oriented world consisting of objects and object communication via the exchange of messages. Object- oriented concepts and terminology used in object- oriented methodology are discussed