CS330 Design Patterns - Midterm 1 - Fall 2015

Similar documents
NQ Mobile Security Frequently Asked Questions (FAQs) for Android

ios Design Patterns Jackie Myrose CSCI 5448 Fall 2012

Object Oriented Design

269 Business Intelligence Technologies Data Mining Winter (See pages 8-9 for information about 469)

GENERAL TRAINING ACCOUNTS

The Cambridge English Scale explained A guide to converting practice test scores to Cambridge English Scale scores

Managing Variability in Software Architectures 1 Felix Bachmann*

FREQUENTLY ASKED QUESTIONS

Java Application Developer Certificate Program Competencies

APP DEV. We build your ideas into web and mobile applications. steicho. Technological Solutions

Revolutionizing Site Monitoring and Maintenance

Aim To help students prepare for the Academic Reading component of the IELTS exam.

User Guide FOR TOSHIBA STORAGE PLACE

Programming Methods & Java Examples

Integrating the Internet into Your Measurement System. DataSocket Technical Overview

BES10 Cloud architecture and data flows

The learning system used in ECE 1270 has been designed on the basis of the principles of

Mobile App User's Guide

Cambridge English: Preliminary (PET) Frequently Asked Questions (FAQs)

Neat Cloud Service + Mobile App

Automatic software measurement data collection for students

Learner Guide. Cambridge IGCSE Economics

CMSC 132: Object-Oriented Programming II. Design Patterns I. Department of Computer Science University of Maryland, College Park

Frequently Asked Questions: Cisco Jabber 9.x for Android

CATAPULT YOUR SALES AND MARKETING EFFORTS TO NEW HEIGHTS

TOTAL DEFENSE MOBILE SECURITY USER S GUIDE

Architecture and Data Flow Overview. BlackBerry Enterprise Service Version: Quick Reference

Rogers Smart Home Monitoring QUICK START GUIDE ROG_6093_QST_GDE_EN.indd 1 9/22/12 8:29 AM

Place Value (What is is the Value of of the the Place?)

Strategies for Winning at Math. Student Success Workshop

Parallels Plesk Automation

NFC technology user guide. Contactless payment by mobile

KS3 Computing Group 1 Programme of Study hours per week

The Sun Certified Associate for the Java Platform, Standard Edition, Exam Version 1.0

Assuming the Role of Systems Analyst & Analysis Alternatives

Umbrello UML Modeller Handbook

LAB 6: Code Generation with Visual Paradigm for UML and JDBC Integration

Troubleshooting BlackBerry Enterprise Service 10 version Instructor Manual

CEG 4190: Computer Network Design, winter 2013

A Consumer s Awareness Guide To Choosing The Right Home Security System

Location awareness. Home area

CLOUD BASED HOME SECURITY 1 Anjali Chachra 1

Input / Output and I/O Strategies

Nicholas Mezei CSCI 6448 OOA&D Homework #3: Use Cases. Use Case Diagram: Home Security System. Alarm System

Personalised icalendar Teaching Timetable Feed for Staff and Students

7 Reasons Why Your Business Should Adopt ACT365

CS 4240: Principles of Software Design. Course Introduction. Tom Horton

Actualtests.C questions

Actual Size Rev. A.0.

Job Automation. Why is job automation important?

Mobile App User's Guide

Sophos Mobile Control User guide for Android

Fusion Voic Plus User Guide For Android Devices

CAS CLOUD WEB USER GUIDE. UAB College of Arts and Science Cloud Storage Service

MAKING FRIENDS WITH MATH

Samsung SDS. Enterprise Mobility Management

Software and Settings Instructions

Before the Department of Commerce Washington, D.C

Measurement Data Management with Mobile Devices

Creating Meaningful Business Moments. Shamik Sinha 1/28/2016

Installing Magento Extensions

Why you need. McAfee. Multi Acess PARTNER SERVICES

Security Benefits of Cloud Computing

Password Depot for Android

The Internet of Everything: Ecosystems and the Disconnected User

EE 209 Lab 1 Sound the Alarm

BlackBerry Enterprise Service 10. Secure Work Space for ios and Android Version: Security Note

BUSINESS STRATEGY SYLLABUS

BYOD Policy Implementation Guide. February 2016 March 2016

Whitepaper. Securing Data in Google Drive The Enterprise Guide to keeping corporate data safe in Google Drive. Introduction.

Mobile Iron User Guide

Managing Your Class. Managing Users

What s New Guide Time To Know Create

REASONS TO CHOOSE A SMART ALARM

The Project Management for Google Apps.

IONU BETA USER MANUAL IONU Security, Inc.

Student Quick Start Guide

Mobile Enabling Security Products for a Leading Security Firm. Case study

Monitoring and security of vehicles

BlackBerry Enterprise Server for Microsoft Exchange Version: 5.0 Service Pack: 2. Feature and Technical Overview

Mobile Online Banking

Microsoft Exchange ActiveSync Administrator s Guide

SPC Connect Configuration Manual V1.0

Seagate Access for Personal Cloud User Manual

EXTENDED FILE SYSTEM FOR F-SERIES PLC

Web Application Architectures

What is Bitdefender BOX?

Building a BYOD Program Using the Casper Suite. Technical Paper Casper Suite v9.4 or Later 17 September 2014

MOBILE APPLICATION DEVELOPMENT.

One platform for all your print, scan and device management

This is our best... YOUR best... Online Banking yet!

IP Office Anywhere Demo Installation

CRM SOFTWARE EVALUATION TEMPLATE

Keep your English up to date 4. Teacher s pack Lesson plan and student worksheets with answers. Facebook

Norton Mobile Privacy Notice

10 Things You Must Know Before Redesigning Your Website

Quick Start Guide For Vera Small Business Solution

CTERA Agent for Mac OS-X

System Requirements for Microsoft Dynamics NAV 2016

WEB, HYBRID, NATIVE EXPLAINED CRAIG ISAKSON. June 2013 MOBILE ENGINEERING LEAD / SOFTWARE ENGINEER

Transcription:

Name: Please read all instructions carefully. The exam is closed book & no laptops / phones / computers shall be present nor be used. Please write your answers in the space provided. You may use the backs of the exam pages as scratch paper. Please do not use any additional scratch paper. Solutions will be graded on correctness and clarity. You can score a total of 100 points on this exam. When asked to provide a class diagram use the following semantics. 1. (5 points) Name (at least) two properties of software designs that design patterns seek to improve through their application. [2.5 points per good answer] Software design can easily result in spaghetti code. Patterns tell you how to structure classes and objects so your software design becomes easier to: 1) understandability. Software designs are a common understanding of the intended system. If it is easier to understand this design less mistakes are made. 2) maintainability. Design patterns may increase the maintainability of your code for example when you encapsulate changes such as in the strategy pattern. 3) flexibility. Application of design patterns may allow for easily extending your software design with new functionality. Answer on page 5 to 23 2. (5 points) What is one of the most important benefits that design patterns provide to communities of developers? Design patterns give you a shared vocabulary with other developers. Once you ve mastered the vocabulary you can more easily communicate with other developers and inspire those who don t know patterns to start learning them. Patterns let you communicate solutions very efficiently using their name. Patterns further let you think more abstractly about problems without getting lost into details Answer on page 28.

2. (10 points) Provide a class diagram for the Command pattern. Make sure to list the methods for each class/interface and give a short description of the responsibility of each class/interface 6 points for the correct diagram and 4 points for the descriptions. Answer on page 207 3. (5 points) To implement a singleton, how does double-checked locking improve performance? Using synchronized in getinstance() is detrimental to performance because it is always called. Double checking improves it as follows: we first check if an instance is created and if not, then we synchronize. This way we only have to synchronize once when the instance is created and not when you call getinstance(). Answer on Page 182.

4. (5 points) A simple factory is often implemented as a static method. Name one benefit of this approach. If the simple factory is implemented as a static method you don t have to instantiate the simple factory to make use of the create method. Answer on Page 115 5. (5 points) Name one benefit of using the Decorator pattern and one disadvantage. Advantage (2.5 points) : new behavior can be added at runtime without modifying existing code. Disadvantage (2.5) Decorators can result in many small objects in our design and overuse can be complex. Answer on Page 105 8. (5 points) Give an example of a set of classes that are tightly coupled and a set that is loosely coupled. High coupling as every class talks to every Loose coupling as all classes communicate other class and knows every class s interface through asingle interface and they Answer on page 53 know little about eachother

Design Problems. A number of design problems are listed below. For each design problem answer the three following questions: 1. Which? Select the most appropriate design pattern to use and you must provide the pattern s intent. 2. Why? Clearly motivate how this pattern addresses the problem 3. How? Explain how this pattern should be implemented and show an appropriate class diagram to illustrate the implementation of your pattern. (no code). Don t give a generic class diagram for the pattern but for that specific design problem. Follow the UML conventions for class diagrams. 1. (20 points). Point is a novel home security device that has various sensors. Point listens to the sounds of your home, senses what's in the air and lets you know if anything is wrong. It notifies you of windows breaking, alarms ringing, a door left open, or the presence of smoke. A Point device can be installed anywhere in your home and connects to your wireless network. You can download an app and connect to the Point device upon which you will receive messages when Point detects when anything is wrong. You want various apps for various platforms (ios, Android) to be able to get notifications. At some point other home automation devices (e.g. garage door opener, firealarm) may want to received messages as well. In case Point generates too many messages, some users may not want to receive them anymore. 1. (5 points) Which: Observer - defines a one to many dependency between objects so that when one object changes state, all of its dependents are notified and updated automatically. 2. (5 points) Why: The point device needs to have multiple apps listen to it and this pattern enables objects communicating with each other to maintain consistency and to achieve loose coupling. Objects can easily subscribe to other objects they are interested in without having to know the details of each observable. 3. (10 points) How: See class diagram.

2. (20 points). A professor is trying to open up emailed homework assignments that students have compressed in various formats (zip, tar, jar, arj, sit, rar) in OSX. Unfortunately OSX has only built in support for zip and the professor has to revert to installing various tools to uncompress each file using a command line tool, which is cumbersome. Design a universal compression tool that can deal with various compression formats. 1. (5 points) Which: Strategy - defines a family of algorithms, encapsulates each one and makes them interchangeable. 2. (5 points) Why: we need to support different types of behavior (e.g., decompression algorithms). New types of decompression algorithms may need to be added and we would like to call a single decompress method. The strategy pattern provides a unified interface (decompress) for various types of compression formats. 3. (10 points) How: See class diagram.

personal professional premium 3. (20 points). The company GreenHOST is a is a web hosting company that offers three different server plans (personal, professional, premium). To each plan, various hosting services can be added (Cloudhosting, SSL, 24x7 support, backup, Google Adwords, CloudFlare, mysql). You need to write an application that can easily compute the total monthly service fees for each plan and any combination of services. Your application must be able to easily support adding new types of hosting services when they become available. You must avoid an explosion of classes. Sample output could be: > Personal Hosting, SSL, Google Adwords, MySQL: 59.94 a month. 1. (5 points) Which: Decorator - attaches additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality 2. (5 points) Why: If we were to implement each combination of server plan+ hosting service as its own class using inheritance it would lead to an explosion of classes. The decorator pattern only requires adding one new class to add a new service. 3. (10 points) How: See class diagram.