1
UTAS KIT 506 software design and development
Tutor: Mia + NAME : Mia
Class: 22/10/2020
Student:
Final Exam
Page 0 of 26
Exam time
27/10 1pm
3 hrs
Total 10 questions
180 marks
Exam Content
Page 1 of 26
1. Write a structured scenario
Task: Given part of an RTM for some software, write the action–software reaction table
of a structured scenario for that use case
Scenario: UC20 Print Swatch
Action Software Reaction
1. user press ‘choose’ button 1. The system will display an empty colour
wheel view interface
2. The system will read the relevant color data
from the database
3. The system will display the read data in the
list in the colour wheel view
2. user select a colour from the
colourWheelView
System confirm this information
Check printer has paper or not
If printer has paper, produce colour swatch
If printer does not have paper, system pop up
an error message
3.
Page 2 of 26
2.
Action Software Reaction
1. Authenticated user login in 1.system update messages posted by friends
2. system update options: delete, mark them as
read, leave them as unread, or post their own
message.
2. user select one friend’s message, press the
button of ‘delete’
1.system confirm the information and display
a warning message that deletion cannot be
undone
2. system creates option “Confirm” or
“Cancel”
3.User press confirm 1. System will retrieve a list of friends’
messages
2. System pop a message “the user has not
selected any message”
3. system wait for 5 seconds, message
disappear
4. system update mainView
4. User select a message 1.System delete message from the view
2. system update mainView
2. Draw a class diagram
Task: Given information about a business and its operations, draw a UML class diagram that
describes it
o Include attributes, methods and data types
o The scenario will include real-world entities; treat their actions as methods
o Include relationships and multiplicities where relevant
依赖(Dependency)
依赖关系是五种关系中耦合最小的一种关系。依赖关系使用虚线加箭头表示
Page 3 of 26
关联(Association)
关联关系使用实线加箭头表示,类之间的关系比依赖要强。学生与老师是关联的,学生
可以不用电脑,但是学生不能没有老师
其他的关联关系:
多维关联
Page 4 of 26
3.聚合(Aggregation)
聚合关系使用实线加空心菱形表示。聚合用来表示集体与个体之间的关联关系。例如班
级与学生之间存在聚合关系
Page 5 of 26
3. 组合(复合,Composition)
复合关系使用实线加实心菱形表示。组合又叫复合,用来表示个体与组成部分之间的关
联关系。例如学生与心脏之间存在复合关系
4. 泛化(Generalization)
泛化指的是类与类之间的继承关系和类与接口之间的实现关系. 继承关系使用直线加
空心三角形表示.
依赖关系实际上是一种比较弱的关联,聚合是一种比较强的关联,组合是一种更强的关
联,泛化则是一种最强的关联,所以笼统的来区分的话,实际上这五种关系都是关联关
系
Page 6 of 26
2019 Question 2. (Assessing ILO: 1)
Glass Containers can be categorised as Jars, or Bottles, or Drinking Glasses. Jars are
cylindrical and have a Diameter and a Lid. Bottles are conical and have a Top Diameter,
Bottom Diameter, and a Lid. Drinking glasses have a Top Diameter and a Bottom
Diameter. All three can be in clear, brown, or green glass. Jars and Bottles can be opened
and closed. All three can be filled with a Liquid or emptied (producing a Liquid), but
filling and emptying a glass is different because no opening is required. A Box is able to
contain many Glass Containers and these can be counted.
Draw a UML class diagram that best describes the above information. Include attributes
and methods that are mentioned in these classes. (Treat actions, like filled or opened, etc
as methods.) Include multiplicities, enumerations, specialisation, and so one, where
relevant.
Jar shape: 1 2 3
Page 7 of 26
2018
2017 Q2
The Animal Kingdom consists of many kinds of animals including birds and fish. All animals
breathe, eat, and produce young. Both birds and fish lay eggs, but not all animals do.
Birds can be classified as ‘winged’ or ‘flightless’. Each has a height, a weight, and a common
name. Flightless birds can run, while winged birds can fly.
Fish have a length, a weight, and a common name. All fish can swim.
Zoological gardens (zoos) contain many birds and many fish. A zoo can calculate how many
fish it has and how many birds it has.
Draw a UML class diagram that best describes the above information. Include attributes and
methods that are mentioned in these classes. (Treat actions, like run or swim, etc as methods.)
Include multiplicities, enumerations, specialisation, and so on, where relevant.
Page 8 of 26
3. Draw a sequence diagram
Task: Given some C# code defining a number of classes, and the source code for the
Main() method of a console application, draw a UML sequence diagram showing the
interactions between them
Question 3. (Assessing ILO: 1)
Draw a UML sequence diagram to show what happens when the following classes are
executed.
class Program {
static voidMain(string[] args) {
A a = new A();
B b = new B{ Thing = a };
C c = new C();
b.Run2();
c.Show(a);
}
}
class A {
public void Run(C c) {
c.Show(this); }
}
class B {
public A Thing { get; set; }
public void Run() {
Run2(Thing);
}
public void Run2( A a) {
C c = new C();
Page 9 of 26
a.Run(c); }
}
public void Show(A a) { /* code to be written */ } }
4. Discuss software design patterns
Task: Describe & discuss software design patterns Answer will include text and may
include some UML to illustrate your ideas
Question 4. (Assessing ILO: 1)
a. What is the module-view-controller design pattern and what are the benefits of using
it?
The Model View Controller (MVC) design pattern specifies that an
application consist of a data model, presentation information, and control
information. The pattern requires that each of these be separated into different
objects.
Page 10 of 26
The Model contains only the pure application data, it contains no logic
describing how to present the data to a user.
The View presents the model’s data to the user. The view knows how to
access the model’s data, but it does not know what this data means or
what the user can do to manipulate it.
The Controller exists between the view and the model. It listens to
events triggered by the view (or another external source) and executes
the appropriate reaction to these events. In most cases, the reaction is to
call a method on the model. Since the view and the model are connected
through a notification mechanism, the result of this action is then
automatically reflected in the view.
Advantages of using this pattern
Multiple developers can work simultaneously on the model, controller and
views.
MVC enables logical grouping of related actions on a controller together.
The views for a specific model are also grouped together.
Models can have multiple views.
b. Why do we use design patterns and what advantages and is advantages does their use
provide?
Page 11 of 26
A software design pattern is a general reusable solution to a commonly occurring
problem. It is not a finished design that can be transformed directly
into source or machine code. It is a description or template for how to solve a problem
that can be used in many different situations.
Each pattern describes a problem that 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.
1. Provide examples of good design and implementation
2. Provide a shared vocabulary
3. Help understand library and framework structure
4. Promote low coupling, high cohesion, flexibility and extensibility
Advantages:
Enable large scale reuse of S/W.
They Helps in improve developer communication.
Capture expert knowledge and design trade-offs and make expertise widely available
a technique for making cod1e more flexible by making it meet
certain criteria
Disadvantages:
Do not lead to direct code reuse and Complex in nature.
They are validated by experience and discussion.
They consume more memory because of generalized format.
They are written, to store any kind of data, make performance degrade.
Lack of innovative; More consumption of RAM
c. Describe two design patterns (other than Model-View-Controller), draw them, and
explain what they are used for.
Observe
Page 12 of 26
This pattern is a one-to-many dependency between objects so that when one object
changes state, all its dependents are notified. This is typically done by calling one of
their methods.
举个栗子: 微信中的订阅号,关注好友,订阅号更新,就会推送给用户,观察
者模式定义了一种多对一的关系,让多个观察者同时监听一个主题对象
抽象主题角色(Subject):抽象主题把所有观察者对象的引用保存在一个列表中,并提
供增加和删除观察者对象的操作.
抽象观察者角色(Observer):为所有具体观察者定义一个接口,在得到主题通知时更
新自己,一般由抽象类或接口实现
具体主题角色(ConcreteSubject):实现抽象主题接口,具体主题角色又叫做具体被观察
者角色。
具体观察者角色(ConcreteObserver):实现抽象观察者角色所要求的接口,以便使自身
状态与主题的状态相协调
Adapter
This allows incompatible classes to work together by converting the interface of one class
into another. Think of it as a sort of translator: when two heads of states who don’t speak a
common language meet, usually an interpreter sits between the two and translates the
conversation, thus enabling communication.
If you have two applications, with one spitting out input as XML with the other requiring WPF
input, then you’ll need an adapter between the two to make them work seamlessly.
Page 13 of 26
5. Write C# to implement class diagram
Task: Given a UML class diagram, write C# code that implements it
Do not include using statements or namespace
Attributes can be public, auto-generated properties
All methods are stubs: header but empty body { }
Question 5
Consider the following class diagram. Write C# code to declare the classes and enumerations
contained within the diagram. Do not include using or namespace declarations in your
answer.
You may assume that all required namespaces are available. Each attribute must be a public,
auto-generated property. Any methods you write should be stubs, with an appropriate header
but no code within their body { }.
Page 14 of 26
Page 15 of 26
2018
6.Write queries using LINQ, SQL + C#
Task: Given a description of a C# class and a database table write:
• a LINQ expression to produce a given result
• SQL to query a database for required information
• a small amount of C# code to create an object from the query results
Question 6. (Assessing ILOs: 2 and 3)
Ethan
附注
public List
Page 16 of 26
In parts (a)–(c) below suppose there exists a class called Coin that represents the coins found
in a typical person’s pocket. Each coin has three public properties: Name (a string), Value in
cents (an int), and FaceUp (a boolean).
a. Assuming the following declaration of a collection of Coins List
List
that has been filled with Coin objects, write a LINQ expression that selects those Coins which
are worth $1 (i.e. 100 cents).
[6 marks]
b. Further suppose that there exists a MySQLdatabase with a table called Mint that has a
string-valued column title, a double-valued column value in dollars and cents, a
boolean-valued column faceUP, and a string-valued column entitled colour. Write a suitable
SQL query to retrieve the information necessary to create Coin objects from the information
in the Mint table.
[6 marks]
Select xxx,yyy, from tablename;
Select title, value, faceup from Mint;
c.Now, assuming that a MySqlDataReader called rdr has been created using the query you
defined in (b), and that it has been executed and its Read() method called to load the first
result. Write a single C# statement to instantiate a Coin object using the data retrieved and
assign it to a variable called c.
Page 17 of 26
7. Discuss .NET and XAML
Task: Demonstrate your understanding of the roles of .NET and XAML in creating
data-driven desktop applications by answering three short questions
a. In the .NET Framework, what is LINQ and what benefits does it provide to software
development? (Write three to five sentences in total.)
LINQ is a Microsoft .NET Framework component that adds native data querying capabilities
to .NET languages. It allows common collection processing tasks to be written in a consistent
form within the host language while being applicable to a variety different data sources:
arrays, Collection types, XML documents and databases. (同上 LINQ introduces an
easy-learning approach for querying and modifying data and can support querying various
types of data sources including relational data, XML and in-memory data structures.)
LINQ offers the following advantages:
1. LINQ offers a common syntax for querying any type of data sources
2. Secondly, it binds the gap between relational and object-oriented approaches
3. LINQ expedites development time by catching errors at compile time and includes
IntelliSense & Debugging support
https://en.wikipedia.org/wiki/Microsoft
https://en.wikipedia.org/wiki/.NET_Framework
https://en.wikipedia.org/wiki/Query_language
https://en.wikipedia.org/wiki/List_of_CLI_languages
Page 18 of 26
4. LINQ expressions are Strongly Type
b. Describe the purpose of and benefits from using DataTemplates in XAML. [6 marks]
A data template can contain elements that are each bound to a data property along with
additional markup that describes layout, colour and other appearance. DataTemplate is,
basically, used to specify the appearance of data displayed by a control not the appearance of
the control itself.
c. With regard to WPF and XAML, what is data binding and what are some of the benefits it
provides? Include an example of how data binding may be used.
Data binding allows the flow of data between UI elements and data object on user interface.
When a binding is established and the data or your business model changes, then it reflects
the updates automatically to the UI elements and vice versa.
When binding a property or list directly to a control, you are limited to binding a single
property. With data templates, however, you can bind more than one property in each item,
thereby displaying multiple bits of related data together
8.Write and read XAML for GUI design
Task: Given a description of a simple GUI, write XAML that would create it; and
given some XAML, sketch the GUI that would result
Page 19 of 26
1. Assume a WPF Window uses a Grid layout with two columns and three rows. Write a
fragment of XAML to create a TextBlock with the name “sampleText” that occupies
all of the bottom-right cell in the grid. Have the TextBlock display the text “Make
Cheese NAME ”. Include only those properties that are necessary to achieve this
behaviour. Do not write the XAML for the containing Grid.
0 1 Trump for President
1
2
[9 marks]
2. Consider the following excerpt from the XAML for an application’s main Window.
Draw a low-fidelity sketch of the GUI it defines. It should be approximately to scale,
but does not need to be exact.
Page 20 of 26
Good Evening, Drink?
Beer
Wine
Water
Photo.jpg
Page 21 of 26
9.Discuss SD processes including testing
Task: Discuss an aspect of the software development lifecycle (details will be in exam) and
the role of testing
There are following six phases in every Software development life cycle model:
1. Requirement gathering and analysis
2. Design
3. Implementation or coding
4. Testing
5. Deployment
6. Maintenance
Question 8. (Assessing ILO: 3)
a. What is blackbox testing and when would you use it in stead of whitebox
testing?
black Box Testing is a software testing method in which testers evaluate the functionality of
the software under test without looking at the internal code structure. Testers create test
scenarios/cases based on software requirements and specifications. Tester performs testing
only on the functional part of an application to make sure the behaviour of the software is as
expected. It can be applied to every level of software testing such as Unit, Integration,
System and Acceptance Testing.
When testers want to find the gaps in functionality, usability, and other features use blackbox
test. This form of testing gives an overview of software performance and its output.
b. What is whitebox testing and when would you use it instead of blackbox testing?
White Box Testing is based on applications internal code structure. In white-box testing an
internal perspective of the system, as well as programming skills, are used to design test cases.
This testing usually done at the unit level.
When tester want to test the infrastructure of the application use whitebox test.
c. Describe some non-execution testing schemes and explain their advantages.
Non-execution testing is a type of software testing in which software application is tested
without code execution. Manual or automated reviews of code, requirement documents and
Page 22 of 26
document design are done in order to find the errors. The main objective of static testing is to
improve the quality of software applications by finding errors in early stages of software
development process.
Non-execution testing techniques:
Informal reviews: Here no formal review method is applied. The team of
reviewers just checks the documents and give comments. The purpose is to
maintain the quality from the initial stage. It is non-documented in nature
Formal Reviews: It is well structured and documented and follow six main
steps: Planning, kick off, preparation, review meeting, rework follow-up
Technical Reviews: The team of technical experts will review the software
for technical specifications. The purpose is to pin out the difference between
the required specification and product designed and then correct the flaws. It
focuses on technical documents such as test strategy, test plan, and
requirement specification documents.
Walk-through: The author explains about the software to the team and
teammates can raise questions if they have any. It is headed by the author and
review comments are noted down.
Inspection Process: The meeting is headed by a trained moderator. A formal
review is done, a record is maintained for all the errors and the authors are
informed to make rectification on the given feedbacks.
Static code review: Code is reviewed without execution, it is checked for
syntax, coding standard, and code optimization. It is also referred as white
box testing.
Advantages of Non-execution testing
1. Helps in identifying the flaws in code
2. The testing is conducted by trained software developers with good knowledge of
coding
3. It is fast and easy way to find and fix the errors
4. With automated tools, it becomes quite fast to scan and review the software
5. The use of Automated tools provides mitigation recommendations
6. With static testing it is possible to find errors at an early stage of development life
cycle, thus, in turn, reduces the cost of fixing.
10.Discuss a test case
Task: Answer questions about a test case
Page 23 of 26
Question 10
Consider the following use-case-based test for an application and answer the questions that
appear below the table.
a. Can the “Pass” shown as the outcome be trusted? Does this indicate that the Test has
failed or that the entry in the RTM has not been implemented?
No
Criteria 不全面
Order alphanumerically
According to this semester offering units
b. Are there enough test methods in this test case? If not, what additional methods (steps)
would you add?
No
Add white box test
Description
Usecase
Method:
check the function get semester drop-down menu
function
Page 24 of 26
c. What makes (or would make) this a black-box test?
No internal coding test, just test functionality
Description The user shall be able to view an interactive list of staff employed by the School
Type and
Use Case
SW UC #8: User_views_StaffList
Criteria When the tester test GetList, it would show list of all the staff
When the tester input different category, it would show staff involved in this category
When the tester input filterbyname or filterbycategory, it would show the relative teaching staff
Method White Box Test
1. apply the function of GetList in StaffController
2. apply the function of FilterByCategory and input ‘FilterBy(Category.Academic)’
3. apply the function of FilterByName, and input ‘FilterBy(“pel”,
StaffController.NameCate.FamilyName)’
4. apply the function of FilterByName, and input ‘FilterBy(“st”,
StaffController.NameCate.GivenName)’
5. apply the function of FilterByName &Ctegory, and input ‘FilterBy(“st”,
StaffController.NameCate.GivenName) &( FilterBy(Category.Academic)
6. Use ctrl+F5 to run the program
Outcome PASS
Page 25 of 26
Note Running result attached below
Description The user shall be able to view an interactive list of staff employed
by the School
Type and
Use Case
SW UC #8: User_views_StaffList
Criteria The application will show a list of a staff (formatted as Family
Name, Given Name (Title)), ordered alphabetically. The user can
filter the list by partial name match, employment category (all staff,
academic, technical, administrative, casual), or both simultaneously.
For the basic filtering, it would display all staff, or just those who
are academic, technical, administrative, or casual.
Method Black box test:
1. Open the HRIS application
2. Select ‘casual’ from the Show list
3. Each staff member in list should be ‘casual’
4. Select ‘all’ from Show list
5. Enter ‘b’ in Filter by name field
6. Display names should all contain a ‘b’ or ‘B’
7. Select ‘administrative’ from the Show list
8. List should reduce to show subset who are ‘administrative’
Page 26 of 26
Outcome Fail—after the step7, when click the ‘administrative’, there is no
reaction of the app, and the list of step8 is also not ‘administrative’
Staff
Method We exam all the program found that we forget put
StaffControl.FilterBy(Category.Casual)
We add this Filter to the program
Then 1. Open the HRIS application
2. Select ‘administrative’ from the Show list
3. List should reduce to show subset who are
‘administrative’
Outcome ALL PASS
3.组合(复合,Composition)
复合关系使用实线加实心菱形表示。组合又叫复合,用来表示个体与组成部分之间的关联关系。例如学生与心脏之
4.泛化(Generalization)