1
play

1 ADP: The Acyclic- -Dependencies Dependencies ADP: The Acyclic - PDF document

REP: The Reuse Release Equivalence Release Equivalence REP: The Reuse Six Principles of Package Design Six Principles of Package Design Principle Principle 1. Reuse Reuse Release Equivalence Release Equivalence 1. Principle


  1. REP: The Reuse– –Release Equivalence Release Equivalence REP: The Reuse Six Principles of Package Design Six Principles of Package Design Principle Principle 1. Reuse Reuse– –Release Equivalence Release Equivalence 1. Principle Principle The granule of reuse is The granule of reuse is The granule of reuse is Cohesion Cohesion 2. Common Common- - Reuse Principle Reuse Principle the granule of release. the granule of release. 2. the granule of release. 3. Common 3. Common- - Closure Principle Closure Principle 4. Acyclic 4. Acyclic- - Dependencies Principle Dependencies Principle � Anything we reuse must also be released and tracked � Anything we reuse must also be released and tracked � Package author should guarantee � Package author should guarantee 5. Stable 5. Stable- - Dependencies Principle Dependencies Principle Coupling Coupling � � maintanance maintanance � notifications on future changes � notifications on future changes 6. Stable 6. Stable- - Abstractions Principle Abstractions Principle � � option for a user to refuse any new versions option for a user to refuse any new versions � � support for old versions for a time support for old versions for a time REP (cont’d) REP (cont’d) CRP: The Common- CRP: The Common -Reuse Principle Reuse Principle � Primary political issues � Primary political issues � software must be partitioned so that � The classes in a package are The classes in a package are software must be partitioned so that The classes in a package are humans find it convenient humans find it convenient reused together. reused together. reused together. � Reusable package must contain � Reusable package must contain If you reuse one of the If you reuse one of the If you reuse one of the reusable classes reusable classes classes in a package, you classes in a package, you classes in a package, you � either all the classes in a package are � either all the classes in a package are reuse them all. reuse them all. reuse them all. reusable or none of them are reusable or none of them are � Reusable by the same audience � Reusable by the same audience CRP (cont’d) CRP (cont’d) CCP: The Common- -Closure Principle Closure Principle CCP: The Common � If one class in a package uses another package, � If one class in a package uses another package, there is a dependency between the packages there is a dependency between the packages The classes in a package should The classes in a package should The classes in a package should � whenever the used package is released, the using � whenever the used package is released, the using package must be revalidated and re- - released released be closed together against the be closed together against the package must be revalidated and re be closed together against the � when you depend on a package, you depend on every � when you depend on a package, you depend on every same kind of changes. same kind of changes. same kind of changes. class in that package! class in that package! � Classes that are tightly bound with class � Classes that are tightly bound with class A change that affects a closed relationships should be in the same package relationships should be in the same package A change that affects a closed A change that affects a closed � these classes typically have tight coupling � these classes typically have tight coupling package affects all the package affects all the package affects all the � example: container class and its iterators � example: container class and its iterators classes in that package and no � The classes in the same package should be � classes in that package and no The classes in the same package should be classes in that package and no inseparable – inseparable – impossible to reuse one without impossible to reuse one without other packages. other packages. other packages. another another 1

  2. ADP: The Acyclic- -Dependencies Dependencies ADP: The Acyclic CCP (cont’d) CCP (cont’d) Principle Principle � SRP restated for packages � SRP restated for packages � a package should not have multiple reason to change � a package should not have multiple reason to change Allow no cycles in the Allow no cycles in the Allow no cycles in the � Maintainability often more important than � Maintainability often more important than reusability reusability package dependency graph. package dependency graph. package dependency graph. � changes should occur all in one package � changes should occur all in one package � minimizes workload related releasing, revalidating and � minimizes workload related releasing, revalidating and redistributing redistributing � Without cycles it is easy to compile, test and release ‘bottom � Without cycles it is easy to compile, test and release ‘bottom - - up’ up’ � Closely related to OCP � Closely related to OCP when building the whole software when building the whole software � strategic closure: close against types of changes that � � The packages in a cycle will become � strategic closure: close against types of changes that The packages in a cycle will become de facto de facto a single package a single package are probable � compile � are probable compile- - times increase times increase � � testing becomes difficult since a complete build is needed to te testing becomes difficult since a complete build is needed to test a st a � CCP guides to group together classes that are open to � CCP guides to group together classes that are open to single package single package the same type of change the same type of change � developers can step over one another since they must be using � developers can step over one another since they must be using exactly the same release of each other’s packages exactly the same release of each other’s packages The ‘Morning- -After Syndrome’ After Syndrome’ Release- -Control Control The ‘Morning Release � Developers are modifying the same source files � Partition the development environment into releasable � � Developers are modifying the same source files Partition the development environment into releasable packages packages trying to make it work with the latest changes trying to make it work with the latest changes � package = unit of work � package = unit of work somebody else did → → no stable version no stable version somebody else did � � developer modifies the package privately developer modifies the package privately � Solution # 1: the weekly build � � developer releases the working package � Solution # 1: the weekly build developer releases the working package � � everyone else uses the released package while the developer everyone else uses the released package while the developer � developers work alone most of the week and integrate � developers work alone most of the week and integrate can continue modifying it privately for the next release can continue modifying it privately for the next release on Friday on Friday � No developer is at the mercy of the others � No developer is at the mercy of the others � works on medium � works on medium - - sized projects sized projects � � everyone works independently on their own packages everyone works independently on their own packages � for bigger projects, the iteration gets longer (monthly � for bigger projects, the iteration gets longer (monthly � � everyone can decide independently when to adapt the everyone can decide independently when to adapt the build?) → → rapid feedback is lost packages to new releases of the packages they use packages to new releases of the packages they use build?) rapid feedback is lost � no ‘big bang’ integration but small increments � no ‘big bang’ integration but small increments � Solution # 2: � Solution # 2: � To avoid the ‘morning � To avoid the ‘morning- - after syndrome’ the dependency tree after syndrome’ the dependency tree � partition the development environment into releasable � partition the development environment into releasable must not have any cycles must not have any cycles packages packages � ensure ADP � ensure ADP Package Structure as a Directed Package Structure as a Directed Breaking the Cycle with DIP Breaking the Cycle with DIP Acyclic Graph Acyclic Graph MyApplication MyApplication MyDialogs MyDialogs MyApplication MyApplication X X Y Y Message Message Task Task MyTasks MyTasks W indow W indow W indow W indow Database Database MyDialogs MyDialogs MyApplication MyApplication Tasks Tasks MyDialogs MyDialogs «interface» «interface» X X Y Y X Server X Server W indow s W indow s 2

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend