Bidirectional transformations workshop at Cargilfield Perdita - - PowerPoint PPT Presentation

bidirectional transformations
SMART_READER_LITE
LIVE PREVIEW

Bidirectional transformations workshop at Cargilfield Perdita - - PowerPoint PPT Presentation

Bidirectional transformations workshop at Cargilfield Perdita Stevens University of Edinburgh June 2017 Who am I? Whats my job? Perdita Stevens (Robin Bradfields mother!) Professor of Mathematics of Software Engineering University of


slide-1
SLIDE 1

Bidirectional transformations

workshop at Cargilfield Perdita Stevens

University of Edinburgh

June 2017

slide-2
SLIDE 2

Who am I? What’s my job?

Perdita Stevens (Robin Bradfield’s mother!) Professor of Mathematics of Software Engineering University of Edinburgh

slide-3
SLIDE 3

What’s software?

  • pposite of hardware
slide-4
SLIDE 4

What’s software?

  • pposite of hardware

all the computery stuff you can’t break with a hammer...

slide-5
SLIDE 5

What’s software?

  • pposite of hardware

all the computery stuff you can’t break with a hammer... Have you written a Scratch program? Like that but bigger...

slide-6
SLIDE 6

Almost random example bit of code

void SAL_CALL BaseContainerControl::dispose() throw( RuntimeException, std::exception ) { // Tell everything that this container is now gone. // It’s faster if you listen to both the control and the container. // Ready for multithreading MutexGuard aGuard( m_aMutex ); // remove listeners EventObject aObject; aObject.Source.set( static_cast<XControlContainer*>(this), UNO_QUERY ); m_aListeners.disposeAndClear( aObject ); // remove controls Sequence< Reference< XControl > > seqCtrls = getControls(); Reference< XControl > * pCtrls = seqCtrls.getArray(); sal_uInt32 nCtrls = seqCtrls.getLength(); size_t nMaxCount = maControlInfoList.size(); size_t nCount = 0; for ( nCount = 0; nCount < nMaxCount; ++nCount ) { delete maControlInfoList[ nCount ]; } maControlInfoList.clear(); for ( nCount = 0; nCount < nCtrls; ++nCount ) { pCtrls [ nCount ] -> removeEventListener ( static_cast<

slide-7
SLIDE 7
slide-8
SLIDE 8

Size...

“In a Nutshell, LibreOffice... ... has had 452,587 commits made by 1,672 contributors representing 9,087,155 lines of code ... is mostly written in C++ with an average number of source code comments ... has a well established, mature codebase maintained by a very large development team with stable Y-O-Y commits ... took an estimated 2,773 years of effort (COCOMO model) starting with its first commit in September, 2000 ending with its most recent commit 18 days ago ” https://www.openhub.net/p/libreoffice as at 19/6/17

slide-9
SLIDE 9

Other examples

Lines of code in: A simple game on a mobile phone: about 10,000

slide-10
SLIDE 10

Other examples

Lines of code in: A simple game on a mobile phone: about 10,000 A heart pacemaker: about 80,000

slide-11
SLIDE 11

Other examples

Lines of code in: A simple game on a mobile phone: about 10,000 A heart pacemaker: about 80,000 The Hubble Space Telescope: about 2,000,000

slide-12
SLIDE 12

Other examples

Lines of code in: A simple game on a mobile phone: about 10,000 A heart pacemaker: about 80,000 The Hubble Space Telescope: about 2,000,000 Curiosity Mars Rover: about 2,500,000 (or is it about 5,000,000? Does it matter?)

slide-13
SLIDE 13

Other examples

Lines of code in: A simple game on a mobile phone: about 10,000 A heart pacemaker: about 80,000 The Hubble Space Telescope: about 2,000,000 Curiosity Mars Rover: about 2,500,000 (or is it about 5,000,000? Does it matter?) A Boeing 787: about 14,000,000

slide-14
SLIDE 14

Other examples

Lines of code in: A simple game on a mobile phone: about 10,000 A heart pacemaker: about 80,000 The Hubble Space Telescope: about 2,000,000 Curiosity Mars Rover: about 2,500,000 (or is it about 5,000,000? Does it matter?) A Boeing 787: about 14,000,000 Average modern high-end car: about 100,000,000

slide-15
SLIDE 15

Other examples

Lines of code in: A simple game on a mobile phone: about 10,000 A heart pacemaker: about 80,000 The Hubble Space Telescope: about 2,000,000 Curiosity Mars Rover: about 2,500,000 (or is it about 5,000,000? Does it matter?) A Boeing 787: about 14,000,000 Average modern high-end car: about 100,000,000 All Google’s code, in 2015: about 2,000,000,000

slide-16
SLIDE 16

Other examples

Lines of code in: A simple game on a mobile phone: about 10,000 A heart pacemaker: about 80,000 The Hubble Space Telescope: about 2,000,000 Curiosity Mars Rover: about 2,500,000 (or is it about 5,000,000? Does it matter?) A Boeing 787: about 14,000,000 Average modern high-end car: about 100,000,000 All Google’s code, in 2015: about 2,000,000,000

slide-17
SLIDE 17

Other examples

Lines of code in: A simple game on a mobile phone: about 10,000 A heart pacemaker: about 80,000 The Hubble Space Telescope: about 2,000,000 Curiosity Mars Rover: about 2,500,000 (or is it about 5,000,000? Does it matter?) A Boeing 787: about 14,000,000 Average modern high-end car: about 100,000,000 All Google’s code, in 2015: about 2,000,000,000

Sources: http://www.visualcapitalist.com/millions-lines-of-code/ http://www.itworld.com/article/2985099/application-management/ thats-one-big-repository-heres-how-many-lines-of-code-google-has.html

slide-18
SLIDE 18

Problem

Software is too big and too complicated!

How do people cope?

slide-19
SLIDE 19

Abstraction

slide-20
SLIDE 20

Abstraction

Minecraft world built by Robin Bradfield

slide-21
SLIDE 21

Abstraction

slide-22
SLIDE 22

Abstraction

is when you get rid of details that aren’t important right now to focus on the things that are.

slide-23
SLIDE 23

Abstraction in maths

+ =

slide-24
SLIDE 24

Abstraction in maths

+ = 1 shoe + 1 shoe = 2 shoes

slide-25
SLIDE 25

Abstraction in maths

+ = 1 shoe + 1 shoe = 2 shoes 1 + 1 = 2

slide-26
SLIDE 26

Abstraction in software engineering

From punched cards:

slide-27
SLIDE 27

to “high level code” like we saw before

void SAL_CALL BaseContainerControl::dispose() throw( RuntimeException, std::exception ) { // Tell everything that this container is now gone. // It’s faster if you listen to both the control and the container. // Ready for multithreading MutexGuard aGuard( m_aMutex ); // remove listeners EventObject aObject; aObject.Source.set( static_cast<XControlContainer*>(this), UNO_QUERY ); m_aListeners.disposeAndClear( aObject ); // remove controls Sequence< Reference< XControl > > seqCtrls = getControls(); Reference< XControl > * pCtrls = seqCtrls.getArray(); sal_uInt32 nCtrls = seqCtrls.getLength(); size_t nMaxCount = maControlInfoList.size(); size_t nCount = 0; for ( nCount = 0; nCount < nMaxCount; ++nCount ) { delete maControlInfoList[ nCount ]; } maControlInfoList.clear(); for ( nCount = 0; nCount < nCtrls; ++nCount ) { pCtrls [ nCount ] -> removeEventListener ( static_cast< XEventListener* >( static_cast< XWindowListener* >( this ) ) );

slide-28
SLIDE 28

to models, e.g. like this

By Kishorekumar 62 - Own work, CC BY-SA 3.0, https://commons.wikimedia.org/w/index.php?curid=5766927 https://en.wikipedia.org/wiki/Unified_Modeling_Language

slide-29
SLIDE 29

Model-driven development

slide-30
SLIDE 30

Consistency

In the end two models have to be consistent, if they are both to be abstractions of the same software system. What consistent means is very variable... Now you’ll do an exercise in pairs about consistency.

slide-31
SLIDE 31

Discussion

What can vary? How is it decided?

slide-32
SLIDE 32

Discussion

What can vary? How is it decided? If you have a definition of consistency, and one model, can you tell what the other model must be?

slide-33
SLIDE 33

UML class diagram

Robot Head smile() speak() MovementPlanner acquireObject() Leg jump() getHeightRequired() Arm wave()

slide-34
SLIDE 34

UML sequence diagram

:Robot :MovementPlanner :Leg

acquireObject() jump() getHeightRequired()

slide-35
SLIDE 35

What if two models are not consistent?

This time your task is to make the models consistent, according to the definition on the sheet, by changing the second model if necessary. Discuss: Is there a choice, or just one way to do it? If there’s a choice, which way to restore consistency is best? Why? How can we decide? (Stretch) Can you explain how to restore this notion of consistency for any pair of models?

slide-36
SLIDE 36

Writing bidirectional transformations

Deciding what kind of consistency we need how we can restore consistency automatically is what the writer of a bidirectional transformation (bx) has to do. We don’t yet have good languages in which to write bx – that’s

  • ngoing research.
slide-37
SLIDE 37

More ongoing research

What properties should bidirectional transformations have? correctness: they actually should restore consistency!

slide-38
SLIDE 38

More ongoing research

What properties should bidirectional transformations have? correctness: they actually should restore consistency! hippocraticness: if the models are already consistent, restoring consistency does nothing

slide-39
SLIDE 39

More ongoing research

What properties should bidirectional transformations have? correctness: they actually should restore consistency! hippocraticness: if the models are already consistent, restoring consistency does nothing least change: ???

slide-40
SLIDE 40

About software engineering as a job

Today, programming is a big part of software engineering... ... but other parts are just as important, e.g., requirements engineering. Will change a lot in your working lives! Work hard at your maths :-)

slide-41
SLIDE 41

Questions? Comments?