CHAPTER 1: INTRODUCTION TO PROGRAMMING LANGUAGE AND JAVA
BRIEF HISTORY ON THE EVOLUTION OF MODERN PROGRAMMING
PROGRAMMING LANGUAGE
set of rules
words and symbols are used
form valid program statements
produces logically correct outputs
LEVELS OF PROGRAMMING LANGUAGES
1. Machine language
2. Assembly languages
3. High-level languages
4. Very high-level languages
5. Natural languages
THINGS THEY CONSIDERED IN MAKING PROGRAMMING LANGUAGES
EASE OF USE VS POWER
o understandability of programmer VS produce result with least resources possible
SAFETY VS EFFICIENCY
o discourages/prevent undesirable errors, ability to access only the memory location it is allowed to access VS
reliability, runtime speed and algorithm used.
RIGIDITY VS EXTENSIBILITY
o finding ways to work within constraints VS minimal constraints allows faster , intuitive, effective and
simpler solutions to difficult problems. (ie. Android vs Apple)
EVOLUTION OF PROGRAMMING LANGUAGES
Assembly - used to produce highly efficient programs, but it is not easy to learn or use effectively
BASIC (Beginner's All-purpose Symbolic Instruction Code) - was easy to learn, it wasn’t very powerful,
and its lack of structure made its usefulness questionable for large programs
FORTRAN (Formula Translation) - used to write fairly efficient programs for scientific applications,
it was not very good for system code
COBOL (Common Business-Oriented Language) - is a high-level programming language for business applications
PASCAL - a small, efficient language intended to encourage good programming practices using structured
programming and data structuring
C - structured programming
o Invented and first implemented by Dennis Ritchie in 1970s
o It was designed, implemented, and developed by real, working programmers
o The result was a powerful, efficient, structured language that was relatively easy to learn
**C is one of the world’s great programming languages, there is a limit to its ability to handle complexity. Once
the size of a program exceeds a certain point, it becomes so complex that it is difficult to grasp as a totality
**Object-oriented programming OOP is a software development methodology in which a program is
conceptualized as a group of objects that work together. OOP is a programming methodology that helps
organize complex programs through the use of inheritance, encapsulation, and polymorphism.
C++ (C with Classes)
- Invented by Bjarne Stroustrup in 1979
- blended the high efficiency and stylistic elements of C with the
object-oriented paradigm
**World Wide Web and the Internet would reach critical mass. This event would precipitate another
revolution in programming
JAVA (formerly Oak)
- conceived by James Gosling, Patrick Naughton, Chris Warth, Ed Frank, and Mike
Sheridan at Sun Microsystems, Inc. in 1991
- the primary motivation was the need for a platform-independent (that is, architecture-neutral)
language that could be used to create software to be embedded in various consumer electronic
devices, such as microwave ovens and remote controls
HOW JAVA CHANGED THE INTERNET
Applet - a special kind of Java program that is designed to be transmitted over the Internet and automatically
executed by a Java-compatible web browser
Security- Java achieved this protection by confining an applet to the Java execution environment and not allowing it
access to other parts of the computer
Portability- ability to run on virtually any computer connected to the Internet which is attained via bytecode and
JVM.
JAVA BUZZWORDS
Simple - easy for the programmers to learn and use effectively.
Secure -
Portable -
Object-oriented - object model in Java is simple and easy to extend, while primitive types, such as integers, are kept
as high-performance non objects.
Robust - virtually eliminates memory management mistakes and mishandled exceptional conditions problems by
automatic garbage collection and exception handling features.
Multithreaded - supports multithreaded programming, which allows you to write programs that do many things
simultaneously.
Architecture-neutral - “Write Once, Run Anywhere, any time, forever.”
Interpreted and High Performance - Java bytecode was carefully designed so that it would be easy to translate
directly into native machine code for very high performance by using a just-in-time compiler.
Distributed - designed for the distributed environment of the Internet because it handles TCP/IP protocols. Java also
supports Remote Method Invocation (RMI). This feature enables a program to invoke methods across a network.
Dynamic - Java programs carry with them substantial amounts of run-time type information that is used to verify
and resolve accesses to objects at run time. This makes it possible to dynamically link code in a safe and expedient
manner.
PROGRAM DEVELOPMENT
1. Write a program in a specific PL.
2. Translate into a form the computer can execute
3. Investigating and fixing any errors
PROGRAM EXECUTION
each CPU has a particular machine language
for a program to run it must be translated into a machine language
COMPILER – a software tool that translates source code into a specific machine language.
Source C file entered in the compiler
output is an Executable (.exe) file
THE JAVA TRANSLATION
JAVA compiler translates source code into bytecode
BYTECODE – a special representation that contains complete info of the operations that the computer is to
perform. It is contained in a .class file.
JVM (JAVA VIRTUAL MACHINE) – an interpreter that translates bytecode into machine language and
theexecutes it.
JVM and bytecode together makes JAVA portable & architecture-neutral.
Source code compiled into bytecode format and interpreted by different
JVMs.
SYNTAX AND SEMANTICS
1. SYNTAX – rules on how words and symbols can be put together to form valid statements
2. SEMANTICS – defines the meaning of statements.
TYPES OF ERRORS
1. COMPILE TIME ERRORS – syntax and basic errors
2. RUN-TIME ERRORS – occurs during program execution (ie. division by zero)
3. LOGICAL ERRORS – errors when the programs produces incorrect results
PROBLEM SOLVING
Understand the problem
Design a solution
Consider alternatives and refine the solution
Implement the solution
Test the solution