Programming II Block1

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 46

Programming II

Dr. Samuel Chris Quist


0243533599
[email protected]
Problem Solving and the Computer
• Programming is a Problem solving activity
• Four main ways of solving Problems
• Understand the problem
• Devise a plan
• Execute the plan
• Evaluate the solution

Samuel Chris Quist (PhD) 2


Solving Problems

• Algorithms
• An algorithm is an unambiguous step-by-step specification or instructions
of how to solve a class of problems.
• Algorithms can perform calculation, data processing, automated reasoning,
and other tasks.
• Each step of the algorithm consists of basic (or Primitive) operations the
System or computer understands and can perform
• Flowcharts : Graphical
• Pseudocode: Textual
3

Samuel Chris Quist (PhD)


Windows Applications with VB

• Windows Graphical User Interface


• Window  Form
• Toolbox of elements called Controls
• Text Box, Label, Check Box, Button, etc.
• Example
• Color program
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
Object Model
• Object  Noun
• Form and Controls
• Property  Adjective
• Color of a Form
• Method  Verb
• Move a Form
Object Model (cont.)
• Event  Occur 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
Dot Notation
• Used to reference object's properties and methods in code
• Object dot Property
• Form.Text, TextBox.Text
• Object dot Method
• Form.Hide( ), TextBox.Focus( )

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


• Button_Click, ListBox_TextChanged
Object Model Analogy
• Class = automobile
• Properties = make, model, color, year
• Object = each individual car
• Object is also an Instance of the automobile class
• Methods = start, stop, speedup, slowdown
• Events = pedal (gas, break) is pushed
Framework, Languages,
And Tools
VB C++ C# JScript J#

Common Language Specification

ASP.NET

Visual Studio.NET
Windows
Web Forms Web Services
Forms
Mobile Internet Toolkit

ADO.NET and XML

Base Class Library

Common Language Runtime

Operating System
Compilation And Execution
Compilatio
n Code (IL)
Source Language Assembly
Code Compiler Metadata

Native JIT
Code Compiler

Execution At installation or the


first time each
method is called
Visual Basic.NET
• Included in Visual Studio.NET
• Visual Basic (can also be purchased separately)
• C++
• C#
• .NET Framework
• Complete rewrite from VB Version 6
Visual Studio.NET Editions
• Academic
• Professional
• Enterprise Developer
• Enterprise Architect
Steps for Writing VB Projects
• Design/Define the User Interface
• Plan/Set the Properties
• Plan/Write the Code
• Test Run and Debug
VB Application Files
• One Solution File .sln
• Solution User Options File .suo
• Project Files .vbproj
• Project User Options File .vbproj.user
• Form Files .vb
• Resource File for the Form .resx
Visual Studio Environment
• Integrated Development Environment (IDE)
• Form Designer
• Editor for entering code
• Compiler
• Debugger
• Object Browser
IDE Main Window
• Toolbars
• Document Window
• Form Designer
• Solution Explorer
• Properties Window
• Toolbox
IDE Main Window
VB Toolbox
• Holds the tools you
place on a form
Visual Studio Help
• Extensive Help feature
• Includes Microsoft Developer Network library (MSDN)
• Entire reference manual
• Coding examples
Modes
• Design Time
• Run Time
• Break Time

“Look at the Title Bar”


Naming Rules

• Always use standard names for objects


• No spaces or punctuation marks
• 3 letter lowercase prefix identifies control type
• Button-btn
• Label-lbl
• Form-frm

• If multiple words capitalize 1st letter of each word


Recommended Naming Conventions for VB
Objects
Object Class Prefix Example
Form frm frmDataEntry
Button btn btnExit
Text Box txt txtPaymentAmount
Label lbl lblTotal
Radio Button rad radBold
CheckBox chk chkPrintSummary
Horizontal ScrollBar hsb hsbRate
Vertical ScrollBar vsb vsbTemperature
PictureBox pic picLandscape
ComboBox cbo cboBookList
ListBox lst lstIndegredients
Hello World Project Design the User Interface

lblMessage

btnPush

btnExit
Properties Window-Label1

Rename Label1
to lblMessage

1- 25
Project Property Page Dialog
Basic Principles of User-Centered Design
• Understand the underlying business functions:
• The interface designer must understand the underlying business functions and how the
system supports the individual, departmental, and enterprise goals
• A good starting point might be to analyze a functional decomposition diagram (FDD)
• FDD can provide a check list of user tasks that you must include in the interface design.
• Maximize graphical effectiveness:
• (GUI) uses graphical objects and techniques that allow users to communicate with the
system.
• A well designed GUI help users learn a new system rapidly, and work with the system
effectively.
• Profile the system users:
• a system analyst must understand user experience, knowledge, and skill levels.
• The interface should be flexible enough to accommodate novices as well as experienced
users
Basic Principles of User-Centered Design
• Think like a user:
• the designer must learn to think like a user and see the system through a
user’s eyes.
• The interface should use terms that are familiar to users
• Use prototyping:
• it is essential to construct models, and prototypes for a user approval.
• Then interface designer should obtain as much feedback as possible, as early
as possible.
• Design comprehensive interface:
• the user interface should include all tasks, commands, and communications
between the users and the information system.
Basic Principles of User-Centered Design

• Continue the feedback process:


• it is important to monitor system usage and user suggestions.
• You can determine if system features are being used as intended by observing and surveying
users
• Document the interface design:
• you should document all screen designs for latter use by programmers.
User Interface Design Guidelines

Good user interface design is based on eight basic principles


• Follow eight basic guidelines
1. Focus on basic objectives
2. Build an interface that is easy to learn and use
3. Provide features that promote efficiency
4. Make it easy for users to obtain help or correct errors
5. Minimize input data problems
6. Provide feedback to users
7. Create an attractive layout and design
8. Use familiar terms and images
User interface design guidelines
• Focus on basic objectives
• Facilitate the system design objectives, rather than calling attention to the interface
• Create a design that is easy to learn and remember
• Design the interface to improve user efficiency and productivity
• Write commands, actions, and system responses that are consistent and predictable
• Minimize data entry problems
• Allow users to correct errors easily
• Crate logical and attractive layout
User Interface Design Guidelines
• Build an interface that is
easy to learn and use
• Label clearly all controls,
buttons, and icons.
• Select only those images that
users can easily understand.
• Provide on screen
instructions that are logical,
concise, and clear.

In the example shown at the top of the figure, only one of


the control buttons has an obvious meaning. In the bottom
screen, the first message is hard to understand, but the
.bottom message is unmistakable
• Build an interface that is easy to learn and use
• Show all commands in a list of menu item, but dim
any commands that are not currently available.
• Make it easy to return to one or more levels in the
menu structure.
PROVIDE FEATURES THAT PROMOTE EFFICIENCY
• Organize tasks, commands, and functions in groups that resemble actual business
operations. You should group functions and submenu items in a multilevel menu
hierarchy, or tree

Tasks, commands, and functions should be organized in logical groups, such as


this menu hierarchy for a customer order tracking system
PROVIDE FEATUES THAT PROMOTE EFFICIENCY
• Create well grouped menu or lists or place the selections
used frequently at the top of the menu list.
• Provide shortcuts to experienced users to avoid multiple
menu levels.
• Use default values if the majority of values in field are the
same.
• Provide a fast find feature that displays a list of possibilities
as soon as users enter the first few letters.
• Use a natural language feature that allows users to type
commands or requests in normal English phrases.
• Make it easy for users to obtain help or correct
errors
• Ensure that Help is always available
• Provide user-selected Help and context-sensitive
Help
• Provide a direct route for users to return to the
point from where Help was requested
• Include contact information, such as telephone
number
• Require user confirmation before data deletion
• Provide an Undo key
A context-sensitive dialog box that is
• Highlight the erroneous part of a command and displayed if a user requests help while
allow the user to make correction without entering data into the ADVISOR ASSIGNED
field. Clicking the Close button returns the
retyping the entire command .user to the task
• Minimize input data problems
• Provide data validation checks
• Display event-driven messages and reminders, display an appropriate message
when it is time for the user to perform a certain task
• Establish a list of predefined values that users can click to select
• Predefined values prevent spelling errors, avoid inappropriate data in a field
• Build in rules that enforce data integrity
• Use input masks, which are templates or patterns that make it easier for users
to enter data.
• Provide feedback to users
• Display messages at a logical place on the screen
• Alert users to lengthy processing times or delays
• Allow messages to remain on the screen long enough for users to
read them
• Let the user know whether the task or operation was successful or
not
• Provide a text explanation if you use an icon or image on a control
button
• Use messages that are specific, understandable, and professional
• CREATE AN ATTRACTIVE LAYOUT AND DESIGN
• Use appropriate colors to highlight different areas of the screen;
avoid gaudy and bright colors.
• Use special effects like sound and animation carefully.
• Use hyperlinks that allow users to jump to related topics.
• Group related objects and information. Visualize the screen the
way a user will see it, and simulate the tasks that the user will
perform
• Screen density is important. Keep screen displays uncluttered,
with enough white space to create an attractive, readable design
• CREATE AN ATTRACTIVE LAYOUT AND DESIGN
• Display titles, messages and instructions in a consistent manner and
in the same general locations on all screens.
• Use consistent terminology. For example, do not use the terms
delete, cancel, and erase to indicate the same action.
• Ensure that commands will always have the same affect.
• Ensure that similar mouse actions will produce the same results
throughout the application
• Require the user to confirm data entry by pressing the ENTER key
or TAB key at the end of a fill in field, even if the data does not
completely fill the field.
• Use familiar terms and images
• Provide a keystroke alternative for each menu command, with easy to
remember letters, such as File, Exit
• Use familiar commands, such as Cut, Copy and Paste
• Avoid programmer terminology

• Provide a Windows look and feel in your interface design if users are familiar
with Windows-based applications
• User Interface Controls
• Menu bar: main menu options at the top of the screen
• Toolbar: conations icons or buttons that represent shortcuts for executing
common commands
• Command button
• Dialog box: allows users to enter information about a task that the system will
perform.
• Text box: can display messages or provide a place for user to enter data
• Toggle button: is used to represent on or off status , clicking the toggle button
switches to the other status
• User Interface Controls
• List box: displays a list of choices that the user can select
• Scroll bar: allows the user to move through the available choices.
• Drop-down list box: displays the current selection; when the user clicks the
arrow, a list of the available choices displays
• Option button, or radio button: represent groups of options. The user can
select only one option at a time; a selected option contains a black dot.
• Check box: is used to select one or more choices from a group.
• Calendar control: allows the user to select a date that the system will display
and store as a field value

43
Good Flow in a
Form
Bad Flow in a
Form

You might also like