• No results found

1.04- SDLC (1).pptx

N/A
N/A
Protected

Academic year: 2020

Share "1.04- SDLC (1).pptx"

Copied!
39
0
0

Loading.... (view fulltext now)

Full text

(1)

Software Design

Life Cycle

(2)

Essential Standard

1.04- Understand program design, analysis, and

(3)

Purpose

This lesson will review the Software Design Life Cycle and introduce debugging techniques used in C#. Many of

(4)

Software Design Life Cycle

A set of guidelines for writing software that satisfies the needs of others.

(5)

Step 1

Analyze requirements

• Programmer meets with the client to talk about the requirements for the software

• Discuss the functionality and the user’s interface. • Discuss the goals of the project and timeline for

completed product or achieving other results.. • Reflect on the cultural needs of your environment

and identify means of helping.

(6)

Design and Evaluation

• Programmer creates a conceptual design of the software

• Programmer makes sure that the design meets all the requirements determined by the client

Step

2

(7)

Flowcharts

As you learned in Programming I- flowcharts are used to produce a visual representation of your program.

Start/

End Decisio

(8)

Flowchart Assignment

Create a flowchart for the Tic-Tac-Toe program used in

1.02. Remember there are processes and decisions in this program.

You can use:

Visio- great diagramming tool from Microsoft.

Word and PowerPoint also have flowcharting shapes built in

(9)

Sample

(10)

Implementation and Integration

• Programmer through the use of the IDE

(integrated development environment) codes the application or service.

• The IDE used in this course is Visual Studio.

Step

3

(11)

Testing

• Client and programmer test the software to make sure that it operates without any bugs.

• This is a thorough test of the software. Testing will continue once the end user takes delivery of the product.

• Ensures that bugs or defects do not remain in the final product.

Step

4

(12)

Debugging

Techniques

(13)

Types of Errors

Syntax

Run Time (Exceptions)

Logic

(14)

Syntax Error

A programming language speaks a “language” of its own using reserved words called keywords.

A syntax error is an error in the use of a keyword, control character or other language function. The program will not run (compile) with a syntax error. Visual Studio calls syntax errors a “build error.”

Left: a common error for new C#

programmers

(15)

Syntax Error Examples using

Variables

integer x = 7;

sting name = “John”;

string age = 14;

(16)

Syntax Error Examples using

Variables

integer x = 7;

• Invalid keyword- use int in C#

sting name = “John”;

• Mispelled string- sting is not a data type

string age = 14;

• A numerical value cannot be placed in a string without placing it in quotes.

int num = “apple”;

(17)

Error List

The Error List is a very useful in Visual Studio. All current syntax errors are listed.

All errors listed must be corrected before the program can compile. Double click on an error to go to that line in

code.

(18)

Run Time Errors

Run time errors occur when the program encounters an exception it does not know how to handle.

This will cause the program to crash (stop working).

(19)

Run Time Error Examples

• Attempting to divide by zero (num1 / num2 where num2 is still set to its default value of 0 or otherwise assigned a value of 0)

• A user enters a string into a textbox meant for a numeric value. The run time error will occur when the program attempts to convert the bad data.

• The program attempts to assign a value to an array index value that does not exist.

(20)

Logic Errors

A logic error is an error is the thinking or logic of the coder. The program runs normally, but produces results different from the expected output.

(21)

Logic Error Examples

• Endless loops- A loop whose run condition is always true

Example: while(x < 4) {

some code but forgetting to add x++

} //x will never be greater than 4 and this loop with run forever

• A loop or if statement using an improper comparison

(22)

Logic Error Example

int howMany = 12;

for(i=0; i>howMany; i++)

(23)

Handling Errors

Syntax errors are fatal errors. The program will not compile and run until they are corrected. There is no

method for handling them in a running program because they will not occur.

Using features of the code and IDE we can debug for logic errors and prevent run time errors from crashing our

(24)

Handling Exceptions

Just like in VB we can use Try/Catch to handle exceptions in our program.

Instead of the exception causing a crash- the try/catch block “catches” the “thrown” exception and runs some code instead.

(25)

Try Catch Syntax

try

{

Code to try for possible exceptions

}

catch

{

Code to run if the try code throws an exception

(26)

Example Using Try/Catch

• try

• {

• intAge = Convert.ToInt32(strTempAge); //or txtAge.Text

• }

• catch

• {

• MessageBox.Show(“Enter a number. The value you entered is invalid. ” + strTempAge)

(27)

Handled vs Unhandled

Exception

Left: Try/Catch block was used Above: No try/catch block-

(28)

Debugging Logic Errors

IDE features such as breakpoints and the Locals window can help debug logic errors in your program. Below is an example of a breakpoint.

(29)

Line Numbers

Line numbers make debugging easier by allowing you to quickly reference what line of code you are working on.

(30)

Turn on Locals Window

When a program is running (Pressed F5 or clicked the Green Triangle) visit the Debug menu and the Windows submenu. The Locals Window is one of the options you can select.

(31)

Locals Window

(32)

Our Breakpoint

New options exist when the program is paused at a breakpoint.

(33)

Options

Continue- Run the program as normal from where the program paused

Step Into- Move the program one line forward into a coding block

Step Out- Move the program out of the current coding block

Step Over- skip the next coding block

(34)

Practice

Practice using breakpoints and the Locals window using one of the programs you wrote in 1.01 or 1.02- especially ones with an if statement or loop.

(35)

Deployment

• Programmer delivers the product to the client. • This could include installation and/or

customization.

• Client continues testing the software and reports issues to the programmer.

Step

5

(36)

Documentation and Maintenance

• Programmer creates… • Help documents

• User manuals • Tutorials

• Programmer provides maintenance for the

software as agreed upon by the client. This could include fixing bugs, adding new features, or

implementing on new or updated platforms.

Step 6

(37)

Comments in C#

Just like in Visual Basic it is extremely important to comment your code.

This is especially true in team environments where more than one coder will be working on a project.

C# provides 2 ways to comment:

• // can be used for a single line comment or in line after a coding statement

(38)

Comment Examples

age = Convert.ToInt32(tempAge); //convert the string data to integer  Inline comment after a coding statement

// This program will check an age. This is a single line comment

/* This is a multi-line comment * J. Crompton

* Computer Programming II * August 4, 2015

(39)

Conclusion

In this lesson we reviewed the Software Design Lifecycle and looked at debugging and IDE options for debugging in more detail.

References

Related documents

On the FPX, one FPGA, the Network Interface Device (NID), is used to route individual traffic flows through the device and process control packets, while the other FPGA, the

In this paper, we will explore the possibility of DMG/sodium dodecyl sulfate (SDS) immobilized on alu- mina-coated magnetite nanoparticles (DMG/SDS-ACMNPs) to act as SPE sorbents

DIFM (Data Intensive Management Project) uses precision agriculture technology, with researchers and farmers working together conducting large-scale, on-farm “checkerboard”

• Where only a single rating is stated, three-phase 3-wire current transformer operated meters shall be tested at the rated CT current (eg. New or repaired class 2.0 meters should

In order to assess the relationship between measured inequality and θ in the two- parameter equivalence scale form, the covariance between effective household

The reaction patterns car- ried out in the realm of surface energetics (entailing tendino- muscular meridian systems, trigger points, and Bi disorders) must be

Βραβείο Turing 2007 (αντίστοιχο του βραβείου Νόμπελ στην Πληροφορική) Θέμα: Κατανοώντας και αλλάζοντας τον κόσμο ΣΑΒΒΑΤΟ 6 ΜΑΙΟΥ 2017