1Software Engineering CSCI 3321 Computer Science Department Agile Development &Real Time SystemsDr. Thomas HicksComputer Science DepartmentTrinity University41
2Agile Development & Real Time Systems Chapter 4Software Engineering : A Practitioner’s ApproachAgile Development & Real Time SystemsDr. Thomas E. Hicks Computer Science Department Trinity UniversityThanks To Ian Sommerville & Roger Pressman For Much Of The Slide Content
4The Manifesto for Agile Software Development “We are uncovering better ways of developing software by doing it and helping others do it. Through this work we have come to value:Individuals and interactions over processes and toolsWorking software over comprehensive documentationCustomer collaboration over contract negotiationResponding to change over following a planThat is, while there is value in the items on the right, we value the items on the left more.”Kent Beck et alThe_Agile_Manifesto_SDMagazine.pdf
6Politics Agile Software Development “Considerable Debate about the benefits and applicability”Pro Agile : “Traditional methodologies are a bunch of stick-in-the-muds who’d rather produce flawless documentation than a working system that meets business needs.”Pro Traditional: “Lightweight, agile methodologists are a bunch of glorified hackers who are going to be in for a heck of a surprise when they try to scale up their toys into enterprise-wide software”This methodology risks degenerating into a religious war.Pressman
7Ivar Jacobson - 1“Agility has become today’s buzz word when considering a modern software process. An agile team is a nimble team able to appropriately respond to changes.Changes in the software being built, changes in the team members, changes because of new technology, changes of all kinds that may have impact upon the product they build or the project that creates the product.
8Ivar Jacobson – 2Support for changes should be built-in every thing we do in software, something we embrace because it is the heart and soul of software.An agile team recognizes that software is developed by individuals working in teams and that the skills of those people, their ability to collaborate, is at the core for the success of the project.”
97 Human Factors Of Agile Software Development Proponents of the Agile Process emphasize the human factors:Competence – innate talent and overall knowledge of the process – teach needed info to all team membersCommon Focus – the agile team will focus the different talents working on different portions of the project on the deliverable.Collaboration – quality software requires the collaboration & communication of customer & software engineersDecision Making Ability – teams must be able to make those decisions necessary to control their destinyPressman
107 Human Factors Of Agile Software Development Proponents of the Agile Process emphasize the human factors:Fuzzy-Problem-Solving-Ability – managers realize teams deal with ambiguity and change – sometimes must accept the fact that problem solving today will be different than problem solving tomorrow – maybe use some of same code.Mutual Trust & Respect – Agile teams must become what DeMarco & Lister call “Jelled Teams” – whole greater than sum of its parts.Self Organization – self organized to complete work, meet deadlines, etc. Moral booster.Pressman
11“There is no substitute for rapid feedback, both on the developer process and on the product itself” Martin Fowler
1212 Principles Adopted By The “Agility Conference” 1-4 Highest Priority is to satisfy the customer through early and continuous delivery of valued software.Welcome change requirements even late in the development. Agile processes harness change for the customer’s competitive advantage.Deliver working software frequently, from a couple of weeks to a couple of months, with a preference to the shorter time scale.Business people, and developers, must work together daily throughout the project.
1312 Principles Adopted By The “Agility Conference” 5-8 Build projects around motivated individuals. Give them the environment and the support they need. Trust them to get the job done.The most efficient and effective method of conveying information to and within a development team is face to face conversation.Working software is the primary measure of progress.Agile processes promote sustainable development. The sponsors, developers, users should be able to maintain constant pace indefinitely.
1412 Principles Adopted By The “Agility Conference” 9-12 Continual attention to technical excellence and good design enhances agility.Simplicity, the art of minimizing the amount of work not done, is essential.The best architectures, requirements, and designs emerge from self organizing teams.At regular intervals, the team reflects on how to become more effective, then tunes and tunes and adjusts its behavior accordingly.
15Agile Lite Less Time Planning Faster Coding
16Agility Software Development Research Tells Us That : Effective response to change; rapid and adaptiveEffective communication among all stakeholdersDrawing the customer onto the teamOrganizing a team so that it is in control of the work performedYields …Rapid, incremental delivery of software
17About The Agile Process Agile Process is driven by customer descriptions of what is required; these descriptions are called scenariosAgile Process recognizes that plans are short-livedAgile Process develops software iteratively with a heavy emphasis on construction activitiesAgile Process delivers multiple ‘software increments’Agile Process adapts as changes occur
19Extreme Programming (XP) 4 Step XP Planning Process The most widely used agile process, originally proposed by Kent BeckXP PlanningXP Planning begins with the creation of “user stories”An XP Agile team assesses each story and assigns a costThese XP Stories are grouped to for a deliverable incrementA commitment is made on delivery date
20About Extreme Programming (XP) Design XP Design follows the KIS principleXP Design encourage the use of CRC cards (see Chapter 8)Class Responsibility CollaboratorFor difficult design problems, XP suggests the immediate creation of “spike solutions”; spikes solutions are an operational design prototype of the problem area.XP design encourages “refactoring”; refactoring an iterative refinement of the internal program design – it is cleaning up the code after it has been written.
21About Extreme Programming (XP) Coding XP coding recommends the construction of a unit test for a story before coding commencesXP coding encourages “pair programming” – two people work together at one computer to complete code for one story.
22About Extreme Programming (XP) Testing XP testing recommends that all unit tests be executed daily to encourage regression analysis (i.e. to make sure code still works after it has been modified)“XP testing requires “acceptance tests”, also called “customer tests” that are defined by the customer and executed to assess customer visible functionality
23“Extreme Programming is a discipline of software development based on values of simplicity, communication, feedback, and courage.”RonJeffries
24Adaptive Software Development ASDAdaptive Software Development
25Adaptive Software Development (ASD) ASD was originally proposed by Jim Highsmith6 Distinguishing Features Of ASD 1-3ASD uses mission-driven planning; accomplish the taskASD partitions the project into components; it is a component-based focusUses “time-boxing” – each task associated with a box; if the project cannot be delivered on time, the work moves forward to the next task when ~90% of the task is complete. Although this is not always acceptable, it is often the case that the last 10% can be completed later.
26Adaptive Software Development (ASD) ASD was originally proposed by Jim Highsmith6 Distinguishing Features Of ASD – 4-6ASD explicitly considers all of risksASD emphasizes collaboration for requirements gatheringASD emphasizes “learning” throughout the process
273 Major Steps of Adaptive Software Development (ASD) SpeculationUse the customer mission statement, project constraints, and basic requirements to define sets of cycles (software releases) for the project.CollaborationThe collaboration method is central to all of the agile processes. Using highly motivated people, working collaboratively together to multiply their talents beyond individual expectations. Trust is central.Create Requirements and Mini-Specs.LearningImplement and test componentsTechnical ReviewsFocus Group Feedback
28Adaptive Software Development cylngusmorjbq-xRhJAD/fkw
29“I like to listen. I have learned a great deal from listening carefully. Most people never listen.” Ernest Hemingway
30Dynamic Software Development Method DSDMDynamic Software Development Method
31Dynamic Systems Development Method - DSDM DSDM—distinguishing featuresSimilar in most respects to XP and/or ASD8 Guiding Principles Of DSDM – 1-4Active user involvement is imperative.DSDM teams must be empowered to make decisions.The focus is on frequent delivery of products.Fitness for business purpose is the essential criterion for acceptance of deliverables.Promoted by the DSDM Consortium (www.dsdm.org)
32Dynamic Systems Development Method - DSDM 8 Guiding Principles Of DSDM 5 - 8Iterative and incremental development is necessary to converge on an accurate business solution.All changes during development are reversible.Requirements are baselined at a high levelTesting is integrated throughout the life-cycle.
36Scrum – (rugby match term) Developed by Jeff Sutherland in early 1990’sExpanded upon by Schwaber and Beedle in 2001Scrum—distinguishing features – very “agile like”Scrum has small teams to maximize communication and minimize costsThe Scrum process must be adaptable to business and technological changesThe Scrum process yields software that can be inspected, adjusted, tested, documented, and built on.The Scrum process partitions the project into low-coupling partitions, or “packets”.w
37Scrum (cont)The Scrum process constantly tests and documents as the project is built.The Scrum process provides the ability to declare the product “done”Scrum work occurs in “sprints” and is derived from a “backlog” of existing requirementsScrum meetings are very short and sometimes conducted without chairsScrum “demos” are delivered to the customer with the time-box allocated
41Proposed by Cockburn and Highsmith Crystal—distinguishing features Actually a family of process models that allow “maneuverability” based on problem characteristicsFace-to-face communication is emphasizedSuggests the use of “reflection workshops” to review the work habits of the team
43Feature Driven Development (FDD) Originally proposed by Peter Coad et al as a process model for OOPFDD—distinguishing featuresEmphasis is on defining “features”a feature “is a client-valued function that can be implemented in two weeks or less.”Uses a feature template<action> the <result> <by | for | of | to> a(n) <object>A features list is created and “plan by feature” is conductedDesign and construction merge in FDD
46Originally proposed by Scott Ambler Agile ModelingOriginally proposed by Scott AmblerSuggests a set of agile modeling principlesModel with a purposeUse multiple modelsTravel lightContent is more important than representationKnow the models and the tools you use to create themAdapt locally
51Real-time systems are used to monitor and control their environment Real-time systems inevitably are associated with hardware devicesSensors: Collect data from the system environmentActuators: Change (in some way) the system's environmentTime is critical. Real-time systems MUST respond within specified times
52Real-time Definitions A real-time system is a software system where the correct functioning of the system depends on the results produced by the system and the time at which these results are producedA ‘soft’ real-time system is a system whose operation is degraded if results are not produced according to the specified timing requirementsA ‘hard’ real-time system is a system whose operation is incorrect if results are not produced according to the timing specification
54Stimulus/Response Systems Given a stimulus, the system must produce a response within a specified timePeriodic Stimuli: Stimuli which occur at predictable time intervalsFor example, a temperature sensor may be polled 10 times per secondAperiodic stimuli: Stimuli which occur at unpredictable timesFor example, a system power failure may trigger an interrupt which must be processed by the system
55Architectural Considerations Because of the need to respond to timing demands made by different stimuli/responses, the system architecture must allow for fast switching between stimulus handlersTiming demands of different stimuli are different so a simple sequential loop is not usually adequateReal-time systems are usually designed as cooperating processes with a real-time executive controlling these processes
58Real-time System Elements Sensors control processesCollect information from sensors. May buffer information collected in response to a sensor stimulusData processorCarries out processing of collected information and computes the system responseActuator controlGenerates control signals for the actuator
61Real-time System Design – 2 Stages Real-time system engineers must design both the hardware and the software associated with system.Real-time system engineers then partition functions to either hardware or softwareDesign decisions should be made on the basis on non-functional system requirementsHardware delivers better performance but potentially longer development and less scope for change
63R-T Systems Design Process – 6 Steps The first step in the R-T design process is to identify the stimuli to be processed and the required responses to these stimuliThe second step in the R-T design process is to identify the timing constraints for each stimulus and responseThe third step in the R-T design process is to aggregate the stimulus and response processing into concurrent processes. A process may be associated with each class of stimulus and response.
64R-T Systems Design Process – 6 Steps The fourth step in the R-T design process is to design algorithms for each concurrent process. These must meet the given timing requirementsThe fifth step in the R-T design process is to design a scheduling system which will ensure that processes are started in time to meet their deadlinesThe sixth step in the R-T design process is to integrate the real-time executive with an operating system (if necessary)
66Timing ConstraintsMeeting timing constraints may require extensive simulation and experiment to ensure that these are met by the systemMeeting timing constraints may mean that certain design strategies such as object-oriented design cannot be used because of the additional overhead involvedMeeting timing constraints may mean that low-level programming language features have to be used for performance reasons
68State Machine Modelling The effect of a stimulus in a real-time system may trigger a transition from one state to another.Finite state machines can be used for modelling real-time systems.However, FSM models lack structure. Even simple systems can have a complex model.The UML includes notations for defining state machine models
71Real-time Programming & Languages Hard-real time systems may have to programmed in assembly language to ensure that deadlines are metLanguages such as C allow efficient programs to be written but do not have constructs to support concurrency or shared resource managementAda as a language designed to support real-time systems design so includes a general purpose concurrency mechanism
72Java As a Real-time Language Java supports lightweight concurrency (threads and synchronized methods) and can be used for some soft real-time systemsJava 2.0 is not suitable for hard RT programming or programming where precise control of timing is requiredNot possible to specify thread execution timeUncontrollable garbage collectionNot possible to discover queue sizes for shared resourcesVariable virtual machine implementationNot possible to do space or timing analysis
74Real-time executives do not include facilities such as file management Real-time executives are specialized operating systems which manage the processes in the RTSReal-time executives are responsible for process management and resource (processor and memory) allocationReal-time executives may be based on a standard RTE kernel which is used unchanged or modified for a particular applicationReal-time executives do not include facilities such as file management14
75R-T Executive Components Real-time clockProvides information for process scheduling.Interrupt handlerManages aperiodic requests for service.SchedulerChooses the next process to be run.Resource managerAllocates memory and processor resources.DispatcherStarts process execution.
76R-T Non-stop System Components Configuration managerResponsible for the dynamic reconfiguration of the system software and hardware. Hardware modules may be replaced and software upgraded without stopping the systemsFault managerResponsible for detecting software and hardware faults and taking appropriate actions (e.g. switching to backup disks) to ensure that the system continues in operation
79The processing of some types of stimuli must sometimes take priority R-T Process PriorityThe processing of some types of stimuli must sometimes take priorityInterrupt level priority. Highest priority which is allocated to processes requiring a very fast responseClock level priority. Allocated to periodic processesWithin these, further levels of priority may be assigned
80R-T Interrupt Servicing Control is transferred automatically to a pre-determined memory locationThis location contains an instruction to jump to an interrupt service routineFurther interrupts are disabled, the interrupt serviced and control returned to the interrupted processInterrupt service routines MUST be short, simple and fast
81R-T Periodic Process Servicing In most real-time systems, there will be several classes of periodic process, each with different periods (the time between executions), execution times and deadlines (the time by which processing must be completed)The real-time clock ticks periodically and each tick causes an interrupt which schedules the process manager for periodic processesThe process manager selects a process which is ready for execution
83R-T Process Management Concerned with managing the set of concurrent processesPeriodic processes are executed at pre-specified time intervalsThe executive uses the real-time clock to determine when to execute a processProcess period - time between executionsProcess deadline - the time by which processing must be complete
85Process SwitchingThe scheduler chooses the next process to be executed by the processor. This depends on a scheduling strategy which may take the process priority into accountThe resource manager allocates memory and a processor for the process to be executedThe dispatcher takes the process from ready list, loads it onto a processor and starts execution
87R-T Scheduling Strategies Non pre-emptive schedulingOnce a process has been scheduled for execution, it runs to completion or until it is blocked for some reason (e.g. waiting for I/O)Pre-emptive schedulingThe execution of an executing processes may be stopped if a higher priority process requires serviceScheduling algorithmsRound-robinRate monotonicShortest deadline first
89Monitoring & Control Systems Monitoring & control systems are an important class of real-time systemsMonitoring & control systems continuously check sensors and take actions depending on sensor valuesMonitoring systems examine sensors and report their resultsControl systems take sensor values and control hardware actuators
91Designing A Burglar Alarm System Example Of A Monitoring System A system is required to monitor sensors on doors and windows to detect the presence of intruders in a buildingWhen a sensor indicates a break-in, the system switches on lights around the area and calls police automaticallyThe system should include provision for operation without a mains power supply
92Sensors & Actions Of A Burglar Alarm System Example Of A Monitoring System Movement detectors, window sensors, door sensors.50 window sensors, 30 door sensors and 200 movement detectorsVoltage drop sensorActionsWhen an intruder is detected, police are called automatically.Lights are switched on in rooms with active sensors.An audible alarm is switched on.The system switches automatically to backup power when a voltage drop is detected.
94The 5 Step R-T System Design Process Identify stimuli and associated responsesDefine the timing constraints associated with each stimulus and responseAllocate system functions to concurrent processesDesign algorithms for stimulus processing and response generationDesign a scheduling system which ensures that processes will always be scheduled to meet their deadlines
95Stimuli To Be Processed - A Burglar Alarm System Power failureGenerated aperiodically by a circuit monitor. When received, the system must switch to backup power within 50 msIntruder alarmStimulus generated by system sensors. Response is to call the police, switch on building lights and the audible alarm
101Control SystemsA burglar alarm system is primarily a monitoring system. It collects data from sensors but no real-time actuator controlControl systems are similar but, in response to sensor values, the system sends control signals to actuatorsAn example of a monitoring and control system is a system which monitors temperature and switches heaters on and off
103Data Acquisition Systems Data Acquisition Systems collect data from sensors for subsequent processing and analysis.Data collection processes and processing processes may have different periods and deadlines.Data collection may be faster than processing e.g. collecting information about an explosion.Circular or ring buffers are a mechanism for smoothing speed differences.
104Nuclear Reactor Data Collection Another Control System Example A system collects data from a set of sensors monitoring the neutron flux from a nuclear reactor.Flux data is placed in a ring buffer for later processing.The ring buffer is itself implemented as a concurrent process so that the collection and processing processes may be synchronized.
105Nuclear Reactor Flux Monitoring Another Control System Example
107Mutual ExclusionProducer processes collect data and add it to the buffer. Consumer processes take data from the buffer and make elements availableProducer and consumer processes must be mutually excluded from accessing the same element.The buffer must stop producer processes adding information to a full buffer and consumer processes trying to take information from an empty buffer.
108Java implementation of a ring buffer 1 A Circular Buffer Sample CodeJava implementation of a ring buffer 1
109Java implementation of a ring buffer 2 A Circular Buffer Sample CodeJava implementation of a ring buffer 2
110Software Engineering CSCI 3342 Dr. Thomas E. HicksComputer Science Department Trinity UniversityTextbook: Software Engineering By Roger PressmanTextbook: Software Engineering By Ian SommervilleSpecial Thanks To WCB/McGraw-Hill & Addison Wesley For Providing Graphics Of Some Of Text Book Figures For Use In This Presentation.