Chapter 1 - Introduction to Application Development

Embed Size (px)

Citation preview

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    1/41

    Chapter 1

    Introduction to

    ApplicationDevelopment

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    2/41

    Introduction to VB.NET 2

    Content

    1.1 Definition of Application.

    1.2 Application Development Process.

    1.3 Different Types of Application

    Development Tools.

    1.4 Introduction to Visual Basic.NET.

    1.5 The Visual Studio Environment

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    3/41

    Introduction to VB.NET 3

    1.1 Definition of Application

    also called end-userprogramsincludes database programs, word

    processors, and spreadsheets. applications software sits on top of

    systems software because it is unable

    to run without the operating systemand system utilities.

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    4/41

    Introduction to VB.NET 4

    1.2 Application DevelopmentProcess

    Performing a Task on the Computer

    Determine Output

    Identify Input

    Determine process necessary to turngiven Input into desired Output

    Program Planning Program Development Cycle

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    5/41

    Introduction to VB.NET 5

    Problem-solving: approach likealgebra class

    How fast is a car traveling if it goes 50miles in 2 hours?

    Output: a number giving the speed inmiles per hour

    Input: the distance and time the car

    has traveled

    Process: speed = distance / time

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    6/41

    Introduction to VB.NET 6

    Pictorial representation of theproblem solving process

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    7/41

    Introduction to VB.NET 7

    Program Planning

    A recipe is a good example of a plan

    Ingredients and amounts are determined bywhat you want to bake

    Ingredients are input

    The way you combine them is the processing

    What is baked is the output

    Program Planning Tips Always have a plan before trying to write a program The more complicated the problem, the more

    complex the plan must be

    Planning and testing before coding saves timecoding

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    8/41

    Introduction to VB.NET 8

    Program development cycle Software refers to a collection of instructions for the computer

    The computer only knows how to do what the programmertells it to do

    Therefore, the programmer has to know how to solve

    problems The Cycle are:

    Analyze:Define the problem.

    Design:Plan the solution to the problem.

    Choose theinterface:Select the objects (text boxes, buttons,

    etc.). Code:Translate the algorithm into a programming language.

    Testanddebug:Locate and remove any errors in the program.

    Complete thedocumentation:Organize all the materials thatdescribe the program.

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    9/41

    Software DevelopmentLifeCycle

    Introduction to VB.NET 9

    Waterfall Model in SDLC (Dix. 2004)

    Requirementsspecification

    Architecturaldesign

    Detaileddesign

    Implementationand Unit Testing

    Integration andtesting

    Operation andmaintenance

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    10/41

    Introduction to VB.NET 10

    1.3 Different Types of ApplicationDevelopment Tools

    Boolean C++

    VB 6

    ASP - Active Server Pages, a web-scriptinginterface by Microsoft

    PHP an open source programming language

    Dream Viewer

    Lotus Note Oracle

    Microsoft Access

    http://en.wikipedia.org/wiki/Active_Server_Pageshttp://en.wikipedia.org/wiki/Active_Server_Pages
  • 8/3/2019 Chapter 1 - Introduction to Application Development

    11/41

    Introduction to VB.NET 11

    1.4 Introduction to VisualBasic.NET

    Windows Graphical User Interface

    Window = Form

    Toolbox of elements called Controls

    Text Box

    Label

    Check Box

    Button

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    12/41

    Introduction to VB.NET 12

    Programming Languages

    Procedural

    Program specifies exact sequence

    Event Driven (VB 6.0 and previous)

    Object Oriented Programming (VB.NET)

    User controls sequence Click event

    Double Click event

    Change event

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    13/41

    Introduction to VB.NET 13

    Visual Studio .NET

    Included in Visual Studio .NET

    Visual Basic (can also be purchased

    separately) Visual C++

    C#

    J# .NET Framework

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    14/41

    Introduction to VB.NET 14

    Visual Studio .NET Editions

    Standard

    Professional

    Enterprise Developer Enterprise Architect

    Visual Basic.NET

    An object oriented language

    Object oriented programming terminology

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    15/41

    Introduction to VB.NET 15

    Object Oriented ProgrammingTerminology

    Object ==> Noun

    Form and Controls

    Property ==> Adjective

    Color of a Form

    Method ==> Verb

    Move a Form

    Event ==> Occurs when the user takes action User clicks a button, User moves a form

    Class ==> Template to create new object

    Each control added is an Instance of a Class

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    16/41

    Introduction to VB.NET 16

    Dot Notation

    Used to reference object'sproperties and events in code

    Object dot Property Form.Text, TextBox.Text

    Object dot Event

    Form.Hide( ), TextBox.Focus( )

    To reference an object's events usean underscore instead of a dot

    Button_Click, ListBox_TextChanged

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    17/41

    Introduction to VB.NET 17

    Object Oriented Analogy

    Class = automobile

    Properties = make, model, color, year

    Object = each individual car

    Object is also an Instance of theautomobile class

    Methods = start, stop, speedup,slowdown

    Events = car arrives, car crashes

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    18/41

    Introduction to VB.NET 18

    Writing Visual Basic Projects

    Planning Design Interface

    Plan Properties Plan Code

    Programming

    Create Forms and Controls Set Properties

    Write Code

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    19/41

    Introduction to VB.NET 19

    Open this file directly to work on a Project

    VB Application Files

    One Solution File .sln Solution User Options File .suo

    Form Files .vb

    Resource File for the Form .resx

    Project Files .vbproj Project User Options File .vbproj.user

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    20/41

    Introduction to VB.NET 20

    1.5 The Visual StudioEnvironment

    Integrated Development Environment(IDE)

    Form Designer

    Editor for entering code

    Compiler

    Debugger

    Object Browser

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    21/41

    Introduction to VB.NET 21

    Visual Studio IDE Start Page

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    22/41

    Introduction to VB.NET 22

    IDE Main Window

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    23/41

    Introduction to VB.NET 23

    New Project Dialog

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    24/41

    Introduction to VB.NET 24

    IDE Main Window

    Toolbars

    Document Window

    Form Designer

    Solution Explorer Window

    Properties Window

    Toolbox

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    25/41

    Introduction to VB.NET 25

    VB Toolbox

    Holds thecontrols you

    place on aform

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    26/41

    Introduction to VB.NET 26

    Visual Studio Help

    Extensive Help feature

    Includes Microsoft Developer Network

    library (MSDN)

    Entire reference manual

    Coding examples

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    27/41

    Introduction to VB.NET 27

    Modes

    Design Time

    Run Time

    Break Time

    Look at the Title Bar

    H ll W ld P j t

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    28/41

    Introduction to VB.NET 28

    messageLabel

    pushButton

    exitButton

    Hello World ProjectDesign the User Interface

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    29/41

    Introduction to VB.NET 29

    Properties Window-Label1

    Rename Label1to messageLabel

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    30/41

    Introduction to VB.NET 30

    Set the Properties

    Label Name messageLabel Text leave blank

    Button 1 Name pushButton Text Push Me

    Button 2 Name exitButton

    Text Exit Form

    Name helloForm Text Hello World by your name

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    31/41

    Introduction to VB.NET 31

    Set the Project's StartupObject

    The default startup object is Form1

    The name of the form should always

    be changed to adhere to naming rules

    Click on Project name in SolutionExplorer window, choose Project

    menu, Properties and change thestartup object to match the new formname

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    32/41

    Introduction to VB.NET 32

    Project Property Page Dialog

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    33/41

    Introduction to VB.NET 33

    Write Code

    While the project is running the user canperform actions

    Each action by the user causes an Event to

    occur

    Write code for the events you care about, theevents you want to respond to with code

    Code is written as event procedures VB will ignore events for which you do not

    write code

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    34/41

    Introduction to VB.NET 34

    ' Display the Hello World message.

    Remark Statement

    Also known as Comment, used fordocumentation

    Non-executable Automatically colored Green in Editor

    Begins with an apostrophe ( ' )

    On a separate line from executable code At the right end of a line of executable code

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    35/41

    Introduction to VB.NET 35

    Editor Window

    Declarations Section

    Class list

    Method list

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    36/41

    Introduction to VB.NET 36

    messageLabel.Text=" Hello World "

    Assignment Statement

    Assigns a value to a property or variable

    Operates from right to left

    Enclose text strings in quotation marks (" ")

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    37/41

    Introduction to VB.NET 37

    Ending a Program

    Execute the Close Method of the Form

    Methods always have parentheses

    (this will help you distinguish them fromProperties which never have parentheses)

    Current Form may be referenced as

    MeMe.Close( )

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    38/41

    Introduction to VB.NET 38

    Test and Debug

    Save Project - File Menu, Save All

    Run Project

    Debug Menu, Start

    Start (F5)

    Start Without Debugging(CTRL F5)

    Correct any Errors and Rerun

    Compile errors

    Run-Time Errors

    Logic errors

    Syntax errors

    "Help is always available from the

    Help Menu or by pressing F1."

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    39/41

    Introduction to VB.NET 39

    Object Class Example

    Form dataEntryForm

    Button exitButton

    TextBox paymentAmountTextBoxLabel totalLabel

    Radio Button boldRadioButton

    CheckBox printSummaryCheckBox

    Horizontal ScrollBar rateHorizontalScrollBar

    Vertical ScrollBar temperatureVerticalScrollBar

    PictureBox landscapePictureBox

    ComboBox bookListComboBox

    ListBox ingredientsListBox

    Recommended NamingConventions for VB Objects

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    40/41

    Introduction to VB.NET 40

    Naming Rules andConventions

    Have a set of standards and always followthem

    No spaces, punctuation marks or reservedwords

    Use camel casing

    Examples

    messageLabel exitButton

    dataEntryForm

    paymentAmountTextBox

  • 8/3/2019 Chapter 1 - Introduction to Application Development

    41/41

    The End Of

    Chapter 1