Refining the Structure of the Requirements Model

of 27 /27
Refining the Structure of the Requirements Model Aim: To create the conditions for software re-use. Bennett, McRobb and Farmer ch 8

Embed Size (px)

description

Refining the Structure of the Requirements Model. Aim: To create the conditions for software re-use. Bennett, McRobb and Farmer ch 8. Mechanisms for Software Reuse. 1. Abstraction mechanisms: generalisation, composition, encapsulation/information hiding - PowerPoint PPT Presentation

Transcript of Refining the Structure of the Requirements Model

  • Refining the Structure of the Requirements ModelAim: To create the conditions for software re-use.Bennett, McRobb and Farmer ch 8

  • Mechanisms for Software Reuse1. Abstraction mechanisms: generalisation, composition, encapsulation/information hiding2. Specification of Reusable software components3. Application of Analysis Patterns

  • Approaches to Re-UseImport existing components or structures from beyond the project boundaries (e.g. re-use of platform-specific components e.g. .Net).Reuse components of current project- identify existing or design with re-use in mind.Design new components for use within other projects.

  • Why Re-Use?No need to reinvent the wheelEnforces standardisation which can make subsequent change easier

  • How to re-use1. The starting point for reuse opportunities is within requirements analysis.

    Refinement is done through :

    (i) abstracting common elements i.e. identifying where you can use generalisation/inheritance) and(ii) the encapsulation of composite structures and components.

  • Abstraction mechanisms in OO

    1. Generalisation/ Inheritance2. Encapsulation3. Composition

  • 1. Inheritance/generalisationidentifying those aspects of a design that are relevant to more than one situation and redesigning your classes to put the common aspects in a parent class and the specific aspects in a child class. Abstract classes are parent classes which have no members in themselves but specify common aspects of a number of (concrete) child classes which can be reused easily. ISA IS A KIND OF is the key relationship here.

  • Example- Agate (ch 8)

    StaffmemberNameNOStart DateCalculatebonus()AssignNewStaffGrade()getStaffdetails()

    AdminStaff

    Calculatebonus()

    CreativeStaffqualificationCalculatebonus()Assignstaffcontact()

  • Example: Sligo Motorhomes

    VehicleSerial numberModelYear

    Sell()Getdetails()

    New VehicleNameManufacturerBase CostSell()Chooseoptions()

    Trade in vehicleMakeSell()

  • 2. Encapsulation design software that can be used as a black box component. To use it you only need to know how the interface works not the implementation. This means that you can have different implementations for the same interface, which could be useful, for example in porting an application to different platforms. The focus is on the external behaviour, but ignoring the detail of how that behaviour is produced.

  • Example : C# librariesWe dont know the implementation of window, textbox .. or any of the other hundreds of classes in WPF, Windows forms etc. BUTWe know their interface so we can use them

  • 3. Compositioninvolves encapsulating a group of classes that have the capacity to be a re-usable subassembly.

    The relationship here is ISA Part Of. Composition is made up of ... A car has an engineAggregation- can have 0 or more sand grains on the beach

  • ExampleA newspaper advert can be composed of copy(text), graphics and a photograph.

    0..*1..*1..*0..*1..*1..*

    Graphics

    NewspaperAdvert

    Text

    Photo

  • Packages and DependenciesThe aim here is to ensure the system remains robust in the face of changing requirements.Organise classes into packages in such a way that change is localised. Show dependencies between these packages e.g. if a class in one package uses or is related to an object in another package this must be shown in the package diagram.

  • Divide your classes into packages

  • Example Agate (p246)Packages mark out related but distinct application areas: advert preparation, staff management, campaign management.

    campaign managementControlstaff managementadvert preparationUser Interface

  • Components

    Relatively complex structures developed separately to be plugged together.Meet a clear-cut but general need.Have more than 1 simple well-defined external interfaces.

  • UML Support for Modelling ComponentsComponent A has a provided interface which offers services to components that know how to request those services. Component B has a required interface which requests services from a provided interface on another component. (basically it will send a message using a defined operation and parameters frpm some provided interface).

  • Ball and socket diagram.

    Component AComponent B

  • In UML, a component diagram provides a physical view of the system. Its purpose is to show the dependencies that the software has on the other software components (e.g., software libraries) in the system. The diagram can be shown at a very high level, with just the large-grain components, or it can be shown at the component package level i.e. class container levels such as .NET's namespaces (e.g., System.Web.UI).

  • Component-Based DevelopmentThe classes that comprise an individual component need to be identified, modelled, specified designed and coded. Components must be designed to a common standard e.g. A components behaviour is described by its specification.A specification can have many implementations e.g. to work on many platforms.

  • Example: Airline Booking SystemIn airline systems there is often a mix of systems, including older systems and other different systems trying to do the same things.Systems need to be designed to enable the upgrading of older systems with minimum fuss and to enable the use of different types of booking process.A Bookings component provides an interface called makebooking which is available to any system who knows how to use it i.e. knows the services provided and their protocols or signatures

  • Service Oriented Architecture

    Designed to enable larger grained components to be integrated togetherNeeds clear interface design

    E.g. Web services use

  • Payments Bookings FlightManagement Customers Check-inmakebookingallocateseatsmanagecustomerstakepaymentallocateseatsFrom Bennett Mc Robb and Farmer p250

  • Software Development PatternsA pattern is a template of an example worth copying.Analysis patterns provide a structure of classes and associations that occur again and again. Each pattern can be used to communicate a general understanding about how to model a particular set of requirements.

  • Example

    10..*Bennett, Mc Robb and Farmer p254

    TransactionTransaction noTransactiondateTransactiontotal

    TransactionlineTransactionlinenoTransactionlineqtyTransactionlinevalue

  • Software components can reduce the effort in coding and implementation.Analysis components and patterns can reduce the time taken to develop and test a design and also act as a store of knowledge that embodies best practice. They can also reduce the time taken to develop a deep understanding of the system.