1 introduction to practical work neil ghani. 2 introduction aim of course –experience of software...

37
1 Introduction to practical work Neil Ghani

Upload: arabella-hampton

Post on 28-Dec-2015

213 views

Category:

Documents


0 download

TRANSCRIPT

1

Introduction to practical work

Neil Ghani

2

Introduction

• Aim of course– Experience of software development– Opportunity to show your knowledge of software

development techniques• How to specify, how to design, how to code, etc…

• Through writing a larger-scale piece of software – Though still relatively small– Choice of language is yours

• But Java is safest choice, Haskell means I’ll help you

3

Practicals

• Revision practical

• Initial practical (10%)

• Assessed practical (90%)

• Resit practical

4

Revision practical

• Finish off practical work from class Programming Techniques (52 231)

• Brush up on abstract data types– Lists, trees, queues, etc.

• Especially make sure you have completed the exercise on binary search trees

5

Initial practical

• Generally, two main objectives– Further experience

• In handling strings and trees– You will need these for the assessed practical

• In report writing– You will need this for the assessed practical

6

Initial practical

• Aim – To develop a program to

• Read in a series of words• Enter them into a binary search tree• Print out the words by flattening the tree

– In-order traversal– i.e. in alphabetical order

• Also read this http://www.cs.strath.ac.uk/teaching/ng

7

Initial practical

• Let’s break this down a bit– Two main tasks: creating words, and

creating a tree

• Creating words– Define what a word is– Splitting character series into words– Deciding ordering of words

• Given two words which comes alphabetically before the other

8

Creating words

• Defining words• Treat a word as a character followed by any sequence of

characters until some separator appears– E.g. “Isn’t/software/ fabby?” gives “Isn’t” “software” “fabby?”

– Better is to remove excess punctuation “fabby”

• Splitting words• Design and code a small program which reads a

sequence of characters (i.e. from user or file)

• Alphabetical order• Which is the greater of two words

– E.g. ‘zebra’ is greater than ‘albatross’

9

Creating words

• To test– Create a driver program

• Takes in input (a character sequence)– ‘why doesn’t my program work correctly first time?’

• Splits the character sequence– ‘why’ ‘doesnt’ ‘my’ ‘program’ ‘work’ ‘first’ ‘time’

• Outputs the result– ‘why’ ‘doesnt’ ‘my’ ‘program’ ‘work’ ‘first’ ‘time’

10

Storing Characters in a Tree

• Creating tree– Easiest to hold character at each node for now– At least you should be able to initialise tree, add a

character to it and traverse it (print out a in-order sequence)

– If this is too easy– add a deletion operation

– extend code to ensure tree remains balanced

– develop code which allows you to write the data in the tree out to a file in such a way that you can rebuild exactly the same tree when you read the data back in.

– As before, write a driver to test this code

11

Put two stages together

• So that your code reads in a series of characters, splits into words, inserts words into tree and finally prints out tree– Means changing tree to deal with words rather than

characters

• Finally, write a short account (max 3 sides) of how you designed, developed and tested the program

why

doesnt

my

12

Marking

– 1 mark for being able to define a word– 1 mark for being able to read in a series of words– 1 mark for being able to calculate the greater of

two words– 1 mark for driver to test the above– 1 mark for creating a bst– 1 mark for being able to print a bst– 1 mark for driver to test creation and printing– 1 mark for being able to store words (correctly) in

tree– 2 marks for report

13

Notes

• Think about it first– Don’t start coding until you have designed– Code in stages!!!– Checked and signed in labs (demo required)– 10% of final mark (lab supervisor’s decision)– Due in your regular lab of week six – BUT try to do before this

14

Assessed practical

• Main assessed work for the class (90% of final mark)

• Develop one of the following pieces of software

• Write a report on the design, coding and testing

• between 10-15 pages in the standard form• details of testing • a code listing to be submitted electronically• a signed statement that it is all your own work (will be on

web page and office)

15

Assessed practical

• Submissions which lack testing, code or report will fail

• The assignment must be submitted to the Computer Science Departmental Office (L11.06):

• you need to get a receipt! - no later than noon on the Friday of the eleventh week of the semester

• Late submissions (by up to a maximum of two weeks) will not be accepted

• Exceptions by medical certificate only

16

Assessed practical

• 5 choices– Question 1 – password manager– Question 2 – student progress checker– Question 3 – machine translator– Question 4 – student help queue– Question 5 – decision tree game

17

Question 1 – password manager

• Input: list of username-password pairs, test username-password pairs

• Output:

• Two types for two groups– Managers: see all username passwords– User: decision on whether

username/password is valid

18

Question 1 – password manager

• Project involves– Storing user names and passwords

• Using preferably binary search tree• Accessed using user name

– Validating passwords and names• Are they legitimate• Are they already taken

– Allowing management functions• How many users• What passwords are taken

19

Question 1 – password manager

• Input: user name and password– User name – 8 alphabetic characters– Password between 4-8 alphanumeric characters

• Must have at least one digit and at least one alphabetic character

• Output – User - decision as to whether user name and

password is allowed• allowed if conforms to above rules

– Manager – lists all registered users and passwords

20

Question 2 – student progress checker

• Input: set of student data– Ian_Ruthven    Programming_project    100

Ian_Ruthven    MIA 50 Ian_Ruthven    Operating_systems    25 Joe_Bloggs    Operating_systems    26

• Output : which courses a student has passed or not (interactive and summarised)– Ian Ruthven has passed programming project– ..– Joe Bloggs has failed operating systems

21

Question 2 – student progress checker

• Project involves– Storing student name, courses taken, scores

obtained• Also means finding student name in some sensible data

structure– Defining pass mark– Outputting pass/fail information in some sensible

way• Additional things

– Perhaps also include credits for progression– Include summarised information on pass/fail for

whole courses

22

Question 3 – machine translator

• Input: dictionary of words in English, French, German, Spanish, word(s) for translation, choice of translation language

• Output: translated words• E.g. English word dog translated to chien in

French

23

Machine translation

• Inputs:– List of top 500 English words with

translation into French, Spanish and German

• english: today french:aujourd'hui spanish: hoy german: heute

• english:during french:pendant spanish:durante german:

– To be stored in some sensible data structure….– Accessed by English word– English word for translation– Target language(s)

24

Machine translation

• Output:– Translated word in target language

• Better– Try to translate whole sentences or

phrases– Deal with punctuation in user input

25

Question 4 – Student help queue

• Simulate maintenance of a demonstrator request system– Assume demonstrators have hand-held devices– Request demonstrator from application on desktop

• Functions• Send request for help (add item to queue from desktop)• remove item from queue (if demonstrator has helped)• list contents of queue (who does the demonstrator go to

next)• remove a specified item from the queue (found answer

yourself)• Must provide a list of queue items, alphabetically ordered

by user

26

Student help request queue

• Inputs are various– Requesting help (student name, time,

problem?)– Answering student (student name to

remove student)– List (no inputs, outputs are list of students)

• What about outputs?– Something useful

27

Question 5 - game of fish

• Fish is a game where system tries to guess animal user is thinking of

• E.g.– Computer: Is it large?– User: No– Computer: Is it dangerous?– User: No– Computer: Is is cute?– User: Yes– Computer: Is it a kitten?– User: Yes

28

Question 5 – game of fish

• Uses a binary decision tree– Each node is either

• a question – “Is it dangerous?”• an answer – “Is it a cat?”

– If the computer is wrong• User must supply new question

cute

cat lion

null null

noyes

yes no

29

Assessed practical

• You can choose any of these but• Choose question 4 if you are less confident

with ADTs and need some practice

30

Assessment• Marking of Submissions

• Report:- Report Design and Style, Contents (General), Justification of Design (e.g of Data Structures, Algorithms), Abstract & Conclusions/Concluding Comments, Outline User Guide

– Out of 30 marks• Testing:- Explanation of Test Strategies & Data (in report),

Soundness & Completeness of Test Cases, Submission of appropriate Test Cases, Evaluation (in report)

– Out of 25 marks• Program:- General Program Design, Program Completeness,

Program Flexibility (within limits of assignment sheet), User Interaction/Dialogue, Programming Style

– Out of 25 marks• Planning:- Initial plan, assessment of planning and activity

– Out of 10 marks

31

Assessment

• From this total will be deducted: – 5 marks for those who have done question 4

• this is an easier question

– Such mark as is necessary to cause failure for those who have neglected to hand in one of the three identified sections of report, testing and program;

32

Assessment

• Final mark = main assessed mark + initial practical mark

• Resitting students only marked on main assessed mark

33

Assessed practical

• Do not start coding until you have finished the initial practical– Preferably do not start design either– Tip: finish the initial practical early– Write as you go (draft)– Plan your time

34

Note that

• Labs will be staffed by demonstrators– Your work!

• only some languages supported by staff:– Your knowledge!

• in general, staff support design and reporting, not syntax:– Your development!

35

Assessment

• by project report – no written exam – timely submission (I mean this)– resit either by further work on failed report

or by new report, depending on circumstances and at the class lecturer's discretion

• in line with requirements issued with the outline specifications

36

Plagiarism

• plagiarism (that is, copying) is both a moral and a legal offence ... – and is unacceptable.

• You will be heavily penalised for this

37

So

• Looked at all practicals– Except resit– More specific details in lectures once you

have started– Don’t leave it too late to start– Good luck!