10!Software Engineering Techniques! for Multimedia Software

Similar documents
4 Overview on Approaches to Multimedia Programming

6! Programming with Images

3 Development process for multimedia projects

3 Multimedia Programming with C++ and Multimedia Frameworks

Outline. 1.! Development Platforms for Multimedia Programming!

Outline. 1.! Development Platforms for Multimedia Programming!

2! Multimedia Programming with! Python and SDL

Outline. 1.! Development Platforms for Multimedia Programming!

Clarifying a vision on certification of MDA tools

5 History of Multimedia Programming

Flash Tutorial Part I

6 Images, Vector Graphics, and Scenes

Java Application Developer Certificate Program Competencies

Fundamentals of Java Programming

JOURNAL OF OBJECT TECHNOLOGY

Comparison of Model-Driven Architecture and Software Factories in the Context of Model-Driven Development

Foundations of Model-Driven Software Engineering

1.. This UI allows the performance of the business process, for instance, on an ecommerce system buy a book.

Chapter 12 Programming Concepts and Languages

Hands-On: Introduction to Object-Oriented Programming in LabVIEW

Component Based Rapid OPC Application Development Platform

... Introduction... 17

MODEL DRIVEN DEVELOPMENT OF BUSINESS PROCESS MONITORING AND CONTROL SYSTEMS

Moving from CS 61A Scheme to CS 61B Java

How To Test Automatically

Mobile App Design and Development

Component visualization methods for large legacy software in C/C++

Introducing Apache Pivot. Greg Brown, Todd Volkert 6/10/2010

Realizing Enterprise Integration Patterns in WebSphere

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

From Systems to Services

The Deployment Production Line

XFlash A Web Application Design Framework with Model-Driven Methodology

Creating a 2D Game Engine for Android OS. Introduction

Rules and Business Rules

25.1 Translational Frameworks (MDA with transformations)

AP Computer Science A - Syllabus Overview of AP Computer Science A Computer Facilities

JavaFX Session Agenda

CS 4620 Practicum Programming Assignment 6 Animation

Patterns in. Lecture 2 GoF Design Patterns Creational. Sharif University of Technology. Department of Computer Engineering

Java (12 Weeks) Introduction to Java Programming Language

Orange Unified School District Video Game Design II Year Course

J a v a Quiz (Unit 3, Test 0 Practice)

Voice Driven Animation System

Robot Control MRobot

An Instructional Aid System for Driving Schools Based on Visual Simulation

Lumousoft Visual Programming Language and its IDE

Teaching Non-majors Computer Programming Using Games as Context and Flash ActionScript 3.0 as the Development Tools

Business-Driven Software Engineering Lecture 3 Foundations of Processes

Assignment # 2: Design Patterns and GUIs

The BSN Hardware and Software Platform: Enabling Easy Development of Body Sensor Network Applications

Abstractions from Multimedia Hardware. Libraries. Abstraction Levels

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz

An evaluation of JavaFX as 2D game creation tool

IV. Student Performance Objectives: Upon successful completion of this course, the student will have met the following objectives:

Formal Engineering for Industrial Software Development

View Controller Programming Guide for ios

Topics in basic DBMS course

Mobile App Design Project #1 Java Boot Camp: Design Model for Chutes and Ladders Board Game

Distributed Database for Environmental Data Integration

WebObjects Web Applications Programming Guide. (Legacy)

Modeling Guidelines Manual

Adobe Creative Suite: Introduction for Web Design

Software documentation systems

How To Test On A Model Driven Test On An Embedded System

Software Development Methodologies

A generic framework for game development

How To Use Titanium Studio

Source Code Translation

TDDC88 Lab 2 Unified Modeling Language (UML)

An Interactive Approach to elearning Design for Adults. 1 An Interactive Approach to elearning Design for Adults

Mobile Application Development Android

Wilson Area School District Planned Course Guide

Software Development Kit

Embedded Software Development with MPS

MDA Transformations Applied to Web Application Development 1

Web Development in Java

BIS 3106: Business Process Management. Lecture Two: Modelling the Control-flow Perspective

Jairson Vitorino. PhD Thesis, CIn-UFPE February Supervisor: Prof. Jacques Robin. Ontologies Reasoning Components Agents Simulations

Enterprise Application Development Using UML, Java Technology and XML

Chapter 6: Programming Languages

Monitoring Infrastructure (MIS) Software Architecture Document. Version 1.1

WebSphere Business Monitor

University of Pisa. MSc in Computer Engineering. Business Processes Management. Lectures

Jing Yang Spring 2010

Outline. CIW Web Design Specialist. Course Content

Process Modeling using BPMN 2.0

CG: Computer Graphics

From Object Oriented Conceptual Modeling to Automated Programming in Java

MDA Overview OMG. Enterprise Architect UML 2 Case Tool by Sparx Systems by Sparx Systems

EVALUATION. WA1844 WebSphere Process Server 7.0 Programming Using WebSphere Integration COPY. Developer

Basic Trends of Modern Software Development

Computer Programming I & II*

Gillcup Documentation

Recovering Workflows from Multi Tiered E-commerce Systems

Software Engineering. System Modeling

Diploma Of Computing

Flash. Using Flash to Teach Mathematics. The competition

Algorithms, Flowcharts & Program Design. ComPro

Transcription:

10!Software Engineering Techniques! for Multimedia Software 10.1!Specific Design Patterns for Multimedia Software! 10.2!Classical Design Patterns Applied to Multimedia! 10.3!Modeling of Multimedia Applications LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 1

Design Patterns A design pattern is a generic solution for a class of recurring programming problems! Helpful idea for programming! No need to adopt literally when applied! Origin:! Famous book by Gamma/Helm/Johnson/Vlissides ( Gang of Four )!» List of standard design patterns for object-oriented programming!» Mainly oriented towards graphical user interface frameworks!» Examples: Observer, Composite, Abstract Factory! Frequently used in all areas of software design! Basic guidelines:! Patterns are not invented but recovered from existing code! Pattern description follows standard outline!» E.g.: Name, problem, solution, examples LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 2

Window Place: Architectural Pattern Christopher Alexander et al., A Pattern Language, 1977 (quoted in Buschmann et al. 1996)! Problem: In a room with a window and a sitting opportunity users have to decide whether to have a look or to sit.! Solution: At least one window of the room shall provide a sitting place.! Structure: Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice. Christopher Alexander et al., A Pattern Language LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 3

Description of a Design Pattern Name! Problem! Motivation! Application area! Solution! Structure (class diagram)! Participants (usually class, association und operation names):!» Role name, i.e. place holders for parts of implementation!» Fixed parts of implementaton! Collaboration (sequence of events, possibly diagrams)! Discussion! Pros and cons! Dependencies, restrictions! Special cases! Known uses LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 4

Patterns for Multimedia Software The following examples of patterns are not taken from literature, but derived from the material in this lecture! Based on various platforms, also older ones! Types of patterns:! Cross-platform patterns! Patterns specific for a certain platform LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 5

Classification Space Time usage:! Still picture! Linear progress! Interaction dependent progress Time usage Interactivity:! Fully automatic (passive)! Confirmations & questions (reactive)! Interactive controls (proactive)! Creation&dragging of objects (directive) Degree of interactivity Space usage Aleem, T. A. (1998). A Taxonomy of Multimedia Interactivity.(Doctoral Dissertation, The Union Institute, 1998). Space usage:! Static layout! Scenes! Scenes & objects! Fully dynamic LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 6

Cross-Platform Multimedia Pattern: Clockwork The current properties of presentation elements are derived from the current value of a clock ticking at regular time intervals! Time usage: Linear progress! Limited interactivity: Automatic or confirmations&questions! Usually combined with static layout or scenes and objects! Examples:! Timeline in Flash, Director, JavaFX!! Clock class in PyGame! EnterFrame-Events in Flash ActionScript!! CreateJS Ticker! Ticking scripts in Squeak! PActivity in Piccolo University of Maryland Piccolo framework (see cs.umd.edu/hcil/piccolo) PActivity flash = new PActivity(-1, 500, currenttime + 5000) { protected void activitystep(long elapsedtime) { LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 7

Cross-Platform Multimedia Pattern: Interpolation A parameter (usually regarding a graphical property) is assumed to change its value continuously dependent of another parameter (e.g. time). The dependency can follow a linear or other rules of computation.! Fixed values for the dependent parameter are given for certain values of the base parameter.! Intermediate values of the dependent parameter are computed by interpolation.! Space usage: scenes&objects mainly! Time usage: Linear progress only! Usually combined with low interactivity (on this level)! Examples:! Tweening in Flash! Animation methods in Piccolo! JavaFX transitions PActivity a1 = anode.animatetopositionscalerotation(0, 0, 0.5, 0, 5000); LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 8

Cross-Platform Multimedia Pattern: Scene Graph Graph structure for all represented objects! Space usage: Scenes&objects or fully dynamic! Time usage: Linear progress or interaction dependent! Examples:! Scene graph of JavaFX! Scene graph of Piccolo! Implicit: Film Explorer view in Flash SceneBeans LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 9

Cross-Platform Pattern: Time Container Algebra Presentation is built from atomic parts (processes) each of which is executed in a time container.! Time containers are composed by algebraic operations: sequential composition, parallel composition, repetition, mutual exclusion, synchronization options! Time usage: Linear progress! Space usage: Scenes or scenes&objects! Low interactivity! Examples:! SMIL body: seq, par, excl! Animations class of JGoodies animation framework for Java! Sequence of frames and parallelism of layers in Flash LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 10

Various Syntactical Representations! for a Single Concept <layout> <region id= r1...> </layout> <body> XML <seq>...frame1...frame2 </seq> </body> Component r1 =...; Animation frame1 =...; Animation frame2 =...; Animation all = Animations.sequential( new Animation[]{ frame1, frame2); Java frame1 frame2 Authoring! Tool (Flash-like) r1 LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 11

10!Software Engineering Techniques! for Multimedia Software 10.1!Specific Design Patterns for Multimedia Software! 10.2!Classical Design Patterns Applied to Multimedia! 10.3!Modeling of Multimedia Applications Literature:!! Gamma/Helm/Johnson/Vlissides: Design Patterns, Addison-Wesley 1994! (= Gang of Four, GoF )!!! LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 12

GoF Structural Pattern: Composite Situation:! Complex tree-structured objects! Motivation:! Use homogeneous interface for objects and compositions thereof Exercise (JavaFX):! Compare with classes! Node! Parent! Group! Rectangle! MediaView LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 13

GoF Behavioral Pattern: Mediator Situation:! Many objects interact in a complex way! Individual objects are not able to co-ordinate their communication! Motivation:! Create single point of co-ordination LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 14

Mediator Example: Sprite Manager public class SpriteManager { private List<Sprite> sprite_list; public SpriteManager(double scw, double sch) { sprite_list = new ArrayList<Sprite>(); public void addsprite(sprite s) { sprite_list.add(s); public void updatesprites() { for (Sprite s: sprite_list) { s.update(); for (Sprite s1: sprite_list) { for (Sprite s2: sprite_list) { if (s1!= s2) { s1.handlecollision(s2); JavaFXBallMotion Project LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 15

Creation Pattern Example: Builder Situation:! Many parameters of a constructor have to be set! Leading to an explosion of constructor variants (telescoping constructor anti-pattern)! Motivation:! Make code simpler! Separate between concrete (low-level) representation and creation process! Move default settings to appropriate location! Avoid typical copy-paste errors! Idea:! Provide static class which first collects information on object to be built and finally constructs it LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 16

GoF Creation Pattern: Builder Name: Builder (dt.: Erbauer)! Problem:! Step-by-step creation of complex objects! Solution: Director construct(builder: Builder) Builder buildpartx() getproduct(): Product Product <<constructs>> ConcreteBuilder buildpartx() getproduct(): Product LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 17

Example: Series of Similar Buttons Do not repeat all detailed settings (e.g. styles) for all buttons! Avoid copy-paste problems! Define standard combinations for settings to be applied easily in construction process! Remove low-level information (like styles) from high-level program logic LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 18

Button Series without Builder Button btn1 = new Button(); btn1("-fx-background-color: lightgrey; -fx-padding: 9; -fx-font: 20pt sans-serif';"); btn1((actionevent event) -> { System.out.println("Btn1 clicked"); ); Button btn2 = new Button(); btn2("-fx-background-color: lightgrey; -fx-padding: 9; -fx-font: 20pt sans-serif'; -fx-border-color: black;-fx-border-width: 2px;"); btn2.setonaction((actionevent event) -> { System.out.println("Btn2 clicked"); ); Button btn3 = new Button(); btn3.setstyle("-fx-background-color: lightgrey; -fx-padding: 9; -fx-font: 20pt sans-serif';"); btn3.setonaction((actionevent event) -> { System.out.println("Btn3 clicked"); ); LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 19

Please Note: Lambda Expressions in Java 8 btn1((actionevent event) -> { System.out.println("Btn1 clicked"); ); LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 20

Example: Builder (1) public class MyButton extends Button { private MyButton (Builder builder) { super(builder.label); if (builder.hilited) { this.setstyle("-fx-background-color: lightgrey; -fx-padding: 9; -fx-font: 20pt 'sans-serif'; -fx-border-color: black;-fx-border-width: 2px;"); else { this.setstyle("-fx-background-color: lightgrey; -fx-padding: 9; -fx-font: 20pt 'sans-serif';"); this.setonaction((actionevent event) -> { System.out.println(this.getText()+" clicked"); ); builder.reset(); LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 21

Example: Builder (2)! public static class Builder { private String label; private Boolean hilited; public Builder() { reset(); Additional pattern: Method chaining! Builder method returns builder object! private void reset() { label = ""; hilited = false; public Builder label(string label) { this.label = label; return this; public Builder hilited() { this.hilited = true; return this; LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 22

Example: Builder (3)! public MyButton build() { return new MyButton(this); class MyButton {! private MyButton(Builder builder) { Inner Class! public static class Builder { // collection of properties // construction methods LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 23

Example: Builder (4) MyButton.Builder builder = new MyButton.Builder(); Button btn1 = builder.label("btn 1").build(); Button btn2 = builder.label("btn 2").hilited().build(); Button btn3 = builder.label("btn 3").build(); QUIZ:! What are advantages and disadvantages of using this pattern? LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 24

Builder in JavaFX Richard Bair richard.bair at oracle.com! Mon Mar 25 10:35:51 PDT 2013 We made a mistake. When we released JavaFX 2.0 we included a (large) set of *Builder classes to provide a builder-pattern approach to building JavaFX UIs. The builder-pattern approach provides several very nice features:!! - Ability to setup generic configuration once and "stamp out" multiple copies!! - Structured code style that closely approximates the "container hierarchy" of the UI!! - Strongly-typed "declarative" style programming!! The Builders did come at a cost. [ ]!! My proposal after having weighed the options is to phase out the Builders by deprecating them in 8 and removing them from the class path in 9. LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 25

GoF Structural Pattern: State Name: State! Problem:! Flexible and extensible technique to change the behavior of an object when its state changes.! Solution : Context request()! setstate (s: State) state State {abstract handle() {abstract calls! state.handle State1 handle() State2 handle()... LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 26

Example for State (1) State!! startplay()! stopplay() VideoPlayer StopState!! startplay()! stopplay() PlayState!! startplay()! stopplay() LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 27

Example for State (2) abstract class State { abstract void startplay(); abstract void stopplay(); class! PlayState extends State { @Override void startplay() { System.out.println( "Already playing...");! @Override void stopplay() { context.setstate( context.getstopstate());! class! StopState extends State { @Override void startplay() { context.setstate( context.getplaystate()); @Override void stopplay() { System.out.println( "Already stopped..."); LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 28

Administrative Overhead for State interface Context { abstract public void setstate (State s); abstract public State getstopstate(); abstract public State getplaystate(); public class JavaFXStatePattern extends Application implements Context { private State state; final private State stopstate = new StopState(); final private State playstate = new PlayState(); @Override public void setstate (State s) { state = s; @Override public State getstopstate() { return stopstate; LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 29

Test for Extensibility Adding a pause state! First step: Change the State interface! abstract void pauseplay(); > Compiler checks completeness of transitions! All additional code is concentrated in one class = one file LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 30

10!Software Engineering Techniques! for Multimedia Software 10.1!Specific Design Patterns for Multimedia Software! 10.2!Classical Design Patterns Applied to Multimedia! 10.3!Modeling of Multimedia Applications!!!! Literature:!! A. Pleuß: MML - A Language for Modeling Interactive Multimedia Applications. Seventh IEEE International Symposium on Multimedia (ISM 2005), pp. 465-473, IEEE Society Press, 2005 LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 31

Model-Driven Architecture Model-Driven Architecture (MDA): A concrete framework defined by the Object Management Group (OMG) for model-driven development! CIM: Computation independent model! PIM: Platform independent model! PSM: Platform specific model Transfor-! mation 0 Transfor-! mation 1.1 PSM 1 Transfor-! mation 1.2 Code! (Platform 1) CIM PIM Transfor-! mation n.1 PSM n Transfor-! mation n.2 Code! (Platform n) LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 32

Example Application: Break Out Game Bricks Wall Ball Paddle Off Field LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 33

Diagrams in MML Software Design Media Design User Interface Design Application Entities Structure Diagram Media Components Scene Diagram Abstract User Interface! Diagram (Conventional) UI Media UI Interaction Diagram LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 34

Example: Application structure for Break Out Game Application Media Representation Media Component Inner Structure LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 35

Example: Scenes for Break Out Game Application EntryOperation of Scene Game Scene Transition LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 36

Example: Abstract User Interface for Scene Game UI Container Edit Component Output Component Action Component Assigned Class/ Property/ Operation Multiplicity LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 37

Example: Media User Interface for Scene Game AUIs without specific realization UI Realization Sensor LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 38

Example: Interaction diagram for Scene Game Object (property of the scene) CallOperation Action UIInputEvent Sensor Event LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 39

Pros and Cons of Model-Driven Development for Multimedia Applications Advantages:! Code generation achieves independence form multimedia platform! Higher level of abstraction leads to deeper analysis! Code generators can help to create well-structured code (e.g. modular Flash applications)! Disadvantages:! Full code generation problematic, platform-specific additions needed! Round-trip engineering still needs to be developed! Writing abstract specifications is not attractive for multimedia developers! Open issue:! What is the right language level for integrating the various design views/ activities? LMU München, Sommer 2014 Prof. Hußmann: Multimedia-Programmierung! Kapitel 10, Folie 40