Download Introduction - Programming Using C Sharp - Lecture Slides and more Slides Advanced Algorithms in PDF only on Docsity!
IT 519
Introduction to Programming Using
C#
Gülşen Demiröz
Summary of the Course
• Introduction to programming and
algorithms
• We will learn how to develop object
oriented programs using the C#
programming language on Microsoft ® .NET
Platform
• We will also learn few classes from the
Microsoft ® .NET Framework Library as
needed
Example Algorithm - Find the minimum
- Initial list: 4 6 7 3 9 1 4 5
- Should we sort? 1 3 4 4 5 6 7 9
- The minimum is the first one
- Optimal algorithm - About n operations
- Pick 4 as the minimum
- Compare 4 to 6 - min is still 4
- Compare 4 to 7- min is still 4
- Compare 4 to 3 - Pick 3 as the minimum
- Compare 3 to 9- min is still 3
- Compare 3 to 1 - Pick 1 as the minimum
- Compare 1 to 4- min is still 1
- Compare 1 to 5 - We are done and the minimum is 1
Basic Program Development Steps
Analyze Problem
Develop Algorithm
Design Program
Write pseudo- code on paper
Code over the computer
Source Code
Compile & Build
Syntax Errors?
Yes
Correct it
No Run
Correct Results?
Yes - Done
No
Correct (Debug)
Programming Languages
- We solve problems with algorithms
- Then we use computers to run these algorithms
- For this, we need programming languages to interact with the computer’s hardware
- Computers represent data in numeric format
- Internal representation (at the lowest level) is in binary form: 0 and 1 (4=100, 5=101)
- 0 and 1’s are stored in a bit, 8 bits is called a byte
- Programs are set of instructions that process data
- These low level instructions are also in binary (0 and 1)
- machine language: not human readable and programmable!
- Rather than instruct computers at the level of 0’s and 1’s, higher level languages have been developed. - Flexible and easier programming
- Compilers translate a high level language, such as C , into machine-specific executable program (0 s^ and 1 s^ )
C, C++ and Java
- C first gained widespread recognition as the development
language of the UNIX operating system.
- C++ took the C language and provided capabilities for object-
oriented programming (OOP).
- Objects are reusable software components that model items
in the real world.
- Object-oriented programs are often easier to understand, correct and modify.
- Sun Microsystems began development of the Java
programming language in 1991.
- Java is now used to develop large-scale enterprise applications.
8
.NET Platform
- Provides programmers to develop their components in
any language and easily share them (old way: COM).
- Very rapid development with the help of already built-in
classes or platforms.
- Applications in any .NET-compatible language can interact
with each other.
- The .NET strategy allows programmers to concentrate on
their specialties without having to implement every
component of every application.
- End to DLL hell with versioning.
Compiling
code.cpp
Assembly language
Machine language .exe
C/C++
old languages
C#
.NET languages
compiling
code.cs
Intermediate Language (MSIL)
Machine language .exe
C# compiler
JIT compiler
code.vb
VB.NET compiler
Common Language Runtime (CLR)
Automatic Memory Management
- One of the services that the common language
runtime provides during Managed Execution.
- Allocation and releasing of memory is managed by the
CLR: Garbage collection.
Visual Studio 2008
• Fast Integrated Development Environment
(IDE)
• Very good user interface (UI) design
– easy to find compiler errors and debugging
• Heavy visual support to develop UI
• Let’s install it, detailed instructions on
course’s web site:
http://myweb.sabanciuniv.edu/gulsend/su_current_courses/it519/