32
1 Frameworks: Frameworks: An Introduction An Introduction

1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

Embed Size (px)

Citation preview

Page 1: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

1

Frameworks: Frameworks: An IntroductionAn Introduction

Page 2: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

2

ApproachApproach

• Gather materials from Gather materials from – [1] Design Patterns – [1] Design Patterns – Elements of Reusable Object-Oriented Elements of Reusable Object-Oriented

SoftwareSoftware by Gamma, Helm, Johnson, and Vlissides (GoF), by Gamma, Helm, Johnson, and Vlissides (GoF), andand

– [2], by Craig Larman.[2], by Craig Larman.– Two very widely recognized sources…Two very widely recognized sources…– [3] Some great slides / words from Team 4’s presentation [3] Some great slides / words from Team 4’s presentation

supplemented via emails / help from Ken Bedwellsupplemented via emails / help from Ken Bedwell– Will take the GoF’s book first followed by Larman’s Will take the GoF’s book first followed by Larman’s

materials – interspersed with [3].materials – interspersed with [3].– Emphasizing ‘principles.’Emphasizing ‘principles.’– Please note that the text in the overheads comes almost Please note that the text in the overheads comes almost

verbatim from these sources.verbatim from these sources.

Page 3: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

3

DefinitionDefinition

• According to Gamma, et al [1]: “A According to Gamma, et al [1]: “A Framework is a set of Framework is a set of cooperating cooperating classesclasses that makes up a that makes up a reusable designreusable design for a for a specific classspecific class of software.” of software.”

• A framework provides A framework provides architectural architectural guidanceguidance by partitioning the design into by partitioning the design into abstract classes and defining their abstract classes and defining their responsibilities and collaborations. responsibilities and collaborations.

Page 4: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

4

Definition - moreDefinition - more

• A developer will normally A developer will normally customizecustomize a a framework to a specific application by framework to a specific application by “subclassing” and composing instances “subclassing” and composing instances of framework classes. of framework classes.

• (will see ahead)(will see ahead)• This notion of ‘subclassing’ and creating This notion of ‘subclassing’ and creating

instances of framework classes is an instances of framework classes is an essential principle.essential principle.

Page 5: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

5

Differences between Differences between Frameworks and Design PatternsFrameworks and Design Patterns

(1 of 3)(1 of 3)

• Frameworks are more Frameworks are more concreteconcrete than Design than Design PatternsPatterns– Can be embodied in code but only Can be embodied in code but only examplesexamples of of

patterns can be embodied in code.patterns can be embodied in code.– A strength: can be A strength: can be written downwritten down in a in a

programming language and not only studied, but programming language and not only studied, but executedexecuted and and reused directlyreused directly..

– In contrast, design patterns have to be In contrast, design patterns have to be implemented (GoF patterns) each time they’re implemented (GoF patterns) each time they’re used. (at a much higher level…)used. (at a much higher level…)

– Design patterns also explain the intent, tradeoff, Design patterns also explain the intent, tradeoff, and consequences of a design…and consequences of a design…

Page 6: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

6

Differences between Differences between Frameworks and Design PatternsFrameworks and Design Patterns

(2 of 3)(2 of 3)

• Frameworks are larger architectural Frameworks are larger architectural elements than design patterns.elements than design patterns.– Can be huge!Can be huge!– Industrial strength frameworks – if they are Industrial strength frameworks – if they are

versatile and meet their objectives for versatile and meet their objectives for reusability, … – can be very Very ‘large.’reusability, … – can be very Very ‘large.’

– A typical framework contains several design A typical framework contains several design patterns, but the reverse is never truepatterns, but the reverse is never true

Page 7: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

7

Differences between Differences between Frameworks and Design PatternsFrameworks and Design Patterns

(3 of 3)(3 of 3)

• Yet, frameworks are more specialized Yet, frameworks are more specialized than design patterns. than design patterns. – Frameworks Frameworks always have a particular always have a particular

application domain.application domain.– FrameworksFrameworks have a particular focus. have a particular focus.– Frameworks Frameworks dictate an application dictate an application

architecturearchitecture; design patterns do not.; design patterns do not.– Frameworks will consist of cooperating classes already Frameworks will consist of cooperating classes already

set up to be used in a design via subclassing, etc.set up to be used in a design via subclassing, etc.

Page 8: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

8

Future of FrameworksFuture of Frameworks

• Frameworks are becoming more and more Frameworks are becoming more and more common and important.common and important.

• Use of frameworks are perhaps the Use of frameworks are perhaps the most significant most significant wayway in which OO systems achieve in which OO systems achieve reusereuse..

• Larger OO applications will end up consisting of Larger OO applications will end up consisting of layers of frameworkslayers of frameworks that cooperate with each that cooperate with each otherother– With specific frameworks tailored to specific application With specific frameworks tailored to specific application

domains…domains…Most of the design and code in the application Most of the design and code in the application

will come from or be influenced by the frameworks will come from or be influenced by the frameworks it uses.-it uses.-

Page 9: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

9

Examples:Examples:

• A framework may be directed toward A framework may be directed toward building graphical editors for different building graphical editors for different domains like artistic drawing, music domains like artistic drawing, music composition, etc.composition, etc.

• Another framework might help us build Another framework might help us build compilers for different programming compilers for different programming languages and target machines.languages and target machines.

Page 10: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

10

A little closer to home…A little closer to home…

• Another framework might be used for Another framework might be used for storing persistent objectsstoring persistent objects. [2]. [2]– This should sound familiar!This should sound familiar!

• Ahead, will show an example framework Ahead, will show an example framework and its use in Team 4’s presentation and and its use in Team 4’s presentation and finish with some thoughts on a persistence finish with some thoughts on a persistence framework as a framework as a vehiclevehicle for explaining for explaining “general framework design” with patterns.“general framework design” with patterns.– Please note that it is usually better to get or Please note that it is usually better to get or

buy one of these frameworks than to build one, buy one of these frameworks than to build one, which can consume person-years of effort…which can consume person-years of effort…

Page 11: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

11

Framework ExamplesFramework Examples(taken from Team 4 presentation)(taken from Team 4 presentation)

• Simple:Simple:– CA7 (job scheduling and monitoring)CA7 (job scheduling and monitoring)

• MediumMedium– MTS (Microsoft)MTS (Microsoft)– Struts (J2EE coding/design framework)Struts (J2EE coding/design framework)

• ComplexComplex– .Net.Net– J2EE – J2EE – this is what Team 4 usedthis is what Team 4 used……– Siebel (workflow engine)Siebel (workflow engine)– WebMethods (web service orchestration)WebMethods (web service orchestration)

Page 12: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

12

Frameworks and Design Frameworks and Design ArchitectureArchitecture

• Frameworks do MUCH for us.Frameworks do MUCH for us.• Frameworks Frameworks take awaytake away some design freedom by some design freedom by

dictating our application architecturedictating our application architecture and the and the number of design decisions we make are reducednumber of design decisions we make are reduced

• Frameworks Frameworks define the overall structuredefine the overall structure, its , its partitioning into classes and objects, key partitioning into classes and objects, key responsibilities, collaborations and threads of responsibilities, collaborations and threads of control.control.

• Decisions are taken awayDecisions are taken away to allow application to allow application designer to concentrate on the specifics of the designer to concentrate on the specifics of the application.application.

Page 13: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

14

Frameworks and Design Frameworks and Design ArchitectureArchitecture

• The framework captures the design The framework captures the design decisions common in a decisions common in a specific specific application domainapplication domain..

• Frameworks emphasize Frameworks emphasize designdesign reuse over reuse over codecode reuse reuse, though a , though a framework will usually include framework will usually include concrete subclasses that you can concrete subclasses that you can put to work right away.put to work right away.

Page 14: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

15

Just the opposite…Just the opposite…

In conventional subroutine calls, we In conventional subroutine calls, we write the main procedurewrite the main procedure and call the and call the code we want to code we want to reusereuse..

In frameworks, we In frameworks, we reuse the main reuse the main procedureprocedure and and write the codewrite the code it calls! it calls!We will write the operations with We will write the operations with particular names and calling particular names and calling conventions – reducing our creativity conventions – reducing our creativity and design decisions.and design decisions.

Can thus build applications much faster!Can thus build applications much faster!

Page 15: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

16

Framework DesignFramework Design

• Main contribution of a Framework: the Main contribution of a Framework: the architecturearchitecture it defines. it defines.

• Framework designers gamble that Framework designers gamble that his/her framework will work his/her framework will work for all for all applicationsapplications in that domain. in that domain.

• Framework must be flexible and Framework must be flexible and extensibleextensible; any serious changes to the ; any serious changes to the design of the framework may reduce its design of the framework may reduce its effectiveness.effectiveness.

Page 16: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

17

Frameworks and PatternsFrameworks and Patterns

• Framework designers must address all Framework designers must address all these issues.these issues.

• Framework designer is much more likely Framework designer is much more likely to meet the goals of the framework to meet the goals of the framework ((designdesign and code reuse) by using and code reuse) by using design design patternspatterns..

• Most frameworks usually use Most frameworks usually use severalseveral design patterns. (See [2] pp 540-564)design patterns. (See [2] pp 540-564)

Page 17: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

19

More BasicsMore Basics

• Again, a framework (a bit oversimplified) is an Again, a framework (a bit oversimplified) is an extendable set of objects for related functions.extendable set of objects for related functions.– Classic example: a GUI framework, such as Java’s Classic example: a GUI framework, such as Java’s

AWT or Swing, a persistence framework...AWT or Swing, a persistence framework...

• ““Signature” of a framework is that it provides Signature” of a framework is that it provides an an implementationimplementation for the core and unvarying for the core and unvarying functions, and includes a functions, and includes a mechanismmechanism to allow to allow a developer to a developer to plug inplug in the various functions, or the various functions, or to to extendextend the functions. the functions.

Page 18: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

20

In general, a framework:In general, a framework:(example coming…)(example coming…)

• Is a cohesive set of Is a cohesive set of interfaces and classesinterfaces and classes that that collaborate to provide services for the collaborate to provide services for the core, core, unvarying partunvarying part of a logical subsystem of a logical subsystem

• Contains concrete (and especially) abstract Contains concrete (and especially) abstract classes that classes that – define interfaces to conform to, define interfaces to conform to, – object interactions to participate in, object interactions to participate in, – and other invariants.and other invariants.

Usually, but not necessarily, the framework Usually, but not necessarily, the framework users is required to users is required to define subclassesdefine subclasses of of existing framework classes to make use of, existing framework classes to make use of, customize, and extend the framework services,customize, and extend the framework services,

Page 19: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

21

In general, a framework:In general, a framework:(example coming…)(example coming…)

• A framework has abstract classes that may A framework has abstract classes that may contain both abstract and concrete methods,contain both abstract and concrete methods,

• A framework relies on the ‘Hollywood Principle’ A framework relies on the ‘Hollywood Principle’ – ‘don’t call us, we’ll call you.”– ‘don’t call us, we’ll call you.”– This means that the user-defined classes (for This means that the user-defined classes (for

example new subclasses) will receive messages from example new subclasses) will receive messages from the predefined framework classes. the predefined framework classes.

– These are usually handled by implementing super These are usually handled by implementing super class abstract methods. (like via generalization)class abstract methods. (like via generalization)

• Now, an example….Now, an example….

Page 20: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

22

setPage(in pageUrl)addParameter(in key, in val)

ActionDispatch

+service(in req, in resp)

ActionServlet

+addException()+addErrorMessage()

ActionErrors

ActionSession

«implementation class»UserAction

+execute(in request, in session, in sql_statement, in dispatch, in errors)

«interface»Action

«uses»

«uses»

«uses»

«uses»

User Actions must be undercom.group4.sdms.actions

package.

Here is an example (Group 4). The framework provides all the classes you see exceptthe <<implementation>> class that fills the ‘User Action” role.This is the whole idea about Frameworks. The framework “calls” the UserAction code, which is something that application developers provide.

We create thisclass!

Page 21: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

23

setPage(in pageUrl)addParameter(in key, in val)

ActionDispatch

+service(in req, in resp)

ActionServlet

+addException()+addErrorMessage()

ActionErrors

ActionSession

«implementation class»UserAction

+execute(in request, in session, in sql_statement, in dispatch, in errors)

«interface»Action

«uses»

«uses»

«uses»

«uses»

User Actions must be undercom.group4.sdms.actions

package.

Given this, let’s apply previous principles (from previous overheads…)Given this, let’s apply previous principles (from previous overheads…)Slide 13:Slide 13: Plug-in architecture – UserAction plugs into frameworkPlug-in architecture – UserAction plugs into framework Generic – Could be reused in other apps - Can see?Generic – Could be reused in other apps - Can see?

Could be used with great flexibility in other apps byCould be used with great flexibility in other apps by inheriting from the interface, Action. Basically, ActionServlet inheriting from the interface, Action. Basically, ActionServlet

‘calls’ UserAction…. ‘calls’ UserAction….Slide 14: The framework Slide 14: The framework captures the design decisionscaptures the design decisions common in a common in a specific application domainspecific application domain… … Frameworks emphasize Frameworks emphasize design reuse over code reusedesign reuse over code reuse

Page 22: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

24

setPage(in pageUrl)addParameter(in key, in val)

ActionDispatch

+service(in req, in resp)

ActionServlet

+addException()+addErrorMessage()

ActionErrors

ActionSession

«implementation class»UserAction

+execute(in request, in session, in sql_statement, in dispatch, in errors)

«interface»Action

«uses»

«uses»

«uses»

«uses»

User Actions must be undercom.group4.sdms.actions

package.

Slide 15: In conventional subroutine calls, we Slide 15: In conventional subroutine calls, we write the main procedurewrite the main procedure and and call the code we want to call the code we want to reusereuse. In frameworks, we . In frameworks, we reuse the main procedurereuse the main procedure and and write the codewrite the code it calls! it calls!

We will write the operations with particular names and calling conventions We will write the operations with particular names and calling conventions – – reducing our creativity and design decisions.reducing our creativity and design decisions.

Can thus build applications much faster!Can thus build applications much faster!

Page 23: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

25

setPage(in pageUrl)addParameter(in key, in val)

ActionDispatch

+service(in req, in resp)

ActionServlet

+addException()+addErrorMessage()

ActionErrors

ActionSession

«implementation class»UserAction

+execute(in request, in session, in sql_statement, in dispatch, in errors)

«interface»Action

«uses»

«uses»

«uses»

«uses»

User Actions must be undercom.group4.sdms.actions

package.

•Slide 20: Usually, but not necessarily, the Slide 20: Usually, but not necessarily, the framework userframework user defines defines subclassessubclasses of existing framework classes to make use of, customize, and extend the of existing framework classes to make use of, customize, and extend the framework services. (see UserAction extending Action…)framework services. (see UserAction extending Action…)

The subclassing/implementation of Action is the key.The subclassing/implementation of Action is the key. (See UserAction above) (See UserAction above)This allows ActionServlet to polymorphically call UserActions no matter what This allows ActionServlet to polymorphically call UserActions no matter what they do. they do.

Page 24: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

26

setPage(in pageUrl)addParameter(in key, in val)

ActionDispatch

+service(in req, in resp)

ActionServlet

+addException()+addErrorMessage()

ActionErrors

ActionSession

«implementation class»UserAction

+execute(in request, in session, in sql_statement, in dispatch, in errors)

«interface»Action

«uses»

«uses»

«uses»

«uses»

User Actions must be undercom.group4.sdms.actions

package.

•(repeated(repeated The subclassing/implementation of Action is the key. The subclassing/implementation of Action is the key. (See UserAction above) This allows ActionServlet to polymorphically call(See UserAction above) This allows ActionServlet to polymorphically call UserActions no matter what they do. UserActions no matter what they do. • From the perspective of the framework, the UserAction simply has toFrom the perspective of the framework, the UserAction simply has to "execute()" itself, taking certain framework and infrastructure classes as"execute()" itself, taking certain framework and infrastructure classes as parameters. parameters. • What it does is irrelevant to the framework.What it does is irrelevant to the framework.

Page 25: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

27

Additional PointsAdditional Points

Plug in architecture - revisitedPlug in architecture - revisited• So long as your UserActions live with the conventions ofSo long as your UserActions live with the conventions of the framework, they will be called. (Said differently, the the framework, they will be called. (Said differently, the

plumbing of J2EE and JDBC is largely taken care of by the plumbing of J2EE and JDBC is largely taken care of by the framework.)framework.)

Generic - revisitedGeneric - revisited• The framework doesn't care if your application is managing a The framework doesn't care if your application is managing a

nuclear power plant or a day care center, it runs your nuclear power plant or a day care center, it runs your UserActions just the same. UserActions just the same.

• Conversely, you, as a developer, can use the framework on any Conversely, you, as a developer, can use the framework on any

kind of suitably architected projectkind of suitably architected project

Page 26: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

28

Additional PointsAdditional Points

PolymorphicPolymorphic• Heavily polymorphic. Goes along with being generic. Heavily polymorphic. Goes along with being generic.

Hence it’s great appeal and power.Hence it’s great appeal and power.

Separation of concernsSeparation of concerns• In this example, the framework provides a consistent In this example, the framework provides a consistent

way to separate the way to separate the presentation layerpresentation layer (JSP's and Form (JSP's and Form classes) from the classes) from the business logic layerbusiness logic layer (UserActions) from (UserActions) from the the data access layerdata access layer (Persistence subsystem). (Persistence subsystem).

• Notice that this is an example of the Model-View- Notice that this is an example of the Model-View- Controller (MVC) architecture discussed in the patterns Controller (MVC) architecture discussed in the patterns class. class.

• As mentioned, As mentioned, frameworks typically make heavy use of frameworks typically make heavy use of design patternsdesign patterns..

Page 27: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

29

Some Last Thoughts [2]Some Last Thoughts [2]

• Remember, Frameworks are targeted to Remember, Frameworks are targeted to a a specific application domainspecific application domain and must and must be set up correctly. be set up correctly.

• Benefits include significantly increased Benefits include significantly increased developer productivitydeveloper productivity!!

• An organization that is interested in An organization that is interested in increasing its degree of software reuse increasing its degree of software reuse should emphasize the creation of should emphasize the creation of frameworksframeworks [2] [2]

Page 28: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

30

Our example: The Need Our example: The Need for Persistent Objects.for Persistent Objects.

• Let’s assume our project data Let’s assume our project data resides in a relational database.resides in a relational database.

• This data must be brought into This data must be brought into local memory…local memory…

Page 29: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

31

Storage Mechanisms and Storage Mechanisms and Persistent ObjectsPersistent Objects

• Object DatabasesObject Databases: - If an object database is used to store : - If an object database is used to store and retrieve objects, no additional custom or third-party and retrieve objects, no additional custom or third-party persistence services are needed. (major attraction)persistence services are needed. (major attraction)

• Relational databases:Relational databases: Very prevalent. If so, we have Very prevalent. If so, we have problems due to mismatch between record-oriented and problems due to mismatch between record-oriented and object-oriented representations of data.object-oriented representations of data.– Need a special O-R mapping service.Need a special O-R mapping service.

• OtherOther: Data might be stored in other storage : Data might be stored in other storage mechanisms/formats: flat files, XML structures, Palm OS mechanisms/formats: flat files, XML structures, Palm OS PDB files, hierarchical databases, … PDB files, hierarchical databases, … – If so, special services are required to enable us to used them as If so, special services are required to enable us to used them as

objects.objects.

Page 30: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

32

Some Last Thoughts = ApplicationSome Last Thoughts = Application

• Persistence Framework – could be used to create Persistence Framework – could be used to create persistence services (persistence subsystem).persistence services (persistence subsystem).

• Considering a small persistence framework (a full-Considering a small persistence framework (a full-blown one is quite large and way beyond what we blown one is quite large and way beyond what we can do here or what was in [2])can do here or what was in [2])

• The framework should provide functions as:The framework should provide functions as:– Store and retrieve objects in a persistent storage Store and retrieve objects in a persistent storage

mechanism (we have seen this…)mechanism (we have seen this…)– Commit and rollback transactions and many more…Commit and rollback transactions and many more…

• Design must be extendable to support different Design must be extendable to support different storage mechanisms & formats such as RDBMSs, storage mechanisms & formats such as RDBMSs, records in flat files, or XML in files records in flat files, or XML in files

• Full treatment of the development of this small Full treatment of the development of this small framework is found in [2] pp. 540-564, but…framework is found in [2] pp. 540-564, but…

Page 31: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

33

• Still a huge undertaking.Still a huge undertaking.• Many points only glossed over [2] even Many points only glossed over [2] even

after 24 pages of text…after 24 pages of text…• Dematerializating objectsDematerializating objects• Materialization and dematerialization of collectionsMaterialization and dematerialization of collections• Queries for groups of objectsQueries for groups of objects• Thorough transaction handlingThorough transaction handling• Error handling when a database operation failsError handling when a database operation fails• Multiuser access and locking strategiesMultiuser access and locking strategies• Security – controlling access to the databaseSecurity – controlling access to the database

Page 32: 1 Frameworks: An Introduction. 2 Approach Gather materials fromGather materials from –[1] Design Patterns – Elements of Reusable Object-Oriented Software

34

Solution: Persistency Subsystem (service) Solution: Persistency Subsystem (service) from a Persistence Framework.from a Persistence Framework.

• So, a ‘So, a ‘persistency framework’persistency framework’ must be a must be a general-purpose, reusable, and general-purpose, reusable, and extendable set of types that provides extendable set of types that provides functionality to support persistent functionality to support persistent objects. (note application area…)objects. (note application area…)

• The The persistence servicepersistence service (or subsystem) (or subsystem) actually provides the services and this actually provides the services and this will be created with a will be created with a persistence persistence framework.framework.– In our contextIn our context, our persistence service may , our persistence service may

also be called an O-R mapping service. also be called an O-R mapping service. (normally found in a technical services (normally found in a technical services layer….)layer….)