Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Laboratory Digital Technology Group Skills Talk Techniques for significant software engineering tasks 21 st January 2008 Simon Fothergill 3 rd.

Similar presentations


Presentation on theme: "Computer Laboratory Digital Technology Group Skills Talk Techniques for significant software engineering tasks 21 st January 2008 Simon Fothergill 3 rd."— Presentation transcript:

1 Computer Laboratory Digital Technology Group Skills Talk Techniques for significant software engineering tasks 21 st January 2008 Simon Fothergill 3 rd year PhD student

2 Computer Laboratory Digital Technology Group 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!

3 Computer Laboratory Digital Technology Group 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

4 Computer Laboratory Digital Technology Group UML : Why? Models: abstraction : cope with complexity & correct mistakes early Standard : Communication, inter-operability, verification Thorough : Useful, pre-defined levels of abstraction & model elements

5 Computer Laboratory Digital Technology Group UML : Example (class diagram of Decorator design pattern) Component Operation() ConcreteComponent Operation() Decorator Operation() ConcreteDecoratorA Operation() addedstate ConcreteDecoratorB Operation() addedbehaviour Component->Operation() Decorator::Operation(); AddedBehaviour(); package

6 Computer Laboratory Digital Technology Group UML : Example ( sequence interaction diagram ) client: Order: OrderLine * : Customer getTotal() *getValue() GetLocation() getShippingCost()

7 Computer Laboratory Digital Technology Group 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.

8 Computer Laboratory Digital Technology Group 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.

9 Computer Laboratory Digital Technology Group Program Verification Previous, flawed methods Recursive call could cause assert to fail Implicit pre and post conditions of true Just establish invariant as post condition No information hiding Callers concerns with pre/post conditions

10 Computer Laboratory Digital Technology Group 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

11 Computer Laboratory Digital Technology Group Program Verification Example Now the state is invalid, so recursive call would not meet M’s preconditions

12 Computer Laboratory Digital Technology Group 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.

13 Computer Laboratory Digital Technology Group Typesetting code : in the editor Indentation Brackets Inlining / Compression of simple expressions Catch (IOException e) {if (n<0) {e.getMsg();}} Capitalisation 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)

14 Computer Laboratory Digital Technology Group 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

15 Computer Laboratory Digital Technology Group Typesetting code : example Taken from “On the typesetting of computer programs, Esmond Pitt, Melbourne Software Company”, page 10

16 Computer Laboratory Digital Technology Group 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)

17 Computer Laboratory Digital Technology Group The end! Any questions?


Download ppt "Computer Laboratory Digital Technology Group Skills Talk Techniques for significant software engineering tasks 21 st January 2008 Simon Fothergill 3 rd."

Similar presentations


Ads by Google