CS代考 Software Engineering

Software Engineering
Dr Kingsley Sage

Design patterns

Copyright By PowCoder代写 加微信 powcoder

Doing and building things in a manner that others can understand

Design pattern
• Not code, flowcharts or algorithms
• Simply a way of doing something
• Typically the refined wisdom of many attempts to solve similar problems in the past
• Provides:
– Common way of thinking about the problem – Common vocabulary to describe the problem
– Benefit of previous attempts to solve problems

Architectural design pattern
• A way of organising a solution at an architectural level so that it makes sense
• This has become increasingly important as software systems get ever bigger
• Some well known examples: – Client server architecture
– N-tier architectures
– Model View Controller

Client server architecture
• Starts with one of the most important ideas in modern computing …
– A client: someone / an agent that wants some data or a service
– A server: someone / an agent that can provide that data or service

Client server architecture
Request Response
• A process governed by a protocol (e.g. HTTP/FTP/common etiquette)
• Don’t actually know/care how the server does what it does

Just like real life really …
“Duck soup please” “Your soup Sir”
• What is significant about this interaction?
• Where does the duck soup come from?

“Duck soup please”
“Your soup Sir”
One possibility
“One soup” “Service!”
• Can keep extending the chain of client server relationships
• NOT a peer to peer network (why?)

Why is this so important?
• For software systems, this is a key to building a large, distributed system
• Each component has a functionality
• It can be defined by what it can request and what services it can provide
• Essentially an Application Programming Interface (API)
• But what goes on inside the component, stays inside the component
• Sound familiar?

Why is this so important?
• But this idea has a much deeper impact that just the design of OO languages
• For example, consider how a car insurance comparison website works …

WEB SERVER
Quote Details
Details Quotes

Building complex systems
• So to build a complex software system, we can assemble it from a collection of components
• Each component has a well-defined role
• Components communicate in a fairly narrowly defined manner according to a protocol (could be HTTP, XML, whatever)
• Each component could be ANY technology if communication is platform independent

Building web systems
• Designers of dynamic web sites adopt this concept a great deal
• Typically you have:
– Web designers who know about how stuff looks
– Business logic specialists who know how the business runs
– A need to manage data
• Giving us the basic elements of the classic 3 tier architecture

Generic Three Tier Architecture
USER INTERFACE MANAGEMENT
PROCESS MANAGEMENT
DATABASE MANAGEMENT
Information in SQL format
Strengths:
Presenting Information to client, collecting information from client
Providing dynamic content via some kind of conditional scripting, able to balance load / networking issues
Persistent data stored / backed up, optimised for data access, supports ACID transactions (Atomic; Isolated; Consistenty;Durable)
Information in html format

Three Tier Architecture
USER INTERFACE MANAGEMENT
PROCESS MANAGEMENT
DATABASE MANAGEMENT
Web pages (html) displayed to user, taking in information to dynamically display appropriate web pages
Apache server running PHP, provding web pages and also connecting to database to provide content as requested by user and update database as required as orders are made. Running on Linux Operating System.*
MySQL database, containing data stored in tables, and stored procedures to maintain database state
*Though Windows Server x could be used, this LAMP (Linux / Apache / MySQL / Php) configuration is very well supported by the OpenSource community and is therefore recommended..

CLIENT SIDE
SERVER SIDE
Web server (Apache)
PHP interpreter
MySQL server (mysqld)
Request for HTML or PHP file
HTTP request
HTML file can be displayed

Beyond three tiers
• The 3 tier model is just a specific case of the more general n-tier architecture
• We can have as many tiers as we need
• Remember the basic idea is simply to partition the software system into a set of components that communicate with each other
• Don’t care about the technology
• Advantages
– Allows update strategy
– Incremental development
• Disadvantages
– Single server points of failure?

Model View Controller
• Widely adopted architectural design pattern when there a software system has a non trivial user interface element
• Particularly in computer gaming and mobile development
• Seeks to partition the software system into:
– Model: the underlying application or business logic
– View: the part that renders the visual appearance of a model
– Controllers: the part that accepts user input and translates into actions for the model

Model View Controller

Model View Controller
• So, why so important for game development?
– Model: character models, world model, locations, health points, physics engines. I.e. everything to do with how the game “works”, but nothing about how it is to appear
– View: steerable cameras, mobile or tablet? frame rate?
– Controller: touch? Joystick? Gesture?
• Which parts do we need to redevelop if we decide to port to a new platform?
• Can also customise view and controllers on the fly without affecting the core game model
• Each component has a clear and dedicated purpose

Model View Controller
• In mobile development and web development, we aspire to make a clear separation between how something appears and how it works
• Appearance is likely subject to frequent shift in design, model is likely to evolve much more slowly
• Many flavours in practical implementations of MVC pattern
– Swing in Java
– iOS development
– Android development

• We see that these architectural design patterns help us to build and rationalise large software systems
• There are many more including such things as “blackboard systems”, “service orientated” systems
• We have thought a little more about – Client server
– N-tier architecture
– Model View Controller
• But they do have an issue with single server points of failure
• Think about that in a future session

程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com