Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.

Similar presentations


Presentation on theme: "Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design."— Presentation transcript:

1 Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design

2 Visual Basic.NET Programming: From Problem Analysis to Program Design2 Objectives Learn basic computer terminology and component architecture Explore the history of programming languages Recognize the similarities between programming languages and spoken languages Solve problems and develop algorithms

3 Visual Basic.NET Programming: From Problem Analysis to Program Design3 Objectives (continued) Identify basic object-oriented programming concepts Examine the benefits of the object-oriented approach

4 Visual Basic.NET Programming: From Problem Analysis to Program Design4 Understanding Basic Computer Terminology And Component Architecture Understand basic computer terms Fundamentals of how computer works Computer requires: Hardware Software

5 Visual Basic.NET Programming: From Problem Analysis to Program Design5 Understanding Basic Computer Terminology And Component Architecture (continued) Hardware –Physical components of computer Architecture –Arrangement of hardware components within computer

6 Visual Basic.NET Programming: From Problem Analysis to Program Design6

7 7 Understanding Basic Computer Terminology And Component Architecture (continued) Primary computer components: –Input/output devices –Memory Read-only memory (ROM) Random access memory (RAM)

8 Visual Basic.NET Programming: From Problem Analysis to Program Design8 Understanding Basic Computer Terminology And Component Architecture (continued) Primary computer components (continued): –Central processing unit Registers Arithmetic logic unit (ALU) Control unit Software –Computer programs that are executed by hardware

9 Visual Basic.NET Programming: From Problem Analysis to Program Design9 Exploring the History of Programming Languages Modern programming languages –Very powerful –Enable you to develop sophisticated applications with relative ease –Bear little resemblance to early counterparts HOWEVER, principal underpinnings remain unchanged

10 Visual Basic.NET Programming: From Problem Analysis to Program Design10 Machine Language Earliest programming languages Consist of only 0’s and 1’s Bit –Binary digit of either 0 or 1 –At machine level, computers only truly understand bits Bit patterns –Used to represent other pieces of information Example: characters

11 Visual Basic.NET Programming: From Problem Analysis to Program Design11 Machine Language (continued) Memory location –Can be represented as binary number using combination of bits

12 Visual Basic.NET Programming: From Problem Analysis to Program Design12

13 Visual Basic.NET Programming: From Problem Analysis to Program Design13 Assembly Language Provides one-to-one correspondence between each machine language instruction and a mnemonic Mnemonic –Word or character string that represents an instruction Requires writing set of single-step instructions Easier for people to read and write

14 Visual Basic.NET Programming: From Problem Analysis to Program Design14 Assembly Language (continued) Sample instructions: –CLR Clear the accumulator –ADD A Add the contents of memory location A to the accumulator –SUB G Subtract the contents of memory location G from the accumulator –STO E Store the contents of the accumulator in memory location E

15 Visual Basic.NET Programming: From Problem Analysis to Program Design15 Assembly Language (continued) Assembler –Translates mnemonics and memory location names into underlying machine code Program written for one computer architecture –Usually will not run on different computer architecture –Drawback of assembly language

16 Visual Basic.NET Programming: From Problem Analysis to Program Design16 High-level Languages Evolved due to needs for: –Portability –More expressive languages Easier to read, write, and maintain Less efficient in terms of: –CPU time –Memory

17 Visual Basic.NET Programming: From Problem Analysis to Program Design17 High-level Languages (continued) Compiler –Translate program to machine code Linker –Combines object code with other programs in class libraries Loader –Loads object code into memory –Executes program

18 Visual Basic.NET Programming: From Problem Analysis to Program Design18 High-level Languages (continued) Source code –Program written by programmer Class library –Collection of object files –Support features and functions of a high-level language

19 Visual Basic.NET Programming: From Problem Analysis to Program Design19

20 Visual Basic.NET Programming: From Problem Analysis to Program Design20 Learning a Programming Language Understand basic vocabulary Keywords –Words built into language –Also called reserved words Statements –Consist of: Keywords Identifiers Symbols

21 Visual Basic.NET Programming: From Problem Analysis to Program Design21 Learning a Programming Language (continued) Procedures –One or more related statements –Work together to perform specific task Modules –Self-sufficient group of related procedures –Can combine with other modules to create applications

22 Visual Basic.NET Programming: From Problem Analysis to Program Design22 Learning a Programming Language (continued) Syntax –Rules of language –Includes: Spelling Punctuation Grammar –Each programming language has own unique syntax and structure

23 Visual Basic.NET Programming: From Problem Analysis to Program Design23 Learning a Programming Language (continued) Syntax error –Mistake in program Violates language rules –Compiler checks for syntax errors

24 Visual Basic.NET Programming: From Problem Analysis to Program Design24 Learning a Programming Language Logic error –Mistake in program Executes and produces incorrect result –Also known as bugs –Not checked by compiler

25 Visual Basic.NET Programming: From Problem Analysis to Program Design25 Solving Problems and Developing Algorithms Computer programming is problem solving Problems solved by programs –Require inputs –Produce outputs Algorithm –Sequence of steps used to transform input(s) into desired output(s)

26 Visual Basic.NET Programming: From Problem Analysis to Program Design26

27 Visual Basic.NET Programming: From Problem Analysis to Program Design27 Solving Problems and Developing Algorithms (continued) Critical that programmers embrace problem- solving approach Before writing code, programmer must: –Understand problem at hand –Properly identify inputs and outputs –Develop transformation algorithm

28 Visual Basic.NET Programming: From Problem Analysis to Program Design28 Example 1-1: Creating a GPA Algorithm Set TotalPoints,TotalHours, and GPA equal to 0 For each course Get Grade and CreditHours Add CreditHours to TotalHours If Grade is an ‘A’, multiply CreditHours by 4 and add result to TotalPoints If Grade is a ‘B’, multiply CreditHours by 3 and add result to TotalPoints

29 Visual Basic.NET Programming: From Problem Analysis to Program Design29 Example 1-1: Creating a GPA Algorithm (continued) If Grade is a ‘C’, multiply CreditHours by 2 and add result to TotalPoints If Grade is a ‘D’, multiply CreditHours by 1 and add result to TotalPoints When no more courses If TotalHours is not 0, calculate GPA = TotalPoints/TotalHours

30 Visual Basic.NET Programming: From Problem Analysis to Program Design30 Solving Problems and Developing Algorithms (continued) Desk-checking: –Draw columns by hand that correspond to items in algorithm –Create set of test data –Step through algorithm –Record changing values for each item

31 Visual Basic.NET Programming: From Problem Analysis to Program Design31 Example 1-2: Desk-Checking the Algorithm

32 Visual Basic.NET Programming: From Problem Analysis to Program Design32 Example 1-2: Desk-Checking the Algorithm (continued)

33 Visual Basic.NET Programming: From Problem Analysis to Program Design33 Identifying Basic Object-oriented Programming Concepts Procedural programming –Defining set of steps to transform inputs into outputs –Translating steps into code Object-oriented programming –Defining collection of objects that work together to solve problem

34 Visual Basic.NET Programming: From Problem Analysis to Program Design34 Identifying Basic Object-oriented Programming Concepts (continued) Object-oriented programming languages: –Becoming more popular –Examples: Java VB.NET Object –Thing that has characteristics and behaviors

35 Visual Basic.NET Programming: From Problem Analysis to Program Design35 Identifying Basic Object-oriented Programming Concepts (continued) Attributes –Characteristics of an object Methods –Behaviors of an object Problem domain objects –Objects specific to problem being solved

36 Visual Basic.NET Programming: From Problem Analysis to Program Design36

37 Visual Basic.NET Programming: From Problem Analysis to Program Design37 Identifying Basic Object-oriented Programming Concepts (continued) Message –Asks object to invoke one of its methods Encapsulation –Attributes and methods of object are packaged into single unit –Do not need to know internal structure of object to send messages to it

38 Visual Basic.NET Programming: From Problem Analysis to Program Design38 Identifying Basic Object-oriented Programming Concepts (continued) Class –Defines what all objects of group have in common Instance –Specific member of group –Example: Cheeseburger is an instance of food class

39 Visual Basic.NET Programming: From Problem Analysis to Program Design39 Identifying Basic Object-oriented Programming Concepts (continued) Inheritance –Class of objects takes on characteristics of another class Extends them as necessary –Subclasses –Superclass

40 Visual Basic.NET Programming: From Problem Analysis to Program Design40

41 Visual Basic.NET Programming: From Problem Analysis to Program Design41 Identifying Basic Object-oriented Programming Concepts (continued) Polymorphism –Different objects can respond in own way to same message –Related to inheritance of methods

42 Visual Basic.NET Programming: From Problem Analysis to Program Design42 Examining the Benefits of the Object-oriented Approach Advantages: –Naturalness –Reusability OO approach still requires algorithm design: –To define methods of object

43 Visual Basic.NET Programming: From Problem Analysis to Program Design43 Summary Computer consists of: –Hardware –Software Programming languages: –Machine language –Assembly language –High-level languages

44 Visual Basic.NET Programming: From Problem Analysis to Program Design44 Summary (continued) Writing a program: –Understand problem –Develop algorithm –Desk-check –Write code Object-oriented programming –Defines a collection of objects that work together to solve a problem


Download ppt "Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design."

Similar presentations


Ads by Google