Index

Symbols

{ } (braces), 58

+ (plus sign), 62

/ (slash), comment notations using, 69

A

aborting applications, 54

abstraction

abstract classes

interfaces compared to, 133135

overview of, 121123, 128131

abstract factory design pattern, 165

abstract interfaces, 4142

abstract methods, 129

nonportable code, 84

overview of, 2526, 3031

accessor methods, 1314, 7375

adapter design pattern, 169171

aggregations

association and, 153

concept of, 112113, 151152, 153, 180

Alexander, Christopher, 162

Ambler, Scott, 173

analysis, role in system design, 95

antipatterns, 173174

applications

aborting, 54

recovering, 5455

“The Architecture of Complexity” (Simon), 149

artifacts

Reuseless, 173

Robust, 173

associations

aggregation and, 153

concept of, 112113, 152153

multiple object, 157158

optional, 158159

attributes

class, 18, 6162, 6971

importance of, 5758

initialization of, 48

local, 5859

object, 12, 5961

public versus private, 20

static, 83

B

base classes, 2425

behavioral inheritance, 63

behavioral patterns

categories of, 171172

iterator, 172173

behaviors, object. See also methods

overview of, 1316, 44

separating out, 200202

bitwise copies, 64

builder design pattern, 165

buyInventory() method, 142

C

C / C++ development. See OO (object-oriented) development

C# development. See OO (object-oriented) development

C++ Report, 173

Cabbie class

accessors, 73

attributes, 6971

class diagram, 115116

comments, 69

constructors

default, 49

example of, 4748

overview of, 7172

name, 68

overloaded methods, 50

calcArea() method, 188189

CalculateAreas class, 189, 190191, 192

CalculatePay() method, 14

calling constructors, 48

Car class, 137, 138

cardinality, 155157

Cat class, 199, 202

catch keyword, 5557

catching exceptions, 5657

categories, design pattern, 164165

CatNoise class, 201, 204

chain of response, 171

CIRCLE class, 167169

Circle class, 2730, 119, 130131, 189

class diagrams

cardinality in, 156157

composition, 113114

creating, 5152

DataBaseReader class, 51

Dog class, 159

e-business case study, 142146

CustList class, 143

DonutShop class, 143144

PizzaShop class, 144

Shop class, 142

overview of, 1920, 92

class keyword, 6769

classes. See also interfaces; methods; objects

abstract. See also abstraction

interfaces compared to, 133135

overview of, 121123, 128131

attributes

class scope, 6162

example of, 6971

initialization of, 48

local scope, 5859

object scope, 5961

overview of, 18, 6162

public versus private, 20

Cabbie

accessors, 73

attributes, 6971

class diagram, 115116

comments, 69

constructors, 4749, 7172

name, 68

overloaded methods, 50

CalculateAreas, 189, 190191, 192

Car, 137, 138

Cat, 199, 202

CatNoise, 201, 204

Circle, 2730, 119, 130131, 167169, 189

comments

design guidelines, 8182

notation, 69

number of, 82

composition

advantages of, 175177

aggregations, 112113, 151152, 153

associations, 112113, 152153, 157159

building in phases, 149151

cardinality, 155157

class diagrams, 113114

definition of, 105

dependencies, 154155

example of, 112, 159160

object reuse, 105106

overview of, 30

relationships, 148149

constructors

calling, 48

default, 4849

design of, 5354, 8081

example of, 7172

injection by, 184

lack of, 71

multiple, 4950, 72

overview of, 4748

purpose of, 48

return values, 47

Count, 4950

CustList, 143

data hiding, 20

database reader example, 3640

DataBaseReader

class diagrams, 51

constructors, 52

overview of, 3640

testing, 8788

definition of, 1617

design guidelines, 10

code reuse, 82

comments, 8182

constructors/destructors, 8081

copying and comparison, 84

extensibility, 83

implementation, hiding, 7980

interaction, 82

maintainability, 86

marshalling, 89

naming conventions, 8384

nonportable code, 84

object persistence, 8889

public interface, 7879

real-world system modeling, 7778

scope, 8485

serialization, 89

stubs, 8688

top-down, 77

destructors, 8081

Dog

class diagram, 159160

contract, 137138

defining, 134

dependency injection, 182184

design decisions, 110112

generalization-specialization, 109110

inheritance, 107109

DonutShop, 143144

Employee

behaviors, 1316

cardinality, 155157

multiple object associations, 157158

optional associations, 158159

encapsulation

importance of, 113114

inheritance weakened by, 115117

overview of, 20

error handling

applications, aborting, 54

design guidelines, 81

exceptions, catching, 5657

exceptions, throwing, 5557

ignoring problems, 54

overview of, 54

recovery, 5455

Head, 133

highly coupled, 86, 175177. See also dependencies

identifying, 96

implementation

characteristics of, 36

hiding, 7980

inheritance

advantages and limitations, 106109

behavioral, 63

composition as alternative to, 175177, 179182

definition of, 105

design decisions, 110112

example of, 159160, 177179

generalization-specialization, 109110

implementation, 63

multiple, 26, 63, 131132

object reuse, 105106

overview of, 2324

polymorphism, 2730

relationships, 131, 147

single, 26

subclasses, 2425

superclasses, 2425

weakened by encapsulation, 115117

Integer, 169170

interface/implementation paradigm

model of, 2223

overview of, 21

real-world example, 2122

interfaces

abstract, 4142

characteristics of, 36

database reader example, 3640

design guidelines, 4142

extending, 79

IMammal, 197

implementation versus, 3435

ISP (Interface Segregation Principle), 197198

IWalkable, 183184

minimum public, 7879

overview of, 2021, 131132

prototypes, 97

public, 4445, 75

testing, 8688

Iterator, 172

MailTool, 170

MainApplication, 98

MakingNoise, 200

Mammal, 203

composition, 179182

defining, 133

inheritance, 178179

interfaces for, 197198

makeNoise() method, 199

Math, 85

messages, 19

model of, 9697

MyMailTool, 170171

names, 6769

Number

class attributes, 6162

local attributes, 5859

object attributes, 5961

objects, creating from, 1718

OpenClosed, 192, 194

Person

attributes, 18

class diagram, 1920

creating, 18

extensibility, 83

methods, 19

PizzaShop, 144

Planet, 136, 137

polymorphism

object responsibility, 118119

overview of, 117

Rectangle, 117, 119, 130131, 192, 194197

references, 64

relationships

has-a, 31

is-a, 2627, 107

scope, 8485

setters, injection by, 184

Shape, 165

calcArea() method, 188

child classes, 167168

class hierarchy, 128131

factory method design pattern, 165169

generate() method, 167

is-a relationships, 2627

polymorphism, 2730, 117121

ShapeFactory class, 168169

ShapeCalculator, 192

ShapeFactory, 168169

Shop, 142

SomeMath, 100

Sound, 101

Square, 2223, 167169

Star, 119

superclasses, 53

Swimmable, 181

TestBeep, 101

TestFactoryPattern, 169

TestMammal, 200, 201202, 203204

TestMath, 100

TestShape, 119121, 190, 191

TestShop, 145146

Triangle, 120, 167169

Whale, 181

Window, 117

wrapping, 101102

Coad, Peter, 106, 115

code reuse. See also abstraction; object reuse

advantages and limitations, 125

contracts

defining, 136138

overview of, 128

as system plug-in points, 138139

design guidelines for, 82

e-business case study

code reuse for, 141142

non-reuse approach, 139141

scenario, 139

UML object model, 142146

frameworks, 126127

interfaces

abstract, 4142

abstract classes compared to, 133135

characteristics of, 36

database reader example, 3640

design guidelines, 4142

extending, 79

IMammal, 197

implementation versus, 3435

interface/implementation paradigm, 2123

is-a relationships, 135136

ISP (Interface Segregation Principle), 197198

IWalkable, 183184

minimum public interface, 7879

overview of, 2021, 131132

prototypes, 97

public, 4445, 75

terminology, 131

testing, 8688

UML diagrams, 132

command design pattern, 171

comments

design guidelines, 8182

notation, 69

number of, 82

communication, object-to-object, 1011

comparing objects, 84

composition, 30

advantages of, 175177

aggregations

association and, 153

concept of, 112113, 151152, 153

associations

aggregation and, 153

concept of, 112113, 152153

multiple object, 157158

optional, 158159

building in phases, 149151

cardinality, 155157

class diagrams, 113114

definition of, 105

dependencies, avoiding, 154155

example of, 112, 159160, 179182

object reuse, 105106

relationships, 148149

concatenation of strings, 62

conditions, 9899

consequences, 162

constraints, environmental, 44

constructors

calling, 48

default, 4849

design of, 5354, 8081

example of, 7172

injection, 80

injection by, 184, 199

lack of, 71

multiple, 4950, 72

overview of, 4748

purpose of, 48

return values, 47

contracts

defining, 136138

overview of, 128

as system plug-in points, 138139

copies, 6465

copying objects, 84

Count class, 4950

coupling, 86, 175177

“Creating Chaos” (Johnson), 173

creational patterns

categories of, 165

factory method, 165

curly braces ({}), 58

CustList class, 143

customers, 79

D

data hiding, 9, 20

data transfer objects (DTOs), 78

DataBaseReader class

class diagram, 51

constructors, 52

overview of, 3640

testing, 8788

databases. See also DataBaseReader class

NoSQL, 89

relational, 89

declaring methods

private implementation methods, 76

public interface methods, 75

static, 7374

decoupling. See dependencies

deep copies, 64

default constructors, 4849

definition inheritance. See inheritance

dependencies, 154155. See also dependency injection; inheritance

composition, 30

advantages of, 175177

example of, 179182

DIP (Dependency Inversion Principle), 3

dependency injection and, 202204

initial example, 199200

overview of, 198199

separating out behavior, 200202

inheritance

composition as alternative to, 175177, 179182

issues with, 179182

dependency injection, 182184

by constructor, 80, 184, 199

definition of, 198

DIP (Dependency Inversion Principle), 3, 202204

initial example, 199200

overview of, 198199

separating out behavior, 200202

example of, 182184

by parameters, 199

by setter, 184

Dependency Inversion Principle. See DIP (Dependency Inversion Principle)

design

classes, 10

code reuse, 82

comments, 8182

constructors/destructors, 8081

copying and comparison, 84

extensibility, 83

identifying, 96

implementation, hiding, 7980

interaction, 82

maintainability, 86

naming conventions, 8384

nonportable code, 84

public interface, 7879

real-world system modeling, 7778

scope, 8485

comments, 8182

constructors, 5354

error handling, 81

global data, 89, 85

guidelines and best practices

iteration in, 86

marshalling, 89

object persistence, 8889

serialization, 89

stubs, 8688

top-down design, 77

inheritance, 110112

interfaces, 4142

objects, 12

patterns

adapter, 169171

advantages of, 162

antipatterns, 173174

best practices, 161

categories of, 164165

elements of, 162

factory method, 165169

iterator, 172173

MVC (Model/View/Controller), 163164

overview of, 161162

SOLID principles

DIP (Dependency Inversion Principle), 198204

ISP (Interface Segregation Principle), 197198

LSP (Liskov Substitution Principle), 194197

OCP (Open/Close Principle), 192194

overview of, 187188

SRP (Single Responsibility Principle), 187188

system

analysis, 95

building in phases, 149151

class identification, 96

class model, 9697

object wrappers, 97102

OO design process, 9194

requirements documents, 95

safety versus economics, 94

SOW (statement of work), 95

system prototypes, 96

user interface prototypes, 97

waterfall model, 9293

design patterns

adapter, 169171

advantages of, 162

antipatterns, 173174

best practices, 161

categories of, 164165

elements of, 162

factory method, 165169

iterator, 172173

MVC (Model/View/Controller), 163164

overview of, 161162

Design Patterns (Gamma et al), 161162. See also design patterns

destructors, 8081

diagrams, class

cardinality in, 156157

composition, 113114

creating, 5152

DataBaseReader class, 37, 51

Dog class, 156157, 159

e-business case study, 142146

CustList class, 143

DonutShop class, 143144

PizzaShop class, 144

Shop class, 142

overview of, 1920, 92

diagrams, interface, 132

Dictionary.com, 128

DIP (Dependency Inversion Principle), 3

dependency injection, 202204

initial example, 199200

overview of, 198199

separating out behavior, 200202

documentation. See also diagrams, class

amount of, 82

comments

design guidelines, 8182

notation, 69

requirements documents, 95

SOW (statement of work), 95

Dog class, 182, 184

class diagram, 159160

defining, 134, 137, 138

design decisions, 110112

generalization-specialization, 109110

inheritance, 107109

domains, mixing, 155

DonutShop class, 143144

draw() method, 119, 128131

DTOs (data transfer objects), 78

E

e-business case study

code reuse for, 141142

non-reuse approach, 139141

scenario, 139

UML object model, 142146

CustList class, 143

DonutShop class, 143144

PizzaShop class, 144

Shop class, 142

economics, safety versus, 94

Effective C++ (Meyers), 63, 78, 109

Employee class

behaviors, 1316

cardinality, 155157

multiple object associations, 157158

optional associations, 158159

Employee object, 14

encapsulation

definition of, 10

importance of, 113114

inheritance weakened by, 115117

overview of, 20

enums, 167

environmental constraints, 44

error handling

aborting application, 54

design guidelines, 81

exceptions

catching, 5657

throwing, 5557

ignoring problems, 54

overview of, 54

recovery, 5455

exceptions

catching, 5657

throwing, 5557

extensibility

design guidelines, 83

interfaces, 79

F

factory method design pattern, 165169

flat file systems, 89

fragility, 187

frameworks, 126127

G

Gamma, Erich, 161162

Gang of Four, 161162

garbage collection, 80

generalization-specialization, 109110

generate() method, 167168

generateHeat() method, 133

getArea() method, 2930

getInventory() method, 142

getMail() method, 171

getSize() method, 133

getSocialSecurityNumber(), 14

getters, 1314, 7374

Gilbert, Stephen, 115

giveDestination() method, 75, 76

global data, 89, 85

GoF (Gang of Four), 161162

H

handling errors. See error handling

has-a relationships, 31

hasMoreElements() method, 173

Head class, 133

Helm, Richard, 161162

hiding

data, 9

implementation, 7980

highly coupled classes, 86, 175177. See also dependencies

hybrid apps, 7

I

ignoring problems, 54

IMammal interface, 197

immobility, 187

implementations. See also inheritance

characteristics of, 36

database reader example, 3640

hiding, 7980

identifying, 4546

interface/implementation paradigm

model of, 2223

overview of, 21

real-world example, 2122

interfaces versus, 3435

private implementation methods, 76

inheritance. See also composition; encapsulation

advantages and limitations, 106109

behavioral, 63

composition as alternative to, 175177, 179182

definition of, 105

design decisions, 110112

example of, 159160

generalization-specialization, 109110

implementation, 63

is-a relationships, 107

multiple, 26, 63, 131132

object reuse, 105106

overview of, 2324

polymorphism, 2730

relationships, 2627, 131, 135136, 147

single, 26

weakened by encapsulation, 115117

init keyword, 47

initialization, attribute, 48

injection, dependency. See dependency injection

Integer class, 169170

interaction, design guidelines for, 82

Interface Segregation Principle (ISP), 3, 197198

interfaces

abstract, 4142

abstract classes compared to, 133135

characteristics of, 36

database reader example, 3640

design guidelines, 4142

extending, 79

IMammal, 197

interface/implementation paradigm, 3435

model of, 2223

overview of, 21

real-world example, 2122

is-a relationships, 135136

ISP (Interface Segregation Principle), 197198

IWalkable, 183184

Nameable, 132, 136, 137

overview of, 2021, 131132

prototypes, 97

public, 4445

methods, 75

minimum public interface, 7879

terminology, 131

testing, 8688

UML diagrams, 132

internal customers, 79

interpreter design pattern, 171

Inversion of Control (IoC), 72

IOC (inversion of control), 182

IPS. See Interface Segregation Principle (ISP)

is-a relationships, 2627, 107, 135136

ISP (Interface Segregation Principle), 3, 197198

iterate() method, 173

iterations, 86, 99

Iterator class, 172

iterator design pattern, 172173

IWalkable interface, 183184

J

Java. See OO (object-oriented) development

Java Design (Coad and Mayfield), 106

Java development. See OO (object-oriented) development

Java Primer Plus (Tyma, Torok, and Downing), 54

Johnson, Johnny, 173

Johnson, Ralph, 161162

K

keywords. See also methods

catch, 5557

class, 68

classes, 6769

init, 47

new, 47, 53, 165, 169, 181

null, 7172

private, 6971, 76

public, 7576

static, 6162, 6971, 7475

this, 60

try, 5557

Koenig, Andrew, 173

L

Larman, Craig, 1

leaks, memory, 81

legacy systems, OO (object-oriented) concepts with, 67

Liskov Substitution Principle (LSP), 3, 109, 194197

local attributes, 5859

LSP. See Liskov Substitution Principle (LSP)

M

MailTool class, 170

MainApplication class, 98

maintainability, 86

makeNoise() method, 133, 199

MakingNoise class, 200

Mammal class, 203

composition, 179182

defining, 133

inheritance, 178179

interfaces for, 197198

makeNoise() method, 199

marshalling objects, 89

Martin, Robert, 7, 187

Math class, 85

Mayfield, Mark, 106, 115

McMarty, Bill, 115

mediator design pattern, 172

memento design pattern, 172

memory leaks, 81

messages, 19

methods, 13. See also keywords

abstract, 129

accessors, 1314, 7375

buyInventory(), 142

calcArea(), 188189

CalculatePay(), 14

constructors

calling, 48

default, 4849

design of, 5354, 8081

example of, 7172

injection by, 184

lack of, 71

multiple, 4950, 72

overview of, 4748

purpose of, 48

return values, 47

destructors, 8081

draw(), 119, 128131

generate(), 167168

generateHeat(), 133

getArea(), 2930

getInventory(), 142

getMail(), 171

getSize(), 133

getSocialSecurityNumber(), 14

getters, 1314, 7374

giveDestination(), 75, 76

hasMoreElements(), 173

iterate(), 173

makeNoise(), 133, 199

mutators, 1314

open(), 3940

overloading, 5051

overview of, 19

private implementation, 76

public interface, 75

retrieveMail(), 170

setSize(), 133

setters, 1314, 7374, 184

setWalker(), 184185

signatures, 5051

static, 7475, 83

turnRight(), 76

virtual, 121123

walk(), 183

Meyers, Scott, 63, 78, 109

middleware, 3739

minimum public interface, 7879

mobile web, 7

modeling tools, 15

Model/View/Controller (MVC) design pattern, 163164

multiple constructors, 4950, 72

multiple inheritance, 26, 63, 131132

multiple object associations, 157158

mutator methods, 1314

MVC (Model/View/Controller) design pattern, 163164

MyMailTool class, 170171

N

Nameable interface, 132, 136, 137

naming conventions

classes, 6769

design guidelines for, 8384

patterns, 162

new keyword, 47, 53, 165, 169, 181

nonportable code, 84, 101

NoSQL databases, 89

null value, 7172

Number class

class attributes, 6162

local attributes, 5859

object attributes, 5961

O

object attributes, 5961

The Object Primer (Ambler), 86

object reuse, 105106, 204

composition, 30

advantages of, 175177

aggregation, 112113, 151152

aggregations, 153

association, 112113

associations, 152153, 157159

building in phases, 149151

cardinality, 155157

class diagrams, 113114

definition of, 105

dependencies, avoiding, 154155

example of, 112, 159160, 179182

object reuse, 105106

relationships, 148149

inheritance. See also composition

behavioral, 63

composition as alternative to, 175177, 179182

definition of, 105

design decisions, 110112

example of, 159160

generalization-specialization, 109110

implementation, 63

is-a relationships, 2627

multiple, 26, 63

object reuse, 105106

overview of, 2324

polymorphism, 2730

relationships, 147

single, 26

object wrappers

definition of, 7

design guidelines, 9798

for existing classes, 101102

for nonportable code, 101

overview of, 9798

for structured code, 98100

Objective-C, 2

Object-Oriented Design in Java (Gilbert and McCarty), 44, 54, 64, 78, 155

object-oriented development. See OO (object-oriented) development

objects. See also classes; methods; object reuse

attributes, 12

class scope, 6162

example of, 6971

initialization of, 48

local, 5859

object scope, 5961

public versus private, 20

behaviors, 1316, 44

comparing, 84

copies, 6465

copying, 84

creating, 1718

definition of, 8, 12

design, 12

Employee, 14

marshalling, 89

object-to-object communication, 1011

operations, 6365

Payroll, 14

persistence, 39, 8889

properties, 13

responsibility, 118119

scope

class attributes, 6162

importance of, 5758

local attributes, 5859

object attributes, 5961

serialization, 89

wrappers

definition of, 7

design guidelines, 9798

observer design pattern, 172

OCP. See Open/Close Principle

OO (object-oriented) development, 11. See also abstraction; classes; code reuse; dependencies; objects

abstraction

abstract classes, 121123, 128131, 133135

abstract factory design pattern, 165

abstract interfaces, 4142

abstract methods, 129

nonportable code, 84

overview of, 2526, 3031

advantages of, 1112

comments

design guidelines, 8182

notation, 69

number of, 82

composition, 30

advantages of, 175177

aggregations, 112113, 151152, 153

associations, 112113, 152153, 157159

building in phases, 149151

cardinality, 155157

class diagrams, 113114

definition of, 105

dependencies, avoiding, 154155

example of, 112, 159160, 179182

object reuse, 105106

relationships, 148149

contracts

defining, 136138

overview of, 128

as system plug-in points, 138139

data hiding, 9

e-business case study

code reuse for, 141142

non-reuse approach, 139141

scenario, 139

UML object model, 142146

encapsulation

definition of, 10

importance of, 113114

inheritance weakened by, 115117

environmental constraints, 44

error handling

aborting application, 54

design guidelines, 81

exceptions, catching, 5657

exceptions, throwing, 5557

ignoring problems, 54

overview of, 54

recovery, 5455

evolution of, 5

frameworks, 126127

implementations

characteristics of, 36

database reader example, 3640

hiding, 7980

identifying, 4546

interface/implementation paradigm, 2123

interfaces versus, 3435

private implementation methods, 76

inheritance

advantages and limitations, 106109

behavioral, 63

composition as alternative to, 175177, 179182

definition of, 105

design decisions, 110112

example of, 159160, 177179

generalization-specialization, 109110

implementation, 63

multiple, 26, 63, 131132

object reuse, 105106

overview of, 2324

polymorphism, 2730

relationships, 131, 135136, 147

single, 26

subclasses, 2425

superclasses, 2425

weakened by encapsulation, 115117

interface/implementation paradigm

model of, 2223

overview of, 21

real-world example, 2122

interfaces

abstract, 4142

abstract classes compared to, 133135

characteristics of, 36

database reader example, 3640

design guidelines, 4142

extending, 79

IMammal, 197

implementation versus, 3435

interface/implementation paradigm, 2123

is-a relationships, 135136

ISP (Interface Segregation Principle), 197198

IWalkable, 183184

minimum public interface, 7879

overview of, 2021, 131132

prototypes, 97

public, 4445, 75

terminology, 131

testing, 8688

UML diagrams, 132

iteration in, 86

legacy systems and, 67

object-to-object communication, 1011

operators, overloading, 6263

polymorphism

object responsibility, 118119

overview of, 117

procedural programming compared to, 711

relationships

has-a, 31

is-a, 2627, 107

scope

class attributes, 6162

design guidelines, 8485

importance of, 5758

local attributes, 5859

object attributes, 5961

SOLID principles

DIP (Dependency Inversion Principle), 198204

ISP (Interface Segregation Principle), 197198

LSP (Liskov Substitution Principle), 194197

OCP (Open/Close Principle), 192194

overview of, 187188

SRP (Single Responsibility Principle), 188191

stacks, 29

users, determining, 4344

open() method, 3940

Open/Close Principle, 192194

Open/Close Principle (OCP), 3, 192194

OpenClosed class, 192, 194

operations, object, 6365

operators, overloading, 6263

optional associations, 158159

overloading

methods, 5051

operators, 6263

P

parameters, injection by, 199

parent class, 2425

passing references, 71

A Pattern Language (Alexander), 162

patterns, design

adapter, 169171

advantages of, 162

antipatterns, 173174

best practices, 161

categories of, 164165

elements of, 162

factory method, 165169

iterator, 172173

MVC (Model/View/Controller), 163164

overview of, 161162

Payroll object, 14

persistence, 39, 8889

Person class

attributes, 18

class diagram, 1920

creating, 18

extensibility, 83

methods, 19

PizzaShop class, 144

Planet class, 136, 137

plus sign (+), 62

polymorphism

object responsibility, 118119

overview of, 2730, 117

private attributes, 20

private implementation methods, 76

private keyword, 6971, 76

problems, 162

procedural programming

data model, 11

OO (object-oriented) programming compared to, 711

properties, object, 13

protocols, 121123

prototype design pattern, 165

prototypes

system, 96

user interface, 9798

public attributes, 20

public interfaces, 4445, 75

public keyword, 7576

Q-R

recovery, 5455

Rectangle class, 117, 119, 130131, 192, 194197

references

classes and, 64

passing, 71

relational databases, 89

relationships

composition, 148149

has-a, 31

inheritance, 131, 147

is-a, 2627, 107, 135136

requirements documents, 95

responsibility, SRP (Single Responsibility Principle), 187188

retrieveMail() method, 170

return values, 47

reuse of code. See code reuse

“Reuse Patterns and Antipatterns” (Ambler), 173

Reuseless Artifact, 173

rigidity, 187

Robust Artifacts, 173

S

safety, economics versus, 94

scope

class attributes, 6162

design guidelines, 8485

importance of, 5758

local attributes, 5859

object attributes, 5961

separating out behavior, 200202

sequences, 9899

serialization, 89

setSize() method, 133

setters, 1314, 7374, 184

setWalker() method, 184185

shallow copies, 64

Shape class, 165

calcArea() method, 188

child classes, 167168

class hierarchy, 128131

factory method design pattern, 165169

generate() method, 167

is-a relationships, 2627

polymorphism, 2730, 117121

ShapeFactory class, 168169

ShapeCalculator class, 192

ShapeFactory class, 168169

ShapeType enum, 167

Shop class, 142

signatures, 21, 5051

Simon, Herbert, 149

single inheritance, 26

Single Responsibility Principle (SRP), 3, 187188

singleton design pattern, 165

slash (/), 69

Smalltalk

development of, 163

MVC (Model/View/Controller) design pattern, 164165

SOLID principles, 23, 109

DIP (Dependency Inversion Principle)

dependency injection, 202204

initial example, 199200

overview of, 198199

separating out behavior, 200202

ISP (Interface Segregation Principle), 197198

LSP (Liskov Substitution Principle), 194197

OCP (Open/Close Principle), 192194

overview of, 187188

SRP (Single Responsibility Principle), 187188

solutions, 162

SomeMath class, 100

Sound class, 101

SOW (statement of work), 95

specialization, 109110

Square class, 2223, 167169

SRP. See Single Responsibility Principle (SRP)

stacks, 29

standalone applications, 39

Star class, 119

state design pattern, 172

statement of work (SOW), 95

static attributes, 83

static keyword, 6162, 6971, 7475

static methods, 83

strategy design pattern, 172

strings, concatenation of, 62

structural patterns

adapter, 169171

categories of, 169

structured code

conditions, 9899

sequences, 9899

wrapping, 99100

stubs, 8688

subclasses, 2425

substitution, LSP (Liskov Substitution Principle), 194197

superclasses, 2425, 53

Swift

exceptions, 5557

init keyword, 47

multiple inheritance, 63

scope, 58

Swimmable class, 181

system design

analysis, 95

building in phases, 149151

class identification, 96

class model, 9697

object wrappers, 9798

for existing classes, 101102

for nonportable code, 101

overview of, 9798

for structured code, 98100

OO design process, 9194

requirements documents, 95

safety versus economics, 94

SOW (statement of work), 95

system prototypes, 96

user interface prototypes, 97

waterfall model, 9293

system prototypes, 96

T

template method, 172

TestBeep class, 101

TestFactoryPattern class, 169

testing interfaces, 8688

TestMammal class, 200, 201202, 203204

TestMath class, 100

TestShape class, 119121, 190, 191

TestShop class, 145146

this keyword, 60

throwing exceptions, 5557

top-down design, 77

Triangle class, 120, 167169

troubleshooting. See error handling

try keyword, 5557

try/catch blocks, 5557

turnRight() method, 76

U

UML (Unified Modeling Language)

class diagrams, 1415, 1920, 92

creating, 5152

DataBaseReader, 37

interface diagrams, 132

user interface prototypes, 97

users

customers versus, 79

determining, 4344

V

variables, global, 85

virtual methods, 121123

visitor design pattern, 172

Visual Basic .NET, 2

exceptions, 5557

multiple inheritance, 63

New keyword, 47

operator overloading, 63

Vlissides, John, 161162

W-X-Y-Z

walk() method, 183

waterfall model, 9293

Whale class, 181

Window class, 117

word processing framework, 126127

wrappers

advantages of, 38

design guidelines, 9798

for existing classes, 101102

for nonportable code, 101

overview of, 7, 9798

for structured code, 98100

Xerox PARC, 163

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.195.56