9781285096261 ch01 PPT -...

49
1 Introduction to 1 Introduction to Computing and Programming 1 C# Programming: From Problem Analysis to Program Design 1 C# Programming: From Problem Analysis to Program Design 4 th Edition Chapter Objectives Learn about the history of computers Learn to differentiate between system and application software Learn the steps of software development E l diff i hdl i C# Programming: From Problem Analysis to Program Design 2 Explore different programming methodologies Learn why C# is being used today for software development

Transcript of 9781285096261 ch01 PPT -...

1

Introduction to1 Introduction to Computing and Programming1

C# Programming: From Problem Analysis to Program Design 1C# Programming: From Problem Analysis to Program Design

4th Edition

Chapter Objectives

• Learn about the history of computers

• Learn to differentiate between system and application software

• Learn the steps of software development

E l diff i h d l i

C# Programming: From Problem Analysis to Program Design 2

• Explore different programming methodologies

• Learn why C# is being used today for software development

2

Chapter Objectives (continued)

• Distinguish between the different types of applications

• Explore a program written in C#

• Examine the basic elements of a C# program

• Compile, run, build, and debug an application

C# Programming: From Problem Analysis to Program Design 3

• Create an application that displays output

• Work through a programming example that illustrates the chapter’s concepts

History of Computers

• Computing dates back 5,000 years

• Currently in fourth or fifth generation of modern computing

• Pre-modern computing

– Abacus

Pascaline (1642)

C# Programming: From Problem Analysis to Program Design 4

– Pascaline (1642)

– Analytical Engine (1830 – Charles Babbage & Lady Lovelace)

3

History of Computers (continued)

• First generation distinguished by use of vacuum t b ( id 1940 )tubes (mid-1940s)

• Second generation distinguished by use of transistors (mid-1950s)

– Software industry born (COBOL, Fortran)

• Third generation – transistors squeezed onto small

C# Programming: From Problem Analysis to Program Design 5

silicon discs (1964-1971)

– Computers became smaller

– Operating systems first seen

History of Computers (continued)

• Fourth generation – computer manufacturers brought computing to general consumersbrought computing to general consumers– Introduction of IBM personal computer (PC) and clones (1981)

• Fifth generation – more difficult to define– Computers accept spoken word instructions

– Computers imitate human reasoning through AI

– Computers communicate globally

C# Programming: From Problem Analysis to Program Design 6

Co pute s co u cate g oba y

– Mobile and wireless applications are growing

4

System and Application Software

• Software consists of programs

– Sets of instructions telling the computer exactly what to do

• Two types of software

– System

– Application

C# Programming: From Problem Analysis to Program Design 7

• Power of what the computer does lies with what types of software are available

System Software

• System software is more than operating systems

• Includes compilers, interpreters, and assemblers

• Operating System

– Loaded when you power on the computer

– Examples include Windows 8, Linux, Android, iOS

l d fil ili i i i f

C# Programming: From Problem Analysis to Program Design 8

– Includes file system utilities, communication software

5

Software (continued)

C# Programming: From Problem Analysis to Program Design 9

Figure 1-1 A machine language instruction

Application Software• Application/Productivity software performs a

specific taskp– Word processors, spreadsheets, payroll, inventory

• Uses high-level programming language– C#, Java, Visual Basic

• Compiler

C# Programming: From Problem Analysis to Program Design 10

– Translates instructions into machine-readable form

– First checks for rule violations

– Syntax rules – how to write statements

6

Software Development Process

• Programming is a process of problem sol ing• Programming is a process of problem solving

– How do you start?

– Number of different approaches, or methodologies

– Successful problem solvers follow a methodical h

C# Programming: From Problem Analysis to Program Design 11

approach

Steps in the Program Development Process

1 Analyze the problem1. Analyze the problem

2. Design a solution

3. Code the solution

4. Implement the code

C# Programming: From Problem Analysis to Program Design 12

5. Test and debug

7

Steps in the Program Development Process

(continued)• Software development process• Software development process

is iterative

• As errors are discovered, it is often necessary to cycle back to a previous phase or step

C# Programming: From Problem Analysis to Program Design 13

Figure 1-2 Steps in thesoftware developmentprocess

Step 1: Analyze the Problem

• Precisely what is software supposed to• Precisely what is software supposed to accomplish?

• Understand the problem definition

• Review the problem specifications

C# Programming: From Problem Analysis to Program Design 14

8

Analyze the Problem (continued)

15Figure 1-3 Program specification sheet - car rental agency problem

Analyze the Problem (continued)• What kind of data will be available for input?

• What types of values (i.e., whole numbers, alphabetic characters, andW ypes o v ues ( .e., , p , dnumbers with decimal points) will be in each of the identified data items?

• What is the domain (range of the values) for each input item?

• Will the user of the program be inputting values?

• If the problem solution is to be used with multiple data sets, are there

C# Programming: From Problem Analysis to Program Design 16

p p ,any data items that stay the same, or remain constant, with each set?

9

Analyze the Problem (continued)May help to see sample input for each data item

C# Programming: From Problem Analysis to Program Design 17

Figure 1-4 Data for car rental agency

Step 2: Design a Solution• Several approaches

– Procedural and object-oriented methodologiesocedu a a d object o e ted et odo og es

• Careful design always leads to better solutions

• Divide and Conquer– Break the problem into smaller subtasks

– Top-down design, stepwise refinement

C# Programming: From Problem Analysis to Program Design 18

• Object-oriented approach– Focus is on determining data and methods (behaviors)

10

Class Diagram

C# Programming: From Problem Analysis to Program Design 19

Figure 1-5 Class diagram of car rental agency

Design

• Object-oriented approach

• Class diagram

– Divided into three sections

• Top portion identifies the name of the class

• Middle portion lists the data characteristics

C# Programming: From Problem Analysis to Program Design 20

Middle portion lists the data characteristics

• Bottom portion shows what actions are to be performed on the data

11

Design (continued)

• Structured procedural approachP i d– Process oriented

– Focuses on the processes that data undergoes from input until meaningful output is produced

• Tools used– Flowcharts

– Pseudocode, structured English

C# Programming: From Problem Analysis to Program Design 21

• Algorithm written in near English statements for pseudocode

Design (continued)

• Example: Structured-English Algorithm APPROVE LOANIF customer has a Bank Account THENIF Customer has no dues from previous account THEN

Allow loan facilityELSE

IF Management Approval is obtained THENAllow loan facility

ELSEReject

ENDIFENDIF

C# Programming: From Problem Analysis to Program Design 22

ELSEReject

ENDIFEXIT

Source: https://en.wikipedia.org/wiki/Structured_English

12

Design a Solution (continued)• Algorithm

– Clear, unambiguous, step-by-step process for solving a problem, g , p y p p g p

– Steps must be expressed so completely and so precisely that all details are included

– Instructions should be simple to perform

– Instructions should be carried out in a finite amount of time

– Following the steps blindly should result in the same results

C# Programming: From Problem Analysis to Program Design 23

Algorithm:

How to bake a cake

24

Source: http://www.wiley.com/college/busin/icmis/oakman/outline/chap05/slides/algor.htm

13

Algorithm:

How to bake a cake

(version2)

25

Source: http://cset.sp.utoledo.edu/sample/engt1050/engt1050_flowchart.html

Algorithm:

How to play

Monopoly

(early draft)

26

Source: http://dbrodersen.com/wordpress/wp-content/uploads/2012/08/algorithm_lecture_2.pdf

Observe that this block requires further decomposition

14

Step 3: Code the Solution • After completing the design, verify the algorithm is correct

• Translate the algorithm into source code• Translate the algorithm into source code

– Follow the rules of the language

• Integrated Development Environment (IDE)

– Visual Studio: Tools for typing program statements, compiling, executing, and debugging applications

C# Programming: From Problem Analysis to Program Design 27

Step 4: Implement the Code • Source code is compiled to check for rule/syntax

violations

• C# → Source code is converted into Microsoft Intermediate Language (IL) – IL is between high-level source code and native code

– IL code not directly executable on any computer

– IL code not tied to any specific CPU platform

C# Programming: From Problem Analysis to Program Design 28

• Second step, managed by .NET’s Common Language Runtime (CLR), is required

15

Step 4: Implement the Code

Console.WriteLine("The sum of 50 and 30 is = " );

int result = 50 + 30;

Console.WriteLine(result);

Example: Add two numbers - From C# to IL. C#

//Add.il  ‐ Add Two Numbers

.assembly extern mscorlib {}

.assembly Add

{

.ver 1:0:1:0

}

.module add.exe

.method static void main() cil managed

{

.maxstack 2

.entrypointyp

ldstr "The sum of 50 and 30 is = "

call void [mscorlib]System.Console::Write (string)

ldc.i4.s 50

ldc.i4 30

add

call void [mscorlib]System.Console::Write (int32)

ret

}

Source: http://www.codeproject.com/Articles/3778/Introduction-to-IL-Assembly-Language29

Implement the Code(continued)

• CLR loads .NET classes

A d il ti ll d• A second compilation, called a just-in-time (JIT) compilation, is performed

• IL code is converted to the platform’s native code

C# Programming: From Problem Analysis to Program Design 30

Figure 1-6 Executionsteps for .NET

16

• Test the program to ensure consistent results

• Test Driven Development (TDD)

Step 5: Test and Debug

p ( )– Development methodologies built around testing

• Plan your testing – Test plan should include extreme values and possible problem

cases

• Logic errors

C# Programming: From Problem Analysis to Program Design 31

– Might cause abnormal termination or incorrect results to be produced

– Run-time error is one form of logic error

Programming Methodologies

• Structured Procedural Programming– Emerged in the 1970s

• Object-Oriented Programming– Newer approach (1990s)

C# Programming: From Problem Analysis to Program Design 32

17

Structured Procedural Programming

• Associated with top-down design– Analogy of building a house

– Write each of the subprograms as separate functions or methods invoked by a main controlling function or module

• Drawbacks – During software maintenance, programs are more difficult to

maintain

L t it t d

C# Programming: From Problem Analysis to Program Design 33

– Less opportunity to reuse code

Flowchart• Oval – beginning and end

• Rectangle – processesg p

• Diamond – decision to be made

• Parallelogram – inputs and output

• Flow line

C# Programming: From Problem Analysis to Program Design 34

Figure 1-7 Flowchartsymbols and their

interpretation

18

Pseudocode or Structured English

• Tool used to develop an algorithm

i i d d f• Steps written in pseudo or near code format– Combination English statements and the chosen programming

language

– Verbs like compute, calculate, sum, print, input, display are used

– Loops are shown with while or do while

– if and if/else used for decisions

C# Programming: From Problem Analysis to Program Design 35

36Figure 1-8 Pseudocode or Structured English for Rental Car application

19

Object-Oriented Programming

• Construct complex systems that model real-world entities

• Facilitates designing components

• Assumption is that the world contains a number of entitiesthat can be identified and described

C# Programming: From Problem Analysis to Program Design 37

Object-Oriented Methodologies• Abstraction

– Through abstracting, determine attributes (data) and behaviors ( th d t ) f th titi(processes on the data) of the entities

• Encapsulation– Combine attributes and behaviors to form a class

• Polymorphism– Methods of parent and subclasses can have the same name, but offer

different functionality

C# Programming: From Problem Analysis to Program Design 38

different functionality

– Invoke methods of the same name on objects of different classes and have the correct method executed

20

Class Diagram

C# Programming: From Problem Analysis to Program Design 39

Figure 1-9 Student class diagram

Evolution of C# and .NET

• Programming Languages1940 P l d i h h f f– 1940s: Programmers toggled switches on the front of computers

– 1950s: Assembly languages replaced the binary notation

C# Programming: From Problem Analysis to Program Design 40

Figure 1-10 Assemblylanguage instruction

to add two values

21

Evolution of C# and .NET

• Bare bone computer architecture (Intel 8080)

$3.95

41

Source visited on Aug-28-2015 http://www.tramm.li/i8080/Intel%208080-8085%20Assembly%20Language%20Programming%201977%20Intel.pdf

Evolution of C# and .NET

Early ComputersComputersHardwired programs

C# Programming: From Problem Analysis to Program Design 42

The U.S. Army built the first programmable electronic digital computer in the mid-1940s

LINKhttp://www.huffingtonpost.com/elliott-negin/dont-take-federal-science_b_4146736.html

22

Evolution of C# and .NET (continued)

• Late 1950s: High-level languages came into existence (Fortran Cobol)existence (Fortran, Cobol)

• Today: More than 2,000 high-level languages– Noteworthy general-purpose high-level programming languages

include: C, C++, Visual Basic, Java, C#, F#, JavaScript, PHP, Python …

C# Programming: From Problem Analysis to Program Design 43

.NET• Not an operating system

• An environment in which programs run

R id t l b t ti t d th• Resides at a layer between operating system and other applications

• Offers multi-language independence

• One application can be written in more than one language

• Includes over 2,500 reusable types (classes)

• Enables creation of dynamic Web pages and Web services

C# Programming: From Problem Analysis to Program Design 44

• Scalable component development

23

.NET (continued)

C# Programming: From Problem Analysis to Program Design 45

Figure 1-11 Visual Studio integrated development environment

Why C#

• One of the newer programming languages

• Conforms closely to C and C++ ( and Java)

• Has the rapid graphical user interface (GUI) features of previous versions of Visual Basic

• Has the added power of C++

• Has the object-oriented class libraries similar to Java

C# Programming: From Problem Analysis to Program Design 46

24

Why C# (continued)• Can be used to develop a number of applications

– Software components– Software components

– Mobile applications

– Dynamic Web pages

– Database access components

– Windows desktop applications

C# Programming: From Problem Analysis to Program Design 47

– Web services

– Console-based applications

C# Relationship to .NET

• Many compilers targeting the .NET platform are available

• C# was used most heavily for development of the .NET Framework class libraries

• C#, in conjunction with the .NET Framework classes, offers a suitable vehicle to incorporate and use emerging Web standards

C# Programming: From Problem Analysis to Program Design 48

25

C# Relationship to .NET (continued)

• C# is object-oriented

• In 2001, the European Computer Manufacturers Association (ECMA) General Assembly ratified C# and its common language infrastructure (CLI) specifications into international standards

C# Programming: From Problem Analysis to Program Design 49

Types of Applications Developed with C#

W b li i• Web applications

• Windows graphical user interface (GUI) applications

• Console-based applications

• Class libraries and stand-alone components (.dlls), smart device applications and services can also be created

C# Programming: From Problem Analysis to Program Design 50

device applications, and services can also be created

26

C# Architecture

Th k i i l i C#• The key organizational concepts in C# are: programs, namespaces, types, members, and assemblies.

– C# programs consist of one or more source files. Programs declare types, which contain members and can be organized into namespaces. Classes and interfaces are examples of types. Fields, methods, properties, and events are examples of members.

From: C# Language Specification 51

– When C# programs are compiled, they are physically packaged into assemblies.

– Assemblies typically have the file extension .exe or .dll, depending on whether they implement applications or libraries.

Web Applications

C# Programming: From Problem Analysis to Program Design 52

Figure 1-12 Web application written using C#

27

Web Applications (continued)

• C# was designed with the Internet applications in mind

• Can quickly build applications that run on the Web with C#

C# Programming: From Problem Analysis to Program Design 53

Windows Applications

• Applications designed for the desktop

• Designed for a single platform

• Use classes from System.Windows.Form

• Applications can include menus, pictures, drop-down controls, buttons, text boxes, and labels

• Use drag-and-drop feature of Visual Studio

C# Programming: From Problem Analysis to Program Design 54

28

Windows Applications (continued)

C# Programming: From Problem Analysis to Program Design 55

Figure 1-13 Windows application written using C#

Console Applications

• Normally send requests to the operating system

• Display text on the command console

• Easiest to create

– Simplest approach to learning software development

– Minimal overhead for input and output of data

C# Programming: From Problem Analysis to Program Design 56

a ove ead o put a d output o data

29

Output from the First C# Program

Console-based application

output

57

Figure 1-14 Output from Example 1-1 console application

Exploring the First C# ProgramFrom Example 1-1

line 1 // This is traditionally the first program written.

Comments in green

Keywords in blue

line 1      //  This is traditionally the first program written.

line 2      using System;

line 3      namespace HelloWorldProgram

line 4      {

line 5          class HelloWorld

line 6          {

line 7              static void Main( )

line 8              {

58

line 9                    Console.WriteLine("Hello World!");

line 10             }

line 11         }

line 12     }

30

Elements of a C# Program

• Comments

li 1 // hi i di i ll h fi i– line 1 // This is traditionally the first program written.

– Like making a note to yourself or readers of your program

– Not considered instructions to the computer

– Not checked for rule violations

– Document what the program statements are doing

C# Programming: From Problem Analysis to Program Design 59

Comments

• Make the code more readable• Make the code more readable

• Three types of commenting syntax

– Inline comments

– Multiline comments

C# Programming: From Problem Analysis to Program Design 60

– XML documentation comments

31

Inline Comments

• Indicated by two forward slashes (//)

• Considered a one-line comment

• Everything to the right of the slashes ignored by the compiler

• Carriage return (Enter) ends the comment

C# Programming: From Problem Analysis to Program Design 61

// This is traditionally the first program written.

Multiline Comment

• Forward slash followed by an asterisk (/*) marks the beginningthe beginning

• Opposite pattern (*/) marks the end

• Also called block comments

/* This is the beginning of a block multiline comment. It can go 

C# Programming: From Problem Analysis to Program Design 62

g g gon for several lines or just be on a single line. No additional symbols are needed after the beginning two characters. Notice there is no space placed between the two characters. To end the comment, use the following symbols. 

*/

32

XML Documentation Comments

• Extensible Markup Language (XML)– Markup language that provides a format for describing data using tags– Markup language that provides a format for describing data using tags

– Similar to HTML tags

• Three forward slashes (///) mark beginning

• Advanced documentation technique used for XML-style comments

• Compiler generates XML documentation from them

C# Programming: From Problem Analysis to Program Design 63

Compiler generates XML documentation from them

using Directive

• Permits use of classes found in specific pnamespaces without having to qualify them

• Framework class library

– Over 2,000 classes included

• Syntax

C# Programming: From Problem Analysis to Program Design 64

Syntax

– using namespaceIdentifier;

33

namespace

• Namespaces provide scope for the names defined within the group g p

• Groups semantically related types under a single umbrella

• System: most important and frequently used namespace

• Can define your own namespace

– Each namespace enclosed in curly braces: { }  

C# Programming: From Problem Analysis to Program Design 65

namespace (continued)

From Example 1-1p

line 1      //  This is traditionally the first program written.

line 2      using System;

line 3      namespace HelloWorldProgram 

line 4      {

line 12     }

Predefined namespace (System) – part of .NET FCL

C# Programming: From Problem Analysis to Program Design 66

User-defined namespace

Body of user-defined namespace

34

Class Definition

• Building block of object-oriented program g j p g

• Everything in C# is designed around a class

• Every program must have at least one class

• Classes define a category, or type, of object

• Every class is named

C# Programming: From Problem Analysis to Program Design 67

y

Class Definition (continued)

line 1      // This is traditionally the first program.

line 2      using System;

line 3      namespace HelloWorldProgram 

line 4      {

line 5          class HelloWorld

line 6          {

line 11         } User-defined

C# Programming: From Problem Analysis to Program Design 68

line 12     }class

35

Class Definition (continued)

• Define class members within curly bracese e c ass e be s w t cu y b aces

– Include data members• Stores values associated with the state of the class

– Include method members • Performs some behavior of the class

C# Programming: From Problem Analysis to Program Design 69

• Can call predefined classes’ methods

– Main( )

Main( ) Method

• “Entry point” for all applications

– Where the program begins execution

– Execution ends after last statement in Main( )

• Can be placed anywhere inside the class definition

• Applications must have one Main( ) method

C# Programming: From Problem Analysis to Program Design 70

• Begins with uppercase character

36

Main( ) Method Heading

line 7 static void Main( )( )

– Begins with the keyword static

– Second keyword → return type

• void signifies no value returned

– Name of the method

• Main is the name of Main( ) method

C# Programming: From Problem Analysis to Program Design 71

– Parentheses “( )” used for arguments

• No arguments for Main( ) – empty parentheses

Method Body − Statements

• Enclosed in curly braces

line 7     static void Main( )

line 8     {

line 9     Console.WriteLine("Hello World!");

line 10    }

I l d

C# Programming: From Problem Analysis to Program Design 72

• Includes program statements• Calls to other method• Here Main( ) calling WriteLine( ) method

37

Method Calls

line 9 Console.WriteLine("Hello World!");

• Program statements

• WriteLine() → member of the Console class

• Main( ) invoking WriteLine( ) method

• Method call ends in semicolon

C# Programming: From Problem Analysis to Program Design 73

Program Statements

• Write () → Member of Console class

– Argument(s) enclosed in double quotes inside ( )Argument(s) enclosed in double quotes inside ( )

– "Hello World!" is the method’s argument

– "Hello World!" is string argument

• May be called with or without arguments– Console.WriteLine( );

– Console.WriteLine("WriteLine( ) is a method.");

C# Programming: From Problem Analysis to Program Design 74

– Console.Write("Main( ) is a method.");

38

Program Statements (continued)

• Read() and ReadKey() accept one character from the input device

• ReadLine() accepts string of characters

– Until the enter key is pressed

• Write() does not automatically advance to next line

it (" l \ ")

C# Programming: From Problem Analysis to Program Design 75

• Write("An example\n");

– Same as WriteLine("An example");

– Includes special escape sequences such as \n

Escape Sequence Characters

C# Programming: From Problem Analysis to Program Design 76

Table 1-1 Escape sequences

39

C# Elements

C# Programming: From Problem Analysis to Program Design 77

Figure 1-15 Relationship among C# elements

Create Console Application

• Begin by opening Visual Studio• Begin by opening Visual Studio

• Create new project

– Select New Project on the Start page

– OR use File → New Project option

C# Programming: From Problem Analysis to Program Design 78

40

Create New Project

C# Programming: From Problem Analysis to Program Design 79

Figure 1-16 Creating a console application

Code Automatically Generated

80

Figure 1-17 Code automatically generated by Visual Studio

41

Typing Your Program Statements

• IntelliSense feature of the IDE

• Change the name of the class and the source code filename – Use the Solution Explorer Window to change the source code

filename

– Select View → Solution Explorer

C# Programming: From Problem Analysis to Program Design 81

Rename Source Code Name Clicking Yes causes the class name to also be renamed

C# Programming: From Problem Analysis to Program Design 82

Figure 1-18 Changing the source code name from Program

42

Compile and Run Application

• To Compile – click Build on the Build menu

• To run or execute application – F5 Start debugging (same as Start menu button)

– Ctrl +F5 Start without debugging

• Start option does not hold output screen → output flashes quickly

C# Programming: From Problem Analysis to Program Design 83

q y

– Last statement in Main( ), could add Console.Read( ); or ReadKey( );

Build Visual Studio Project

C# Programming: From Problem Analysis to Program Design 84

Figure 1-19 Execution of an application using Visual Studio

43

Debugging an Application

• Types of errors

– Syntax errors• Typing error

• Misspelled name

• Forget to end a statement with a semicolon

– Run-time errors

C# Programming: From Problem Analysis to Program Design 85

• Failing to fully understand the problem

• Unexpected data configuration

• More difficult to detect

Error Listing

C# Programming: From Problem Analysis to Program Design 86

Figure 1-20 Syntax error message listing

44

Creating an Application –ProgrammingMessage Example

C# Programming: From Problem Analysis to Program Design 87

Figure 1-21 Problem specification sheet for the ProgrammingMessage example

ProgrammingMessage Example

C# Programming: From Problem Analysis to Program Design 88

Figure 1-22 Prototype for the ProgrammingMessage example

45

ProgrammingMessage Example

• Pseudocode would include a singlePseudocode would include a single line to display the message "Programming can be FUN!" on the output screen

C# Programming: From Problem Analysis to Program Design 89

Figure 1-23 Algorithm for ProgrammingMessage example

ProgrammingMessage Example

C# Programming: From Problem Analysis to Program Design 90

Figure 1-24 Recommended deletions

Depending on your current settings, you may not need to make some of these changes

46

/*  Programmer: [supply your name]

*/

using System;

namespace ProgrammingMessage

ProgrammingMessage Example

namespace ProgrammingMessage

{

class ProgrammingMessage

{

static void Main( )

{

Console.WriteLine("Programming can be");

Complete program listing

C# Programming: From Problem Analysis to Program Design 91

Console.WriteLine( Programming can be );

Console.WriteLine("FUN! ");

Console.ReadKey( );    

}

}

}

Coding Standards

• Following standards l d t b tt l ti– leads to better solutions

– makes your code more maintainable

– saves you time when you go to modify your solution

• Developing standards that you consistently adhere to increases your coding efficiency

C# Programming: From Problem Analysis to Program Design 92

47

Coding Standards - Pseudocode Suggestions

• Use action verbs to imply what type of activities should be performedperformed

• Group items and add indentation to imply they belong together

• Use keywords like while or do while to imply looping

• Use if or if/else for testing the contents of memory locations

C# Programming: From Problem Analysis to Program Design 93

Resources

• C# Language Specifications –

http://www.microsoft.com/en-us/download/details.aspx?id=7029

• Visual C# 2015 Community Edition (Download) –https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx

• The MSDN Visual C# home page –https://msdn.microsoft.com/en-us/library/kx37x362.aspx

C# Programming: From Problem Analysis to Program Design 94

48

Chapter Summary

• Types of applications developed with C#yp pp p– Web applications

– Windows graphical user interface (GUI) applications

– Console-based applications

• Framework class library groups by namespaces– Namespaces group classes

C# Programming: From Problem Analysis to Program Design 95

– Classes have methods

– Methods include program statements

Chapter Summary (continued)• Programming methodologies

– Structured procedural

Obj t i t d– Object-oriented

• C# – One of the .NET managed programming languages

– Object-oriented

– 2001 ECMA standardized

C# Programming: From Problem Analysis to Program Design 96

– Provides rapid GUI development of Visual Basic

– Provides number crunching power of C++

– Provides large library of classes similar to Java

49

Chapter Summary (continued)

• Visual Studio includes .NET Framework– Editor tool, compiler, debugger, and executor

– Compile using Build

– Run using Start or Start without Debugging

• Debugging– Syntax errors

– Run-time errors

C# Programming: From Problem Analysis to Program Design 97

Chapter Summary (continued)

• Use five steps of program development to create li tiapplications

– 1. Analyze the problem

– 2. Design a solution

– 3. Code the solution

– 4. Implement the code

C# Programming: From Problem Analysis to Program Design 98

– 5. Test and debug