Book contents
- Frontmatter
- Contents
- Preface
- PART ONE FOUNDATIONS
- 1 Cornerstones of OOP
- 2 Objects
- 3 Class Construction
- 4 Relationships between Classes
- 5 GUIs: Basic Concepts
- 6 Implementing Simple GUIs in Java
- 7 Errors and Exceptions
- 8 Recursion
- PART TWO DATA STRUCTURES
- Appendix A Unified Modeling Language Notation
- Appendix B Complexity of Algorithms
- Appendix C Installing and Using Foundations Classes
- Index
3 - Class Construction
from PART ONE - FOUNDATIONS
Published online by Cambridge University Press: 05 June 2012
- Frontmatter
- Contents
- Preface
- PART ONE FOUNDATIONS
- 1 Cornerstones of OOP
- 2 Objects
- 3 Class Construction
- 4 Relationships between Classes
- 5 GUIs: Basic Concepts
- 6 Implementing Simple GUIs in Java
- 7 Errors and Exceptions
- 8 Recursion
- PART TWO DATA STRUCTURES
- Appendix A Unified Modeling Language Notation
- Appendix B Complexity of Algorithms
- Appendix C Installing and Using Foundations Classes
- Index
Summary
Object-oriented software development is centered on the construction of classes. Classes represent a model of the application domain. Object-oriented software analysis and design are preoccupied with the discovery of classes and the relationships they have to each other. Through composition – in which one class holds one or more objects from other classes – and inheritance, the architecture of a software system is denned. This architecture is ultimately realized at the implementation phase by the construction and definition of classes.
This chapter closely examines the issues related to class construction using Java. Among the important issues to be discussed are:
What responsibilities should be vested within a class?
What responsibilities should be vested with the user of a class?
How can we bind the user's responsibilities with the class's responsibilities?
How can we organize the behavior of a class in a systematic manner?
What naming conventions and documentation style should be employed in class construction?
How can and should one control the visibility and access to various features of a class?
Responsibilities between a Class and Its Users – Design by Contract
Bertrand Meyer, perhaps more than any other writer, has clarified and influenced our thinking regarding the responsibilities between a class and its users. His ideas are contained in his seminal work Object-Oriented Software Construction, Second Edition (Prentice-Hall, 1997) and manifested in the Eiffel programming language and environment.
- Type
- Chapter
- Information
- Fundamentals of OOP and Data Structures in Java , pp. 51 - 63Publisher: Cambridge University PressPrint publication year: 2000