Skills talk
This presentation is the property of its rightful owner.
Sponsored Links
1 / 17

Skills Talk PowerPoint PPT Presentation


  • 54 Views
  • Uploaded on
  • Presentation posted in: General

Skills Talk. Techniques for significant software engineering tasks. 21 st January 2008 Simon Fothergill 3 rd year PhD student. Outline. UML : What, why and how? Program verification : Theory and practise Typesetting code : in editor and in documents Questions

Download Presentation

Skills Talk

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Skills talk

Skills Talk

Techniques for significant software engineering tasks

21st January 2008

Simon Fothergill

3rd year PhD student


Outline

Outline

  • UML : What, why and how?

  • Program verification : Theory and practise

  • Typesetting code : in editor and in documents

  • Questions

  • Vignettes, not technically challenging, but worth drawing ones attention to, even if not vigorously upheld!


Uml what

UML : What?

  • Unified Modelling Language

  • Object orientated software analysis & design

  • Born out of 3 similar methodologies at OMG

  • Language, not process

  • Practical tools : Many Eclipse plug-ins

Views

  • For modelling at different stages of the design process

  • E.g. use-case, design, deployment

Diagrams

  • For modelling at different aspects of the system

  • Behaviour

  • Structure

  • E.g. Sequence, class, object, state-chart


Uml why

UML : Why?

  • Models: abstraction : cope with complexity & correct mistakes early

  • Standard : Communication, inter-operability, verification

  • Thorough : Useful, pre-defined levels of abstraction & model elements


Uml example class diagram of decorator design pattern

UML : Example (class diagram of Decorator design pattern)

Component

package

Operation()

Component->Operation()

ConcreteComponent

Decorator

Operation()

Operation()

Decorator::Operation();

AddedBehaviour();

ConcreteDecoratorA

ConcreteDecoratorB

Operation()

Operation()

addedbehaviour

addedstate


Uml example sequence interaction diagram

UML : Example (sequence interaction diagram)

client

: Order

: OrderLine *

: Customer

getTotal()

*getValue()

getShippingCost()

GetLocation()


Program verification

Program Verification

  • Invariants : Expressions that express a desired, “consistant” state, for a duration or at a specific point in an executing program.

  • If it is true, for/at this time, everything’s good!

  • By increasing the state space of a program with meta-data about the invariants, compilers can provide some automated verification.


Program verification1

Program Verification

  • Immediate invariants, true every time a certain point in the code is reached. Can catch logical errors in algorithms.

  • Object invariants, true, if an expression involving the objects data, holds. Catches misuse of data.


Program verification2

Program Verification

  • Previous, flawed methods

Callers concerns with

pre/post conditions

No information

hiding

Implicit pre and post

conditions of true

Recursive call could

cause assert to fail

Just establish invariant as post condition


Program verification3

Program Verification

  • A Better approach

o :: T

public field o.st = {Valid, Invalid} for use in specifications only

Can only alter o.st using pack and unpack

Newly instantiated objects are Invalid

Invariant only uses members of its class

Can only update Invalid objects


Program verification4

Program Verification

  • Example

Now the state is invalid, so recursive

call would not meet M’s preconditions


Program verification practial advise

Program Verification : Practial advise

  • Java’s assert statement can be used for pre/post conditions and invariants

  • JML : Java Modelling Language has functionality for using ensures/requires and extensions on this idea. It also has a hack for information hiding.


Typesetting code in the editor

Typesetting code : in the editor

  • Compound words

    • Underscore

    • Concatenation + capitalisation

  • Class / Variable / method names:

    • Classnames

    • CONSTANTS

    • CLASS/Instance variables

    • CLASS/Instance methods

    • localVariables

    • Iterators, counters, accumulators (i,j,k,count,acc)

  • Indentation

  • Brackets

  • Inlining / Compression of simple expressions

    Catch (IOException e) {if (n<0) {e.getMsg();}}

  • Capitalisation


Typesetting code in documents

Typesetting code : in documents

Beware

  • Part of the notation (quotes, line breaks, indentation)

  • Hyphenation can be misleading

  • Size of tabs

  • Number of characters per line

  • Monospacing for columnular languages

  • Case

    Consider

  • Font

    • Stand out

    • No need for serif fonts

    • Differentiate comments and keywords

    • Don’t confuse 1,l,I,0,O,o

  • Justification can not be helpful


Typesetting code example

Typesetting code : example

Taken from “On the typesetting of computer programs, Esmond Pitt, Melbourne Software Company”, page 10


References

References

  • Practical Object-Oriented Design with UML; Mark Priestley; McGraw Hill; ISBN: 0-07-709599-5

  • Design Patterns, Elements of Reusable Object-Oriented Software; Gamma, Helm, Johnson, Vlissides, Addison-Wesley, ISBN: 0-201-63361-2

  • Verification of object orientated programs with invariants; Barnett & co; JOT 2004, Vol. 3, No. 6

  • On the typesetting of computer programs, Esmond Pitt, Melbourne Software Company (http://www.rmiproxy.com/javarmi/TypesettingComputerPrograms.pdf)


The end

The end!

Any questions?


  • Login