Introduction To Computer Programming (CS141)
Introduction To Computer Programming (CS141)
Instructor’s Introduction
Email: uali@iba.edu.pk
Course Introduction
Course Schedule Tue/ Thu : Class: 2:30PM – 3:45PM , Lab: 4:00PM 5:15PM
This is the first and a foundation course towards a list of advance programming courses.
• It introduces fundamental problem-solving skills and algorithm development with the
help of a programming language.
• It covers topics like:
• Introduction to computers
• Introduction to programming languages
• Variables & Data Types
• Selection and Iteration Structures
• Flowchart Design & Pseudo-code Approach towards problem solving
• Methods and Recursive Methods
• Arrays and ArrayLists
• File I/O
• Elementary Graphics
• Exception Handling
• Debugging and Testing
• Many programming languages like C, C++, Java, Python etc. support the required
functionalities for this course.
1. Books
1. Java: How to Program- Early Objects(10th Edition) , Paul Deital, Harvey Deital
2. Java: The Complete Reference (10th Edition), Herbert Schildt , Oracle Press
2. Software
1. NetBeans IDE 8.2 (JDK 8u171 with NetBeans 8.2)
(http://www.oracle.com/technetwork/java/javase/downloads/jdk-netbeans-jsp-
142931.html)
3. Tutorials
1. Developing Applications with NetBeans IDE 8.0 (PDF)
2. Learn Java Programming – Tutorials Point
3. Sample Java Programs
4. Learn Java Online – No need of Software Installation
Marks Distribution
Unit -1
Getting Started
What is a Computer?
• A Computer is a device that can be instructed to carry out sequences of arithmetic or logical
operations automatically via computer programming.
• Computers are used as control systems for a wide variety of industrial and consumer devices.
• This includes simple special purpose devices like:
• Microwave ovens
• Remote controls,
• Factory devices such as industrial robots and computer-aided design
• And also general purpose devices like:
• Personal Computers
• Mobile devices such as smartphones.
• Hardware
• The term hardware covers all of those parts of a computer that are tangible physical objects. Circuits,
computer chips, graphic cards, sound cards, memory (RAM), motherboard, displays, power supplies,
cables, keyboards, printers and "mice" input devices are all hardware
• Software
• Software refers to parts of the computer which do not have a material form, such as programs, data,
protocols, etc.
• Software is that part of a computer system that consists of encoded information or computer
instructions, in contrast to the physical hardware from which the system is built.
• Computer software includes computer programs, libraries and related non-executable data, such as
online documentation or digital media.
Operating System
• An operating system is a software that communicates with the hardware and allows other
programs to run.
• It is comprised of system software, or the fundamental files your computer needs to boot up
and function.
• Every desktop computer, tablet, and smartphone includes an operating system that provides
basic functionality for the device.
• Examples of Desktop Operating Systems
• Windows OS
• Mac OS
• Linux OS
• Examples of Mobile Operating Systems
• Google’s Android OS
• Apple’s iOS
• Windows Phone 8
• BlackBerry OS
Language Translators
Compiler A translator program that translates an entire source code file into object code .
Interpreter A translator program that translates a source code file into object code one line at a time
Assembler A translator program that converts an Assembly language program into machine language.
C++ C++ is an extended version of C++ and was developed by Bjarne Stroustrup in early 1980’s. It is an
Object Oriented Programming Language.
Objective C Objective C is an Object Oriented language based on C developed in 1980’s. It was acquired by
Apple and now is the OS for all iOS powered devices like iPhones and iPads etc
Visual Basic Visual Basic was developed by Microsoft in 1990’s to develop Windows applications. Its latest
version like VB.net support OOP.
C# C# is an Object Oriented programming language developed by Microsoft. It is based on C++ and
java . It was developed to integrate internet and the web into computer applications.
PHP PHP is an open source Object Oriented language which is platform independent. It is a database
programming language and commonly used with MySQL which is an open source DBMS.
Perl Per is an Object Oriented web-based scripting language , was developed in 1987
Python Python is an open source Object Oriented language especially used for Data Science and Machine
Learning. It was developed in 1991.
Java Java is an Object Oriented language developed at Sun Microsystems by James Gosling in 1991. It is
platform independent mainly used for web and network programming.
Java- An Introduction
• Creation of Java was deeply rooted in the process of refinement and adaptation
that has been occurring in computer programming languages for the pas several
decades.
• When a computer language is designed , various trade-offs are made. E.g.
• Ease of use vs power
• Safety vs efficiency
• Rigidity vs extensibility
• Prior to C , three most common languages were COBOL, FORTRAN and BASIC
• BASIC was easy to use but not powerful and was not structured.
• FORTRAN was efficient for scientific applications but not very good for system
code.
• Assembly languages were very efficient for system programming but not easy
to understand
• Pascal was a structured language but not efficient failed to include some
features .
• So , prior to C language , all the available computer languages like FORTRAN,
COBOL, BASIC etc were not structured due to use of GOTO statements.
• Large programs in these languages were very complex to understand.
• No one language had reconciled these conflicting attributes.
• A simple text editor like notepad or Notepad ++ can be used to type / create a java
program.
• We can also use an IDE like NetBeans , Eclipse or Intellij IDEA for this.
• Save the program with .java extension.
• The name of the file must be same as the class name
• This file with .java extension that contains the java program is called the source
code.
Hello World!
Step 5- Execution
• During this phase, JVM translates Bytecodes into machine language the host
computer can understand
• JVM uses just-in-time (JIT) compilation i.e. compiling the code at run time
rather than as a preliminary step.
• JIT compiler searches for hot spots- part of the byte code that execute
frequently
• It compiles such hot spots only once – if encountered again it uses the faster
machine code
Step 5- Execution
Java Editions
• https://netbeans.org/kb/docs/java/quickstart.html