Software Construction (COMP2100/2500/6442)courses.cecs.anu.edu.au/courses/COMP2100/notes/01intro...5...

Post on 12-Aug-2020

2 views 0 download

Transcript of Software Construction (COMP2100/2500/6442)courses.cecs.anu.edu.au/courses/COMP2100/notes/01intro...5...

Software Construction

(COMP2100/2500/6442)

2016

Eric McCreath

2

Acknowledgement"We acknowledge and celebrate the First Australians on whosetraditional lands we meet, and pay our respects to the elders of theNgunnawal people past and present."

The official ANU Acknowledgement wording see:http://reconciliation.anu.edu.au/

3

WelcomeAs the title suggests this course is about software construction.

I hope that in this course you will:

improve your ability to design, implement and test software,

you will be able to reflect on different design approaches and beable to analyze their strengths and weaknesses,

you will gain or improve skills in the use of tools for softwaredevelopment (eclipse, make, bash, JUnit, git, gitlab, etc..), and

be able to understand moderate sized software systems andmake modifications/additions to them.

And in all this you will find this course interesting, challenging, anduseful.

4

Admin DetailsCourse Convener : Dr Eric McCreath -

eric.mccreath@anu.edu.au, CSIT Building N227

Second Examiner: Mr. Gaurav Mitra - gaurav.mitra@anu.edu.au,CSIT Building N230

Contact hours (the hour after the lectures) so Mon 15:00-16:00,Tues 11:00-12:00, and Friday 14:00-15:00. These are in my office.Note you can also drop past at other times.

Web site - https://cs.anu.edu.au/courses/comp2100/

Labs start Week 2 - register via https://cs.anu.edu.au/streams/

No text book.

5

AssessmentThe proposed assessment for COMP2100/2500/6442 in 2016 willbe in three parts:

assignments, worth 30%

laboratory mark, worth 10%. This is made up of marks allocatedby your tutor for: participation, assignment checkpoints, and labtests.

a three hour final examination (theory/lab), worth 60%.

The exam mark or final raw mark may be scaled to produce thefinal overall mark and grade. The final marks for COMP2100/2500and COMP6442 are scaled separately.

Students must obtain a mark of at least 40% in the final exam topass the course (this is a hurdle assessment item). Final marks aremoderated at a Research School of Computer Science examiner'smeeting.

6

AssessmentPlease check the Undergraduate Handbook and the web for policystatements concerning special consideration and special, furtherand supplementary examinations.

Quality and integrity are expected from all students. Studentsshould also expect this from the lecturing/tutorial staff. Please readover the ANU's policy on this matter:http://academichonesty.anu.edu.au/

7

AssignmentsAssignment 1: due Wednesday Week 6 (23/3/2016 any time

before 10pm), value 15%

Assignment 2: due Wednesday Week 12 (18/5/2016 any timebefore 10pm), value 15%

The assignments will be:

submitted via git,

extensions will only be granted in unforeseeable circumstances(supporting documentation required),

after marks are released electronically you have 2 weeks toquestion marks,

COMP6442 students must complete the extension parts, and

the first assignment is individual, second done in groups of 2.

8

From Understanding to Mastering

This course will help you master important aspects of softwareconstruction.

This will help people who move onto the software engineeringgroup project and other courses that involve softwaredevelopment.

More generally this course aims to improve your programmingand software engineering skills for university and beyond.

The Pin is Mightier Than the Sword!

From http://en.wikipedia.org/wiki/Pin_%28chess%29

9

Quiz!!!!!!!We are now going to have a 5min quiz. It ison content that I would expect most peopleto know. It will be marked yet it will not beworth any marks - you don't need to putyour name on it. However, I would like itreturned.

The quiz has 2 main purposes:

provide me with some feedback onpeople's programming background, and

provide you with some feedback on whatI would expect most people to know.

10

Adding Two IntegersEven for something very simple, such as adding up two integers,there are many different ways of writing code for a "correct"solution.

Given the below interface how many different ways can you thinkof?public interface IntAdder { public int add(int a, int b); // to make it simple let us // assume non-negative integers}

11

Design ApproachesLet us consider a more serious design example, the game oftic-tac-toe.

Consider the overall design of a simple GUI for a tic-tac-toe game.What would your overall design be like?

Create a simple UML diagram of your overall design.

12

Simple DesignThe below approach uses classes to break the code up intomodules and creates some simple types.

13

Simple Fixed OO DesignWe can get rid of if-else conditionals and let the sub-classes dothis work.

14

Using Interfaces to Gain Some Flexibility

Flexibility can be gained by using aggregation of an interface.

15

Perspective on Executing Code

For a programmer what is so important about:

or

16

ProgrammingProgramming is a creative art.

Software developers are optimists.

Idea

Implementation

Interaction

In programming, atleast in part, wecreate the media!

If everything goes toplan software can bedeveloped very rapidly,however, a sequenceof "small" problemscan create bigdelays.

The idea works out

Limitation withthe media!!

Problems withthe idea!!

We design ourselfinto a corner!!

17

ProgrammingTo move from 'Idea' to 'Implementation' you need to have a clear

mental model of computation.

Within this mental model you need to work out a sequence ofsteps (a plan) that will solve the problem. This will often involvecreating or using data structures.

Also it will involve having a good understanding of the syntax andsemantics of the programming language.

Implementation

Idea

Interaction

18

A Mouse in a MazeProgramming is like constructing a list of instructions that would

enable this mouse to get out of the maze.

Note you have the following:

a mental model of how this constrained world works;

a clearly defined goal; and

a language that defines the instructions the mouse can execute(up, down, left, and right).

19

What is Software Engineering?

Software Engineering is the discipline of developing, deploying,maintaining, and retiring of software. Its key focus is quality and thediscipline encompasses all the phases of the software's life cycle.

"Software engineering attempts to combine sound engineeringprinciples of analysis, design, management, testing, and so forthwith scientific concepts of computing in the production of reliableand cost-effective computer software that meets its users' needs." ,Data Structures and Software Development - Tremblay andCheston

20

An Engineering ApproachFew people would build a house without a plan! Software is no

different. Detailed and clear plans are required.

An Engineering approach is needed.

Given the complexity of software this process is difficult.

However, the flexibility and modularization of software provideways of addressing complexity in software development.

21

Analysis and SynthesisThe design/implementation process may be thought of as

analysis and synthesis. This maps a problem to a solution.

22

The Software Life CycleThe software life cycle includes the following:

Requirements (analysis and definition)

Planning and management *

Overall design *

Implementation *

Testing (unit, integration, and system) *

Delivery

Maintenance (debugging, supporting, and modifying)

Retirement

This course will focus on items marked with * .