+ All Categories
Home > Documents > Software errors:

Software errors:

Date post: 26-Feb-2016
Category:
Upload: archie
View: 26 times
Download: 1 times
Share this document with a friend
Description:
Software errors:. - PowerPoint PPT Presentation
Popular Tags:
45
Software errors: Software bugs in a Soviet early- warning monitoring system nearly brought on nuclear war in 1983, according to news reports in early 1999. The software was supposed to filter out false missile detections caused by Soviet satellites picking up sunlight reflections off cloud- tops, but failed to do so. Disaster was averted when a Soviet commander, based on what he said was a '...funny feeling in my gut', decided the apparent missile attack was a false alarm. The filtering software code was rewritten
Transcript
Page 1: Software errors:

Software errors:

Software bugs in a Soviet early-warning monitoring system nearly brought on nuclear war in 1983, according to news reports in early 1999. The software was supposed to filter out false missile detections caused by Soviet satellites picking up sunlight reflections off cloud-tops, but failed to do so. Disaster was averted when a Soviet commander, based on what he said was a '...funny feeling in my gut', decided the apparent missile attack was a false alarm. The filtering software code was rewritten

Page 2: Software errors:

Designing and testing is critical.See Software QA and Testing faq at [http://www.softwareqatest.com/qatfaq1.html].

Page 3: Software errors:

Do you like horror stories?http://www.cs.tau.ac.il/~nachumd/horror.html

Page 4: Software errors:

Therac-25 Incident:Error in radiation doses to cancer patients.[http://courses.cs.vt.edu/cs3604/lib/Therac_25/Therac_1.html]Also p. 202.

Page 5: Software errors:

Chapter 22 Design

Software Life CycleAnalysis (Requirements)DesignImplementationTestingDeployment

Page 6: Software errors:

Waterfall Model (p. 827)Appears logical but does not work very well in practice when problems are extremely complex.Not realistic to assume complex processes flow linearly.Imagine designing and building a home this way – with no option for change.True problem solving often occurs after flaws are discovered!

Page 7: Software errors:

Examples:

• Often difficult to state all requirements exactly prior to the design phase.

• Perhaps there were inconsistent requirements (not unusual when requirements are generated by many people).

• Seeing results can change requirement expectations.

Page 8: Software errors:

Imagine the following requirements (among hundreds) for a game.Requirement 14.Only basic food staples shall be carried by game

characters. . . . . .Requirement 223.Every game character shall carry water.. . . . . .Requirement 497.Flour, butter, milk and salt shall be considered the

only basic food staples.

Page 9: Software errors:

Reference for the preceding slide, and other examples, at [http://www.ie.inf.uc3m.es/grupo/docencia/reglada/psii/SwEng2/Unit4.pdf]

Page 10: Software errors:

Requirements are often changing (new rules or regulations).

A design may be sound in theory, but not in practice due to finite limits on computers (Reason for algorithm analysis).

Bug fixes sometimes require a redesign. Customers might not like the final product

(even though it was designed to their specs). They may have changed their mind or had a change in thinking.

Page 11: Software errors:

Spiral model (p. 828). Iterative approach to software

development. Can be more responsive to changes or

inexperienced customers. Can lead to inefficiencies (or sloppiness)

because developers know there is another iteration in the process and may not be as complete in the current iteration.

Page 12: Software errors:

Much of this falls into the category of Systems Analysis or Project Management and is covered in depth in CS460. Ultimately, software should be “idiot proof”.

Page 13: Software errors:
Page 14: Software errors:
Page 15: Software errors:
Page 16: Software errors:

OO DesignDiscover classesDetermine class’ responsibilitiesDescribe relationships among classes.

Page 17: Software errors:

Some things to bear in mind:Cohesion

Interface features should be closely related to a single concept the class represents. See example on p. 834

If you account for half-dollars or silver dollars, you must change the CashRegister class.This is what you want to avoid.

Page 18: Software errors:

Coupling: Measure of the extent to which classes depend on other classes. Note: dependency relationship on p. 835.

Maximize cohesion and remove unnecessary coupling.

Page 19: Software errors:

Class relationships:Inheritance.

You’ve seen it and we’ll cover later.

Page 20: Software errors:

Dependency:

Class A depends on class B if any of A’s methods use an object of type B in any way.Page 834-5: The CashRegister class depends on the Coin class.

Page 21: Software errors:

Aggregation

If an object of one class contains objects of another class then the first class aggregates the other.

stronger form of dependency. If a class “is made up of” elements

from another class, it may be an aggregation.

Page 22: Software errors:

Based on the information provided we don’t know if the CashRegister class aggregates the Coin class or just depends on it.Does the CashRegister class contain a list of coins or just the total value of the coins.It could be designed either way, though the first is probably best.

Page 23: Software errors:

Strictly an interpretation of the realities of the model you’re dealing with.

A department is “made up of” employees, so a department may aggregate employees.

That is, the department class probably contains employee objects.

The book makes a reference to pointers. Forget about that for now.

Page 24: Software errors:

See side bar on page 837Go through example of using inheritance vs aggregation.Multiplicity of an aggregation.

See page 839.

Page 25: Software errors:

CRC Cards (Classes, Responsibilities, Collaborators).

1. Discover classes2. Determine Responsibilities of each

class3. Describe relationships between

classes

Page 26: Software errors:

Do the case study starting on page 839.

Page 27: Software errors:

Example: Model the NCAA basketball tournament.

Display the scores of all games in a given round.Display the scores of all the games in a region.Display the scores of all games played by a given team.Display points scored by each player in each game played.

Page 28: Software errors:

Comparisons between C++ and Java

Both are case sensitive.Both have similar syntax. Often causing some to think the languages are similar. THEY ARE NOT!Java is pure object oriented, C++ is not. C++ can have functions that are not members of a class.This can be an advantage but may also allow sloppy design.

Page 29: Software errors:

Java compilers typically generate byte code, standard C++ compilers generate machine code (.exe) file. Can run simply by double clicking on the .exe file or by specifying the file name in the run command.Byte code usually results in better portability; .exe files generally run faster.

Page 30: Software errors:

Major differences in parameter passing.

Java: primitives are pass by value, objects are pass by reference

C++: can specify how to pass parameters.

Page 31: Software errors:

C++ supports pointer variables and addresses, Java does not.C++ supports preprocessing and macros (code expansion).C++ allows you to define your own types.

Page 32: Software errors:

Java has automatic garbage collection, standard C++ does not.Java hides more specific machine details from the programmer.

Can be good or bad, depending on the application.

Also see Appendix I and [http://www.dickbaldwin.com/java/Java008.htm]. Can also search google using key words differences Java C++.

Page 33: Software errors:

Visual Studio .NET Specifics:

Distinction between Managed (C++/CLI) and Unmanaged (standard C++) applications. This is not important for the course goals (primarily standard C++), but it can NOT be avoided entirely. In addition, it's important to note that the old Visual studio 2003 and 2005 versions of managed code are quite different.

Page 34: Software errors:

Some differences:C++/CLI (Common Language Infrastructure)Microsoft's extension to C++ for the .NET environment. [http://msdn.microsoft.com/en-us/magazine/cc163681.aspx]Compiles to an Intermediate Language and runs in a virtual machine environment. Has access to both managed and unmanaged data. To oversimplify, managed provides some garbage collection abilities as in Java.[http://www.developer.com/net/cplus/print.php/2197621]http://social.msdn.microsoft.com/Forums/en/xnagamestudioexpress/thread/effcca73-b4f2-4a74-91e3-cb92d2008a29

Page 35: Software errors:

Standard C++Well established language.Code may still be portable; it would just have to be recompiled.Compiles to machine code.Programmers have to do their own garbage collection.

Page 36: Software errors:

We’ll deal just with standard C++ and design. Managed code adds little to the goals of this course. We’ll distinguish ONLY when we have to.

Page 37: Software errors:

Creating your first unmanaged C++ program in Microsoft Visual Studio .NET 2008

Start Microsoft Visual Studio .NET.You can close the Start page if it appears.Make sure the Solution Explorer pane is visible by selecting ViewSolution Explorer.Select FileNewProject. Select the name of the project and the location in which it will be store. A folder will be created with this name at that location. Under Project Types select Visual C++WIN32.Also select WIN32 Console Application under Visual Studio installed templates.

Page 38: Software errors:

Specify a name and location for your project.Clear the checkbox associated with Create directory for solution next to the Solution name textbox. Checking it creates a subdirectory inside the one you are already creating. It’s not necessary for this course.Click OK.The WIN32 Application Wizard will appear. When it does, click on the Application Settings link.Select the Console Application radio button.Select the Empty Project textbox.Click the Finish button.

Page 39: Software errors:

You now have a project with no associated code and the Solution Explorer pane should contain three items (Header files, Resource files, and Source files) under the name of your project. In this course you will need to be concerned only with the header and source files.

Page 40: Software errors:

In the Solution Explorer pane, right click on Source files and select AddNew Item.

In the Categories pane, select Visual C++Code.Select C++ file under Visual Studio Installed Templates.Enter a name for the file in the textbox provided (You do not need to specify .cpp in the name).Leave the location as it is (your solution directory).Click the Add button.A window will appear in which you can enter some C++ code.

Page 41: Software errors:

Enter the C++ Code in the window associated with the file you just created. For example, enter the code below

#include <iostream>using namespace std;int main(){

cout << "Hello: This is your first C++ Program" << endl;cin.get();return 0;

}

Page 42: Software errors:

Press the F5 key to run the program. A console window will appear with the message above. Press the Enter key to exit the program.At this point you can exit Visual Studio .NET, saving your files.To restart Visual Studio .NET and run the same program, double click on the solution file (File with the ”sln” extension) in the solution folder. To run this program without entering the Visual Studio .NET environment, double click on the “exe” file found in the Debug folder.

Page 43: Software errors:

Creating a C++ Program in Microsoft Visual Studio .NET with a simple user interface (optional).Proceed as describe previously except

Under Project Types select Visual C++CLRAlso select Windows Form Application under Visual Studio installed templates.You may have to specify “C" drive location to avoid a trusted user warning.A blank form will appear allowing you to drag gui elements onto it.

Page 44: Software errors:

Make the toolbox visible by selecting ViewtoolBox.Use the toolbox to drag and drop various gui elements onto the formExample: Create one button and textbox:

Put textBox1->Text = "0" in the form_load method. (You can get to this method by double clicking on the blank form)Put the following in the button_click method. (You can get to this method by double clicking on the button)

int t = Int32::Parse(textBox1->Text);t++;textBox1->Clear();textBox1->AppendText(t.ToString());

Page 45: Software errors:

We will NOT do much with GUI interfaces.Software often follows a 3-tier design as below. This course focuses on the middle tier.

Interface (GUI or console)

Program logic

Data (files or database)


Recommended