Week 4 Flashcards

1
Q

What does DAO stand for? Where does the pattern come from?

A

Data Access Objects, comes from Core J2EE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does DAO work?

A

Separates business/domain layer from the data layer. Abstracts/encapsulates the data source and access to it.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What data source functions are encapsulated by DAO?

A

CRUD - Create, Retrieve, Update, Delete

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The motivation behind the DAO pattern is isolated the _________/______ differences from the rest of the implementation.

A

business/domain.

You can easily change one part without changing the other.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What pattern is commonly added to the DAO pattern?

A

Factory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the 4 typical components of the DAO pattern?

A

Data source
Business/Domain object
Data Access Object
Data Transfer Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Name this: Could be linked to an RDBMS, LDAP, XML

A

Data Source

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Name this: Requires access to the Data Sources to obtain/store data

A

Domain or Business object

Keep in mind the access is not direct in this pattern

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Name this: Performs the CRUD operations for the program and abstracts the data source

A

DAO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Name this: Encapsulates data sent between the DAO and Domain/business layer

A

DTO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

When would you use a DAO interface? Why?

A

When there are multiple entities in the Data Source.

Same interface to access all entities, you implement a DAO class for each entity

Ex. entity_nameDAO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Should the Domain Object get “raw” exceptions from the Data Source? (Like SQLException)

A

No, the DAO should handle exceptions related to the Data Source and throw customer exceptions to the Domain Object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the Value Object? (Not DTO, even if its called that by mistake)

A

A small (usually immutable) object that encapsulates a value, like money, time, date.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The “bean” pattern is a programming convention. Explain

The constructor
Instance variables access modifiers
Getters and Setters
Serializable

A

no-arg public constructor
private instance vars
Getters and setters exist for each instance var
implements serializable

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the bean pattern used for? If you need introspection or notifications should you implement it?

A

Reusable components. If introspection and notifications are needed implement JavaBean API

How well did you know this?
1
Not at all
2
3
4
5
Perfectly