Chapter One: Introduction In science fiction movie

Download Report

Transcript Chapter One: Introduction In science fiction movie

Instructor Introduction
Ajay Joshi,
Ph.D., D.F.T., Member IEEE
Brief:
Specialization : Parallel Computer Architecture Design & Development
Research & Lecturing :
A] Computer Architecture & Organization
B] Advanced Computer Architecture
C] Microprocessor / Microcontroller based Hardware &
Software design
D] Design of Application specific parallel architectures.
E] Embedded Systems
F] Computer Security & Disaster Recovery
G] Supercomputer Technologies.
H] Parallel processing/computing
ECNG 1009
Introduction to Programming
Aim and Objective:
To introduce the students to computers and teach them
basic programming skills prerequisite to the more
substantial programming subjects in the coming
semesters which are ultimately necessary to reach a
threshold level of competence in software engineering
and programming in the BSc degree in Electrical and
Computer Engineering.
Assessment Scheme
Group/ Individual assignment
Laboratory work
Mid semester exam
40%
30%
30%
Laboratory : Supervised lab sessions will be done in
computer lab. Lab Tutorials are mostly programming
tutorials, while a few involve application of theory in
paper exercises
Reading & Reference
Textbook
Deital & Deital, “C How to program”, 4th Edition,
Prentice Hall, 2004.[A1] [A1]Tentative
Reference Materials
1. Kernighan & Ritchie, “The C Language”,
2nd Edition, Prentice Hall, 1988.[A1]
2. Miller & Quilici, “Joy of C”, Wiley,
1993. [A1]1& 2 are tentative
Chapter One: Introduction
In science fiction movie thrillers, the characters talk with
their computers. Instead of keyboards and television
screens, these fictional computers have microphone "ears"
that understand spoken English, and electronic voices that
sound perfectly natural. Put one of these computers on
wheels, or give it legs, and you have the perfect electronic
companion: a robot that is easy to use and travels with you
to the ends of the universe. You are not likely to find one of
these on the shelves of your local electronics store. Not
yet, anyway.
The real computers of today are increasingly powerful.
While they have not yet caught up with the movies, they
are making great progress in voice recognition, vision,
and speech.
Every few months a new machine or a new program
appears that can do things never done before. We now
have encyclopedias on personal computers. When you
look up a subject you can see a short video and listen to
an explanation.
Other computers create an electronic world that you see
through special video glasses and touch with an
electronic glove. Coming soon will be tiny machines that
use light beams instead of electricity and perform tens of
thousands of functions at the same instant.
Even with these exciting prospects, we are not anywhere
close to the limit of what can be done.
The future of computing can be stated in
three words: smaller, faster, and cheaper.
With computers popping up all over, you
might as well learn how they work; and
since you cannot yet just talk it over with
your machine, you will have to begin at a
keyboard. Fortunately, computers are not
magic. They DO have a language of their
own, but it can be learned step-by-step.
In the next few chapters you will how to
make it do what you want it to.
PROGRAMMING
A computer language is a set of commands or
statements that make sense both to a computer and a
human. The BASIC computer language is one of many
languages for getting a computer to do what we want.
BASIC is a great language for beginners. Its simplicity
makes it easy to remember. It is also powerful, which
means that it can make the computer do a great variety
of tasks. Don't be scared by the word language.
Learning the BASIC language is a lot simpler than
learning most spoken languages. Remember our
definition of a computer language. It is supposed to
make sense to the human, too.
So, Let us see what exactly is programming
What is Programming?
Programming is a creative process done by
programmers to instruct a computer on how to
do a task. Hollywood has helped instill an image
of programmers as wizard techies who can sit
down at a computer and break any password in
seconds or make highly tuned warp engines
improve performance by 500% with just one
tweak. The reality is far from what we see in
films!
Definition of Program
What is a Programming Language?
What is Software?
So Programming is Boring? No
Computers can be programmed to do interesting
things. In the UK, a system has been running for
several years that reads car number plates. The
car is seen by a camera and the image captured
then instantly processed so that the number
plate details are extracted, run through a
national car registration database of number
plates and any stolen vehicle etc alerts for that
vehicle flagged up within four seconds.
With the right attachments, a computer could be
programmed to perform dentistry. Testing that
would be interesting and might be a bit scary!
Older computers, generally those with black and
white displays and no mouse tend to run
console applications. There are still plenty of
these about, they are very popular for rapid data
entry.
The other type of applications require a mouse
and are called GUI programs or event driven
programming. These are seen on Windows PCs,
Linux PCs and Apple Macs. Programming these
applications is a bit harder than for console but
newer programming languages like these have
simplified it.
Visual Basic
Delphi
C# etc…….
What Do Programs Do?
Fundamentally programs manipulate numbers and text.
These are the building blocks of all programs.
Programming languages let you use them in different
ways, eg adding numbers, etc, or storing data on disk for
later retrieval.
These numbers and text are called variables and can be
handled singly or in structured collections. Variables hold
payroll details for an employee such as
–
–
–
–
–
Name
Salary
Company Id Number
Total Tax Paid
SSN
A database can hold millions of these records and fetch
them very rapidly.
Programs Must Be Written for an Operating System
Programs don't exist by themselves but need operating
system, unless ‘they are the operating system! ‘
Win 32
Linux
Mac OS
Before Java, programs needed rewriting for each
operating system. A program that ran on a Linux box
could not run on a Windows box or a Mac. With Java it is
now far easier to write a program once then run it
everywhere as it is compiled to a common code called
bytecode which is then interpreted. Each operating
system has a Java interpreter, called a Java Virtual
Machine (JVM) written for it and knows how to interpret
bytecode. C# has something similar.
Programs Use Operating Systems Code:
Unless you're selling software and want to run it
on every different operating system, you are
more likely to need to modify it for new versions
of the same operating system. Programs use
features provided by the operating system and if
those change then the program must change or
it will break.
For example , many applications written for
Windows 2000 or XP use the Local Machine
part of the registry. Under Windows Vista this will
cause problems.
Computers Can Talk To Other Computers:
When connected in a network, they can even run
programs on each other or transfer data via ports.
Programs you write can also do this. This makes
programming a little harder as you have to cope with
situations like
When a network cable is pulled out.
Another networked PC is switched off.
Some advanced programming languages let you write
programs that run their parts on different computers. This
only works if the problem can use parallelism. Some
problems cannot be divided this way
Programming Peripherals attached to your Computer:
If you have a peripheral, say a computer controlled video
camera, it will come with a cable that hooks it up to the
PC and some interfacing software to control it. It may
also come with
API Application peripheral interface
SDK Software development kit
that lets you write software to control it. You could then
program it to switch on and record during the hours
when you are out of the house. If your PC can read
sound levels from the microphone then you might write
code that starts the camera recording when the sound
level is above a limit that you specified. Many peripherals
can be programmed like this.
Games Are Just Programs:
Games on PCs use special libraries :
on PCs use special libraries :
DirectX
XNA
SDL
So they can write to the display hardware very rapidly.
Games screens update at over 60 times per seconds so
3D games software has to move everything in 3D space,
detect collisions etc then render the 3D view onto a flat
surface (the screen!) 60 times each second. That's a
very short period of time but video card hardware now
does an increasing amount of the rendering work. The
GPU chips are optimized for fast rendering and can do
these operations up to 10x faster than a CPU can, even
with the fastest software.
Conclusion:
Many programmers write software as a creative
outlet. The web is full of websites with source
code developed by amateur programmers who
did it for the heck of it and are happy to share
their code. Linux started this way when Linus
Torvalds shared code that he had written.
The intellectual effort in writing a medium sized
program is probably comparable to writing a
book, except you never need to debug a book!
There is a joy to finding out new ways to make
something happen, or solving a particularly
thorny problem. If your programming skills are
good enough then you could get a full-time job
as a programmer.