Sie sind auf Seite 1von 36

Course Introduction.

Application
Development.
.NET
Rustam Vahidov
Philosophy
BTM 380

Introduction
Application Development Phases
Planning
Analysis
Understanding the required functionality

Design
Overall
Detailed

Implementation
Construction
Testing

Operation and Maintenance

Development Methodologies

Waterfall
Sequential: one phase has to be completed before next one
starts

Development Methodologies
Prototyping
Evolutionary
Build system in small increments
Evaluate and modify
The prototype evolves into the final system

Throwaway
When the users accept the prototype, scrap it and
start design and implementation of the system

Introduction into programming


A program is a set of instructions that a
computer follows to perform a task

Programs are commonly referred to as software


Without software, computers cannot do
anything

Programmers, or software developers,


create software

They are people with the training and skills


necessary to design, create, and test programs

This course introduces fundamental


programming concepts using C#

1.2 Hardware and Software


Hardware refers to all physical devices
A computer consists of many pieces of
hardware that all work together
Each piece of hardware does its own work

A typical computer system contains:

The CPU
Main memory
Secondary storage devices
Input devices
Output devices

The CPU
The central processing unit is the part that
actually runs programs
The most important part of a computer
Today CPUs are microprocessor
Commonly used CPU vendors are Intel and AMD

Main Memory
The computers work area
Where the computer loads instructions of
programs and data for processing
Commonly known as RAM, random-access
memory
Designed for CPUs to quickly access data stored
at any random location in the RAM

They are a volatile type of memory


When the computer is powered off, the contents
in RAM are erased

Organization of a Computer System

Input
Device

Central
Processing
Unit
Main
Memory

Output
Device

Secondary
Storage

Instructions and operations

Software
Categorized mainly into system
software and application software
System software are programs that control
and manage the basic operations of a
computer.
Application software are programs that
perform special tasks

How Computers Store Data


All data stored in a computer is converted to
sequence of 0s and 1s; each sequence is called a bit
A computers memory is divided into tiny storage
locations called bytes
Eight bits make a byte

Combinations of bits, 0s and 1s, are used to


represent characters. For example,
The character A is 65 in ASCII code, which is converted
to binary format 1000001
When you press A, 1000001 will be stored in
computers memory

How a Program Works


CPU reads instructions written in machine
language called instruction set
A program will be copied into memory for CPU
to execute
CPU uses the fetch-decode-execute cycle for
processing
Fetch: Reads instructions from memory
Decode: Decodes the instructions that were just
read to determine how to perform operations
Execute: Actually performs the operations

Programming Languages
Machine languages: sequences of 0s and 1s
Assembly languages: use short words known as
mnemonics to write program
Must be translated by assembler
Still considered low-level languages

High-level languages: more human readable


languages that allow programmers to create
programs without knowing how CPU works.
Modern languages are high-level

Language generations
1st

Written in native machine code


Cryptic, binary alphabet
Entered through setting switches on front panel
Targets a specific machine (CPU)
Fast
No longer used much

Language generations
2nd
Assembly languages
Based on mnemonics (abbreviated instructions)
Assemblers: translate into machine code, resolves
symbolic references into addresses
Today: limited to direct hardware manipulation,
performance critical uses

Example Assembly Code


Fragment (PDP-11)
mov r0,r3
mov r1,r2
mov r3,r4
mul r2,r4
mov r5,r1
mov r3,r4
add r2,r4
mul r2,r4

Language Generations
3rd

MUCH easier to understand


Fortran, Cobol, Basic, Algol, Pascal, PL/I etc.
Ex. A = B*C + D
Translators:
Interpreters
Compilers

Machine independence

Common Programming Languages


Visual Basic
Python
Javascript
Java

C#
C
C++
PHP

Computing Gross Pay


1.
2.
3.
4.
5.
6.
7.
8.

Display message: "How many hours did you work?"


Allow user to enter number of hours worked
Store the number the user enters in memory
Display message: "How much are you paid per hour?"
Allow the user to enter an hourly pay rate
Store the number the user enters in memory
Multiply hours worked by pay rate and store the result
in memory
Display a message with the result of the previous step
This well-defined, ordered set of steps for solving a
problem is called an algorithm

Keywords, Operators, and


Syntax
High level languages use keywords that have
special meaning and cannot be used for any
purpose other than to write programs
Operators are keywords that represent special
program functions such as addition,
subtraction, and multiplication
Syntax is a set of rules that must be strictly
followed to write computer-understandable
instructions
Syntax error is a mistake or violation of these rules

Each instruction in a program is called a


statement

Compilers and Interpreters


A compiler translates a high-level language
program to a separate machine program
for CPU to read and execute
Source code: the statements a programmer
writes in a high-level language
Compilation: translates a text-based source
code to binary codes

Interpreter reads, translates, and executes


the instructions of a high-level language
program
Examples are PHP, Perl, Python, and ASP.NET

Objects
Most programming languages use objectoriented programming in which a program
component is called an object
Program objects have properties (or fields) and
methods
Properties data stored in an object
Methods the operations an object can perform
Form object
Label objects

TextBox objects

Button objects

Controls
Objects that are visible in a program
GUI are known as controls
Commonly used controls are Labels,
Buttons, and TextBoxes
They enhance the functionality of your
programs

There are invisible objects in a GUI such


as Timers, and OpenFileDialog

The Program Development


Process
The process of creating a program is known
as the programming development cycle
It has six phases:

Understand the programs purpose


Design the GUI
Design the programs logic
Write the code
Correct syntax errors
Test the program and correct logic errors

Algorithm, Pseudocode,
Flowchart
An algorithm is a set of well-defined, logical
steps that must be taken to perform a task
An algorithm that is written out in plain
English is called pseudocode
A flowchart is a diagram that graphically
depicts the steps of an algorithm

Projects and Solutions


Each Visual Studio application (including
Visual C#) you will create is a project
A project contains several files.
Typically they are Form1.cs, Program.cs,
etc.

A solution is a container that can hold


one or more Visual Studio (including
Visual C#) projects Solution

Each project, however, is saved in its own


Files belonging to the project
solution

Project

History of Object-Oriented
Programming (OOP)
Simula (1961-1964, 1967)

Classes, subclasses, virtual procedures

Smalltalk (1971-1980)
Term OOP

C++ (1985)

Superset of C

Java (1995)

Platform-independence

C# (2001)
Python, Eiffel, PowerBuilder, VB,

.NET Overview

.NET features

Language integration (VB, C#,)


Common runtime engine
Base class library
Simplified deployment (no need to register a
binary in the registry)

.NET framework

Class library

Data access
Windows forms
Security
XML/SOAP
Threading
File I/O
Web Forms, etc.

Common Language Runtime

Execution environment
Memory management
Exception Handling
Garbage collection
Security Services

Common Language Runtime


(CLR)
Common Type System
Data types supported by the CLR: classes,
structures, interfaces, delegates, etc.
Core types: System.Int32, System.Object,

Common Intermediate language (CIL)


All .NET source code files translated into the same
language
Just-in-time (JIT) compiler, or Jitter

IL example
.method public static void Main() cil managed
{
.entrypoint
.custom instance void
[mscorlib]System.STAThreadAttribute::.ctor() = ( 01 00 00
00 )
// Code size 17 (0x11)
.maxstack 8 IL_0000: ldstr "About Visual Basic!"
IL_0005: call void
[mscorlib]System.Console::WriteLine(string)
IL_000a: call string
[mscorlib]System.Console::ReadLine()
IL_000f: pop
IL_0010: ret
} // end of method Module1::Main

How C# programs are run


Visual Studio .NET

.NET Framework

Integrated
Development
Environment

C#
compiler

Common
Language
Runtime

Solution

Assembly

Project
Intermediate Language (IL)
Source files
Class references