Recent Changes - Search:

Software Engineering

This website demonstrates using wikis as teaching and learning tool.

The course instructor is also happy to share the teaching materials here with those who find it readable.

Software Methodologies

A Software Engineering Lecture by Steven Choy

Lecture Overview:

In this lecture, we will study methodologies as guidance for the project manager to select and customize the methods in software engineering to the specific project environment. A software engineering methodology is a collection of methods, best practices, guidelines, templates and tools for developing and managing a software system. In particular, we will cover the following methodologies:

  • Royce’s Methodology
  • Rational Unified Process (RUP)
  • SSADM
  • PRINCE2
  • Extreme Programming (XP)

Reading: Chapter 16 of the textbook Methodologies: Putting It All Together


Recap: Project Manager's Decision

  • Consider you are the project manager and start a software project, what are the key decisions?
    • Project Goal & Scope
    • Schedule
    • Budget
    • Team Members
    • Project Organization
    • Software Tools
    • Software Life Cycle Model/Methodology

What's a methodology?

  • A software engineering methodology is a collection of methods, best practices, guidelines, templates and tools for developing and managing a software system to achieve a a specific goal in a given environment
  • A methodology specifies:
    • When methods or tools should be used
    • What to do to achieve a specific task (e.g. how to perform unit testing) and when unexpected events occur
  • So, how does it differ from the term "process"?
    • Methodology ⇒ more focus on how
    • Process ⇒ more focus on what
  • Examples of software methodology:
    • Royce's Methodology
    • RUP
    • Extreme Programming
    • SSADM
    • Prince2

Methodology Structure

  • Guidelines
    • Contain advices and recommendation to guide through a successful development
  • Techniques
    • Detailed process descriptions that support activities throughout the entire software development life cycle
  • Tools
    • Project management tools are integrated with the methodology
    • Main development tools
  • Templates
    • Reusable documents and checklists

Royce's Methodology

  • Based on Rational Unified Process
  • Inherit all features of RUP
  • Focus:
    • Planning
      • Use Constructive Cost Model for estimation
  • Not a popular methodology as RUP

SSADM

  • Short for "Structured Systems Analysis and Design Method"
  • A methodology used in the analysis and design stages of system development
  • Also, based on Waterfall Model (so, inherit its deficiencies)
  • Commonly used in government software projects in UK and HK

How is SSADM structured?

  • SSADM consists of five main modules:
    • Feasibility Study
      • Conduct a high-level analysis of a business idea to determine whether the system can support the business requirement in a cost-effective way
    • Requirement Analysis
      • Investigate the current environment in terms of processes and data structure
      • Produce business system options and choose from them
    • Requirement Specification
      • Identify the detailed functional & non-functional requirement
      • Further refine the selection business system
    • Logical System Specification
      • Develop technical system options in terms of software/hardware platform
      • Design program logic
    • Physical Design
      • Produce database design and a set of program specifications

PRINCE2

  • Stands for "Project in Controlled Environments"
  • First developed by the Central Computer & Telecommunication Agency of UK as a UK Government standard for IT project management
  • A project management methodology providing organizations with a standard approach to managing and controlling projects
  • Complement with SSADM

How does PRINCE2 work?

  • PRINCE2 outlines 8 processes that are required to carry out a successful project
  • Each process is defined clearly with objectives, activities and deliverables

Considering Methodology…

  • Any proven methodology are available to meet the organization goal?
  • What's the benefit of a methodology to the organization?
  • Does the selected methodology apply to all projects or some?
  • How do you select and implement the methodology?
  • How do you define metric to measure the productivity of applying the methodology?
  • Will all project members (including client and user) comfortable with the methodology?
  • How about training?

Agile Software Methodology

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 tools

Working software over comprehensive documentation

Customer collaboration over contract negotiation

Responding to change over following a plan

That is, while there is value in the items on the right, we value the items on the left more.

Principles behind Agile

  • According to AgileManifesto.org,
    • Satisfying our customer is the highest priority
    • Welcome changing requirements
    • Deliver working software frequently
    • Work with business people throughout the project
    • Build project around motivated people
    • Favor face-to-face communication
    • Continuous attention to technical excellence and good design
    • Simplicity

Agile Methodology

  • Traditional methodologies are heavy and process-oriented
  • Agile methodologies evolves in late 90's
  • Heavy-weight vs Light-weight
    • A heave-weight methodology has many rules, practices and documents
    • A light-weight methodology has only a few rules, practices to follow. And it does not stress on documentation
  • Core values of Agile development:
    • Individuals and interactions over processes and tools
    • Working software over comprehensive documentation
    • Customer collaboration over contract negotiation
    • Responding to change over following a plan
  • Best known agile methodology: XP (Extreme Programming) and Scrum

Extreme Programming (XP)

  • Extreme Programming is a discipline of software development based on values of simplicity, communication, feedback, and courage. It works by bringing the whole team together in the presence of simple practices, with enough feedback to enable the team to see where they are and to tune the practices to their unique situation
  • Target: Small to mid-sized teams (typically from 2 to 12 members) building software under vague or rapidly changing requirements

Core Values & Principles of XP

  • XP has four core values:
    • Communication
      • Continual communication with users and within team
    • Simplicity
      • Choose the simplest design to just make thing work
    • Feedback
      • Feedback early from team, customers and end-users lets you easy to steer your direction if it goes wrong
      • Frequent feedback keeps your project on track
    • Courage
      • The courage to deal with problems proactively
  • The core values gives rise to five principles:
    • Provide rapid feedback
    • Assume simplicity
    • Make incremental changes
    • Embrace changes
    • Do quality work

XP Practices

  • Planning game
    • Determine the scope, priorities and date of next iteration release
    • Customer writes user stories, a lightweight form of use case
    • Developer provides technical estimates
  • Small releases
    • Base on the idea of iterative development
    • Put a simple system into production as quick as possible
    • Release a new version in a short cycle
    • Keeping a short release cycle can let customer feedback early and frequently
  • Metaphor
    • Enhance communication within team and between customers
    • Speak in customers' language, not techno-speak
  • Simple Design
    • Focus on the current problem and design simple
    • Do not try to build a complex design to solve future problems
  • Testing
    • Test-driven development
    • Automate the test (e.g. using JUnit)
    • Automated testing forms the basis for refactoring
  • Refactoring
    • Changing the code to improve readability but without modifying the functionality of the system
  • Pair Programming
  • Collective ownership
    • Anyone in the team can modify any source code of the system
    • No one owns a particular part of the system
  • Continuous integration
    • Integrate and build the system as soon as you finish up a change in a component, module or class
  • 40-hours week
    • Work no more than 40 hours per week whenever possible
  • Onsite customer
    • Have a customer onsite with the team to answer questions
    • Better & rapid response to clarify requirement
  • Coding standard
    • Produce code in consistent style (independent of author) that improves readability
    • Standard should be documented and formalized with team or even organization
    • Working in pair can help developers conforming to the coding standard

XP Roadmap

  • XP Project Application
    Some experts say that extreme programming works best with small to medium size projects and it is best to use Unified Modeling Language (UML) and the Rational Unified Process for running larger software projects. It is said that extreme programming works best for high risk projects.
  • Brief XP Planning Description
    Basically, when an extreme programming project is started, user stories (similar to use cases which are called "metaphors") are written on an index card as a short story. The customer writes the stories and they should be focused on user needs. The business and technical staff are placed in the same room. The business people must rate each story card as follows:
   1. Absolutely must have it.
   2. I need it but I could barely live without it.
   3. If you twist my arm, I don't really need it. 
The technical people rate each story card as requiring one, two, or three man weeks in uninterrupted time for one programmer, ignoring pair programming. If a story requires more than three man weeks, it is broken down further. The technical people rate the risk of each story as low, medium, and high. Once done, the stories may placed in order and are worked on in that order. This is known as "the Planning Game".

Readings…

  • Five Lessons You Should Learn from Extreme Programming
1. Code for Maintainability
2. Know Your Status
3. Communicate Early and Often
4. Do Things That Matter
5. Fix Your Most Important Problem First

Supplementary Lecture

Refactoring

  • Refactoring is a transformation of the source code that improves its readability or modifiability without changing the behaviour of the system
  • Refactoring is a controlled technique for improving the design of an existing code base. [Fowler]

Refactoring Example

  • Take a look, how can it be improved?

public class Product {

    public void printProductDetails() {
    	System.out.println("-------");
    	System.out.println("Product");
    	System.out.println("-------");

    	System.out.println("Name: " + this.name);
    	System.out.println("Product ID: " + this.id);
    	System.out.println("Price: " + this.price);
    	System.out.println("Description: " + this.description);
    	System.out.println("Manufacturer: " + this.manufacturer);
    }

    public void printProductBriefInfo() {
    	System.out.println("-------");
    	System.out.println("Product");
    	System.out.println("-------");

    	System.out.println("Name: " + this.name);
    	System.out.println("Product ID: " + this.id);
    	System.out.println("Price: " + this.price);
    }

}

After Refactoring

  • Extract common code and put it into a method

public class Product {

    public void printProductDetails() {
	printBanner();

    	System.out.println("Name: " + this.name);
    	System.out.println("Product ID: " + this.id);
    	System.out.println("Price: " + this.price);
    	System.out.println("Description: " + this.description);
    	System.out.println("Manufacturer: " + this.manufacturer);
    }

    public void printProductBriefInfo() {
	printBanner();

    	System.out.println("Name: " + this.name);
    	System.out.println("Product ID: " + this.id);
    	System.out.println("Price: " + this.price);
    }

    public void printBanner() {
    	System.out.println("-------");
    	System.out.println("Product");
    	System.out.println("-------");
    }

}

Refactoring Catalog

  • Common refactoring techniques are grouped into a refactoring catalog
  • Like the technique we use in the previous example is known as "Extract Method"
  • Check out the catalog of refactoring at:

Refactoring Catalog Sample #1

  • Consolidate Conditional Expression
    • You have a sequence of conditional test with the same result ⇒ Combine them into a single conditional expression and extract it

double disabilityAmount() {

   if (_seniority < 2) return 0;
   if (_monthsDisabled > 12) return 0;
   if (_isPartTime) return 0;
   // compute the disability amount
Image to be placed (l18fig03.jpg)

double disabilityAmount() {

   if (isNotEligableForDisability())
      return 0;
   // compute the disability amount

Refactoring Catalog Sample #2

  • Replace error code with Exception
    • A method returns a special code to indicate an error ⇒ Throw an exception instead

int withdraw(int amount) {

   if (amount > _balance)
      return -1;
   else {
      _balance -= amount; return 0;
   }

}

Image to be placed (l18fig03.jpg)

void withdraw(int amount)

          throws BalanceException {

   if (amount > _balance)
      throw new BalanceException();

   _balance -= amount;

}

Refactoring Catalog Sample #3

  • Hide method
    • A method is not used by any other class ⇒ Make the method private

Refactoring Catalog Sample #4

  • Introduce Explaining Variable
    • You have a complicated expression ⇒ Put the result of the expression in a temporary variable with a name that explains the purpose

if ( (platform.toUpperCase().indexOf("MAC") > -1)

    && (browser.toUpperCase().indexOf("IE") > -1)
    && wasInitialized() && resize > 0 ) {

    // do something

}

final boolean isMacOs = platform.toUpperCase().indexOf("MAC") > -1; final boolean isIEBrowser = browser.toUpperCase().indexOf("IE") > -1; final boolean wasResized = resize > 0;

if (isMacOs && isIEBrowser && wasInitialized() && wasResized) {

   // do something

}


Extra materials for your to probe further

Extreme Programming is a discipline of software development based on values of simplicity, communication, feedback, and courage. It works by bringing the whole team together in the presence of simple practices, with enough feedback to enable the team to see where they are and to tune the practices to their unique situation.
( Source)

Thanks for Reading

If you would rather like to have this lecture note in printed format, please click the print action link in the top right corner.

If you find any problem in this lecture note, please feel free to tell Steven by steven@findaway.hk

Edit - History - Print - Recent Changes - Search
Page last modified on September 09, 2009, at 11:06 PM