Presentation is loading. Please wait.

Presentation is loading. Please wait.

Mark Dixon, SoCCE SOFT 136Page 1 02 – Software Development Life-Cycle.

Similar presentations


Presentation on theme: "Mark Dixon, SoCCE SOFT 136Page 1 02 – Software Development Life-Cycle."— Presentation transcript:

1 Mark Dixon, SoCCE SOFT 136Page 1 02 – Software Development Life-Cycle

2 Mark Dixon, SoCCE SOFT 136Page 2 Admin Technicians (Babbage 205) can provide you with free copies of (bring your own blank CDs): –MS Visual Studio 6.0 (4 CDs), includes Visual BASIC 6.0 Visual InterDev 6.0 Visual C++ 6.0

3 Mark Dixon, SoCCE SOFT 136Page 3 Questions: Events Consider the following code: a) How many unique events does it contain? b) Name the event(s). Private Sub btnAns_Click() Me.BackColor = vbBlue lblComment.Caption = "Correct, well done!" End Sub 1 Click

4 Mark Dixon, SoCCE SOFT 136Page 4 Questions: Properties Consider the following code: a) How many properties does it contain? b) Name the properties. 2 BackColor, Caption Private Sub btnAns_Click() Me.BackColor = vbBlue lblComment.Caption = "Correct, well done!" End Sub

5 Mark Dixon, SoCCE SOFT 136Page 5 Questions: Keywords Consider the following code: a) How many unique keywords does it contain? b) Name the keywords. 3 Private, Sub, End Private Sub btnAns_Click() Me.BackColor = vbBlue lblComment.Caption = "Correct, well done!" End Sub

6 Mark Dixon, SoCCE SOFT 136Page 6 Questions: Objects Consider the following code: a) How many objects does it contain? b) Name the objects. 3 btnAns, Me, lblComment Private Sub btnAns_Click() Me.BackColor = vbBlue lblComment.Caption = "Correct, well done!" End Sub

7 Mark Dixon, SoCCE SOFT 136Page 7 Object naming conventions all objects have name property used to identify them in code (identifier) txtSurname.Caption = "Smith" 3 letter prefix to denote type, followed by short meaningful word/phrase: –frm: form(e.g. frmMain, frmAdd) –pic: picture box(e.g. picDisplay, picFace) –txt: text box(e.g. txtMonth, txtDrink) –lbl: label(e.g. lblName, lblAge) –btn: command button(e.g. btnClear, btnExit) makes it easy to read code

8 Mark Dixon, SoCCE SOFT 136Page 8 Session Aims & Objectives Aims –introduce you to fundamental software development lifecycle concepts Objectives, by end of this week’s sessions, you should be able to: –Run through the software development cycle. Implement simple software design –Create (draw) user interface –Put instructions in: »correct event handler procedure for desired result »correct sequence for desired result Test this design –Identify and correct simple logical and syntax errors –Identify & correct simple user interface (usability) problems

9 Mark Dixon, SoCCE SOFT 136Page 9 Project Files: Create New Folder Create new folder for each project (on U: drive), use Windows Explorer:

10 Mark Dixon, SoCCE SOFT 136Page 10 Project Files: Create New Folder Save all project files into that folder (using VB6) –project file (.vbp) –form files (.frm)

11 Mark Dixon, SoCCE SOFT 136Page 11 Version Control: Copy Folder At regular intervals copy whole folder to create new version –drag the folder and hold down CTRL key

12 Mark Dixon, SoCCE SOFT 136Page 12 Version Control: Rename Folder Rename the copy of the folder, using the date and time it was created:

13 Mark Dixon, SoCCE SOFT 136Page 13 Software Development Cycle Software development follows this pattern: –analyse problem – what does the user need? –design solution – how can I help? –implement (code) solution – build it! –test & debug solution (code) – does it work? However, it is: –cyclic/iterative (not linear)

14 Mark Dixon, SoCCE SOFT 136Page 14 Example 1: Ball v1 - Analysis User Requirements –describe user's objectives no mention of technology Software Requirements –Functional list facilities to be provided (often numbered) –Non-functional list desired characteristics (often more subjective) SPECIFICATION User Requirements –keep play school children occupied Software Requirements –Functional: move cartoon character around the screen –Non-functional character should be interesting and colourful

15 Mark Dixon, SoCCE SOFT 136Page 15 Example 1: Ball v1 - Design User interface design: Functional design: Trigger (when)Actions (what) click event of Right buttonmove ball character right click event of Left buttonmove ball character left click event of Up buttonmove ball character up click event of Down buttonmove ball character down

16 Mark Dixon, SoCCE SOFT 136Page 16 Example 1: Ball v1 - Form Properties (setting at design-time): –initial value only –change using properties window name: used internally to identify object (programmer) caption: displayed on button (user) left: horizontal position

17 Mark Dixon, SoCCE SOFT 136Page 17 Example 1: Ball v1 - Code Option Explicit Private Sub btnRight_Click() picBallChar.Left = picBallChar.Left - 200 End Sub Properties (setting at run-time) –use code, assignment operator (=) –can change while program is running btnRight picBallChar BallChar

18 Mark Dixon, SoCCE SOFT 136Page 18 Testing & Debugging: Errors 3 error types : –syntax: computer unable to understand your instructions (program does not execute), e.g. variable not defined (probably most common) –run-time: program can't execute instruction and exits (future lecture) Device unavailable (e.g. floppy drive) –logical: program executes but does not not match specification (do what was intended), e.g. clicking on button does nothing, when you thought you attached code to it clicking on blue button changes colour to red (when it should change to blue)

19 Mark Dixon, SoCCE SOFT 136Page 19 Computer –just symbol matching –No intelligence Example: Hello Errors Sub Command1_Cluck LabelL.Caption = "Hello" End Sub L instead of 1: causes syntax error (variable not defined) u instead of i: causes logical error (Command1 button does nothing)

20 Mark Dixon, SoCCE SOFT 136Page 20 Question: Errors The following example is from lecture 1, –Spot the errors (you should find 6), and –decide whether they are syntax or logical Private Sub btnBlue_Cluck() lblResult.BackColor = vbRed End Sub Private Sub btnRed_lick() lblResult.BackColor vbRed End Sub Private Sub lb1Result_DblClick() lblResult.BackColour = vbWhite End Sub

21 Mark Dixon, SoCCE SOFT 136Page 21 Debugging: Testing Functional Decomposition –break it into logical chunks Incremental Development –type a bit –test it Testing –test all/most combinations Regression Testing –repeat all previous tests

22 Mark Dixon, SoCCE SOFT 136Page 22 Sequence Execution sequence controlled in two ways: –procedures controlled by order of events –instructions (lines) controlled by order in code Private Sub btnBlue_Click() lblResult.BackColor = vbBlue End Sub Private Sub btnRed_Click() lblResult.BackColor = vbGreen lblResult.BackColor = vbRed End Sub Private Sub lblResult_DblClick() lblResult.BackColor = vbWhite End Sub VB

23 Mark Dixon, SoCCE SOFT 136Page 23 Example: Ball v2 (animation) Option Explicit Private Sub Form_Load() tmrBall.Enabled = False End Sub Private Sub btnGo_Click() tmrBall.Interval = 100 tmrBall.Enabled = True End Sub Private Sub tmrBall_Timer() picBall.Left = picBall.Left + 100 End Sub Need a –picture box –command button –timer control Trigger (when)Actions (what) click event of Go buttonball character moves left continuously

24 Mark Dixon, SoCCE SOFT 136Page 24 Example: Garden Wildlife

25 Mark Dixon, SoCCE SOFT 136Page 25 Questions: Parts of Code consider the following code: Private Sub btnThing_Click() lblResult.BackColor = vbRed lblResult.Caption = "Testing" End Sub –name all objects –name all properties –name all keywords –name all events btnThing, lblResult BackColor, Caption Private, Sub, End Click

26 Mark Dixon, SoCCE SOFT 136Page 26 Questions: BallChar Code consider the following code: –how many event procedures? –name all properties –name all objects –name all events 3 Enabled, Interval, Left Form, btnGo, tmrBall, picBall Load, Click, Timer Option Explicit Private Sub Form_Load() tmrBall.Enabled = False End Sub Private Sub btnGo_Click() tmrBall.Interval = 100 tmrBall.Enabled = True End Sub Private Sub tmrBall_Timer() picBall.Left = picBall.Left + 100 End Sub

27 Mark Dixon, SoCCE SOFT 136Page 27 Tutorial Exercise: Ball Char v1 LEARNING OBJECTIVE: to understand objects, events, properties, and event handler procedures, TASK 1: Get the Right button from the Ball Character example working. (code provided, images in resources area on server). TASK 2: Get the Left, Down, and Up buttons working. (You will need to work out what code to use. Use the code provided as inspiration) HINT: there isn't a right property, there is a top property

28 Mark Dixon, SoCCE SOFT 136Page 28 Tutorial Exercise: Ball Char v2 LEARNING OBJECTIVE: to understand objects, events, properties, and event handler procedures, TASK 1: Get Ball Character example v2 (from the lecture) working. (code provided, images in resources area on server). TASK 2: Add a button that places the ball character back on the left hand side Task 3: Make the ball character blink when clicked

29 Mark Dixon, SoCCE SOFT 136Page 29 Tutorial Exercise: Garden LEARNING OBJECTIVE: to understand objects, events, properties, and event handler procedures, TASK 1: Get the Garden Animals example working. Clinking an image should change the document (page) background colour to something suitable for the animal (e.g. ladybird – red), and display the name of the animal below the images. (no code provided, but images in resources area on server)


Download ppt "Mark Dixon, SoCCE SOFT 136Page 1 02 – Software Development Life-Cycle."

Similar presentations


Ads by Google