 |
Computer Program: A set of instructions for a computer. |
 |
Programming Language: A set of words, symbols, and codes and used by a
programmer following an associated grammar to specify a program. |
 |
What should your first programming language be?
 |
Your first programming language will imprint methods in your brain
that will carry over to other languages. It is important to choose
a language that will give you good patterns of thought that will serve
you for your career. C++ or Ada are best choices. Learning
C++ does not mean you know other languages as a subset. C++ gives
you good mental foundations with which to learn other languages.
J. Xavier Carteret suggested that it performs the function that Latin
provides with European languages. This is an excellent analogy. |
 |
The best text for learning C++ is Deitel & Deitel, C++, How to
Program, Prentice-Hall. Look for the most recent
edition. The 3rd edition is (c) 2001. [You should always
learn from the best books. If you think the best books are
expensive, try the cost of ignorance!] |
 |
Computer Science major: C++ |
 |
Information Science major: Cobol |
|
 |
Program Development Life Cycle
 |
Analyze problems |
 |
Develop solutions
 |
Specify program characteristics |
|
 |
Design programs |
 |
Coding |
 |
Testing |
 |
Documentation |
 |
Implementation |
 |
Maintenance |
 |
Performance evaluation |
|
 |
Bugs, Bugs, and More Bugs...
|
 |
Analyze Problem
 |
Review program specifications package |
 |
Meet with systems analyst and users |
 |
Identify each program's input, output, and processing
requirements. |
 |
Most of cost and schedule overruns are directly traceable to
basic concept flaws in the first planning stage! |
|
 |
Design
 |
Top-Down
 |
Characteristic of business and production engineering |
 |
Appropriate for problems that are well understood |
 |
Tree structure of modules |
|
 |
Bottom-Up
 |
Characteristic of research and development |
 |
Appropriate in areas requiring specialization |
 |
Appropriate in areas where overall problem is not well
understood |
|
 |
Algorithms
 |
David Berlinski, The Advent of the Algorithm : The Idea that
Rules the World, Mathematical Association of America
(2000), ISBN: 0151003386 |
|
 |
Structured Programming
|
 |
Proper Program Design (for most programs) Dijkstra (1976)
 |
No dead code (However, sometimes null code is inserted to
establish structure for later development.)
 |
Dead code can be code with no entry point. |
 |
Dead code can be a branch of a conditional transfer that is impossible
to satisfy. |
|
 |
No infinite loops
 |
Infinite loop can be code with no exit point. |
 |
Infinite loop can be a branch of a loop that must always
be satisfied. |
|
 |
One entry point |
 |
One exit point |
|
 |
Recursive Programming
 |
Example: Computation of Fibonacci numbers. {1, 1, 2, 3, 5, 8, 13,
21, 54, ...}
 |
F0 = 1, F1 = 1 |
 |
Fn = Fn-1 + Fn-2 |
|
 |
Conceptually easy solutions to hard problems. Usually very
inefficient use of computer resources. |
 |
Good application areas
 |
Translators. Therefore, Computer Science majors need to know
this. |
 |
Some sorting techniques. Therefore, Information Science majors
need to know this. |
|
|
 |
Real Time Program Design
 |
Interrupt handlers |
 |
Automatic control systems |
 |
Must complete a processing cycle at least as fast as a new
data batch is available for input. |
 |
Restriction of only one entry point and only one exit point
sometimes is impractical. |
 |
"Real Time" does not mean
"instantaneous". It is impossible to not have some
time delay, even if that delay is very small. |
|
 |
Design Tools
 |
Pseudo-code |
 |
Program flow chart (page 15.10) |
 |
Nassi-Schneiderman chart (page 15.11)
 |
Graphical method for implementing structured programming |
|
|
 |
Quality Review
 |
Syntax errors: compiler catches these |
 |
Strategic logic errors: from walk-through review |
 |
Program logic errors:
 |
desk check |
 |
design special test data |
|
|
|
 |
Code Programs
 |
Program Development Environments
 |
C++, Visual Basic |
|
 |
Documentation |
 |
Translate algorithm to code |
|
 |
Test, Test, Test !!!
 |
Debugging
 |
Divide and conquer |
|
 |
Debug utility:
 |
breakpoints |
 |
interpreter report of intermediate values |
 |
conditional report |
|
|
 |
Program Maintenance
 |
Corrections |
 |
Adding capability |
 |
Eliminating obsolete code |
 |
Maintaining compatibility with other software |
|
 |
Translators (Put list on board. Discuss while talking about
categories of programming languages.)
 |
A good source for additional information
is a text Aho and Ulman wrote on compiler theory for undergraduates which
is used in many large universities. |
 |
Assembler
 |
Translates assembly language into machine language. |
|
 |
Compiler
|
 |
Interpreter
 |
The defining characteristic of an interpreter is that it does
NOT
generate machine language instructions which the computer
then executes. |
 |
Some interpreters translate source code into an intermediate code
which then is interpreted.
 |
Many versions of BASIC |
 |
JAVA |
|
|
|
 |
Categories of Programming Languages
 |
Machine language
 |
Is the ONLY language a computer understands. |
|
 |
Assembly language
 |
Uses short mnemonics to represent atomic instructions. |
 |
Each machine language has a corresponding assembly language
instruction. |
 |
A macro-assembly language contains some instructions that generate
a set of machine language instructions. |
|
 |
Higher Level Languages:
 |
All languages except machine and assembly languages. |
 |
The first 3 higher level languages were: Lisp 1.5, Fortran, and
Cobol. |
 |
References
|
|
 |
Procedural language
 |
Fortran, Cobol |
 |
Structured programming language
 |
Block structure for defining scope of variables and labels |
 |
Example languages
 |
Algol |
 |
Pascal |
 |
PL/I: Developed by IBM in the 1960s to be a universal
computing language, combining the needs of the business and
scientific community. For a language description, see
VisualAge PL/I Language Reference Version 2.1, Second
Edition, GC26-9178-01 (April 1998). http://www-3.ibm.com/software/ad/pli/langref.pdf,
05 July 2002. |
|
|
 |
Object Oriented language
 |
C++ |
|
 |
Traditional languages (Fortran, Cobol) have evolved into structured
object-oriented languages by adding new forms and deprecating
old forms. |
 |
Type Setting Languages
 |
HTML, SGML, XML, TEX |
 |
Generally, these do not have a repetition control structure. |
 |
HTML does not have a selection or repetition control
structure. |
|
|
 |
Functional language
|
 |
Nonprocedural language
 |
Simulation languages: GPSS, CSMP |
 |
Statistical languages and packages: SAS, SPSS, BMD |
|
 |
Signal Flow Graph languages:
 |
LabView, PSpice: electrical engineering |
 |
I-DEAS: mechanical engineering |
 |
AutoCAD: engineering |
|
 |
Natural language
 |
Context-dependent |
 |
Incorporate previously undefined vocabulary |
 |
Incorporate previously undefined grammar |
|
|
 |
Object-Oriented Language Concepts
 |
Object: A data structure and accompanying procedure code for
manipulating that data. |
 |
Class: Definition of a generic object from which objects are
created or "instantiated".
 |
Base class |
 |
Derived class: usually has more features than base class. |
 |
Subclass, superclass |
 |
Inheritance: subclass inheriting
methods and attributes of parent class. |
|
 |
Procedures: called "methods",
"operations", or "behaviors" |
 |
Data: called "attributes" or "variables" |
 |
Abstraction: Ability to create an hierarchy of objects. |
 |
Encapsulation
 |
Combining procedures and data into a single object |
|
 |
Information Hiding
 |
Internal code and data structures from external
modules are not accessible to external code, except under
closely controlled circumstances. |
|
 |
Message: Procedure call for an object. |
|
 |
Unified Modeling Language |
 |
Popular Programming Languages
 |
There are now thousands of computer languages. There are only a few in
widespread use. Others are special purpose languages written to meet
special needs. |
 |
Basic: Beginner's All-purpose Symbolic Instruction Code
 |
Dartmouth Basic |
 |
TI-960 Basic: written by Samuel Belk at USC in 1971. |
 |
Visual Basic: Includes graphical programming aids to make
developing Windows GUIs easy. |
|
 |
Cobol: COmmon Business-Oriented Language.
This is the best language for business
applications. For many years, Cobol was a dying
language. It held on because of the huge number of working
programs already written in Cobol. Business is extraordinarily
slow in changing from methods that are working. In recent years,
Cobol has had new life breathed in it by absorbing concepts from
structured programming and object-oriented programming. Its
verbosity was due to a goal of making the language portable between
machines that were very different. |
 |
C: Structured programming language good for systems software
systems development, including translators and operating systems.
AT&T, Borland, and Microsoft. |
 |
C++: Object-oriented extension of C.
This is the premier language for programming
system software. This includes operating systems, network
software, and translators. While it can be used for numerical
applications, Fortran is better. While it can be used for business
programming, Cobol is better. |
 |
Fortran: Good for numerical applications,
best language for
serious science and engineering.
|
 |
Algol: Program language for scientific applications used in
Europe. First language with abstract data types. |
 |
Pascal: Structured programming language used in universities in
the 1970s - early 1990s. |
 |
Ada: Structured programming language that includes multitasking
and real-time interrupts. You can still get high
paying jobs to program in this language for defense
applications.
 |
Ada was intended to solve software
development problems associated with embedded processors for
defense systems applications. Its use was mandated by law for
DoD applications to reduce the life cycle cost of embedded system
software. |
 |
It was a computer
science dream language for its structure and use of abstract
syntax tree. |
 |
The computer scientists did not understand the needs of
engineers. Ada did not permit good control over precisely timed
interrupts or standardized computation involving complex
arithmetic, two extremely important requirements for embedded
processor applications for automatic control and signal
processing. Some of these problems have been fixed with Ada
9x, but perhaps too late to bring the language into wide spread
use. |
 |
This language is difficult language to learn and is slow to compile.
Even the force of law in DOD contracting and politically correct
evangelism to the public by its proponents did not produce
acceptance in the commercial world that DOD wanted. |
 |
http://www-users.cs.york.ac.uk/~andy/lrm95/toc.htm |
 |
C++ has stepped in to fill the needs Ada was intended to
satisfy. |
|
 |
RPG: Report Program Generator. Still in use because of the
huge economic investment by industry in legacy software. |
 |
CSMP, GPSS: System simulation programming languages. CSMP
is for continuous systems, GPSS is for discrete systems and was
often used in simulation of computer operating systems. CSMP
is used to study the performance of electrical power systems. |
 |
Assembly languages. Each processor
has its own assembly language. Assembly language is necessary for
applications that require speed or access to machine language
instructions that are not used by compilers of higher level
languages. C and C++ permit embedding of assembly language code. |
 |
Lisp 1.5: List Processing 1.5. Today, it is used for
rule-based artificial intelligence applications. It is the
language that Macsyma was originally written in. It is the
first example of an "extensible" language, which is a
language that can be extended by writing code in its own
language. A modern example of an extensible language is
LaTeX. Lisp 1.5 also is the first higher level language to
implement recursive programming. |
 |
Logo: A popular language used in
elementary schools to teach programming concepts to kids. If you
are going to be an elementary school teacher, you need to learn
Logo. It is a
subset of Lisp. Free at: http://www.softronix.com/logo.html
YOU might have fun with this! |
|
 |
Special Languages
 |
Typesetting Languages
 |
SGML: predates TeX as a language used by major book
publishers. |
 |
TeX: TeX was developed because Donald E. Knuth wanted
publication features not available from quality textbook
publishers.
 |
TeX overcomes problems in systems based on SGML. TeX
suffers from being a language that many find difficult to learn
and easy to use successfully. It is a powerful typesetting
language. |
 |
TeX and its derivative languages are particularly suitable for
typesetting material that requires a two-dimensional notation
and special symbol sets, such as in mathematics, physics,
chemistry, music, linguistics, and international languages. |
 |
TeX can very naturally accommodate Hebrew, Chinese, Arabic, Hieroglyphics,
and other languages with presentation structures different than
European languages. It can go top-down, right-to-left, or
in an outward spiraling circle... if you want. |
 |
There are several specialty word processors that use TeX as
the internal language (often hidden from the
author). |
 |
High quality technical graduate school departments give strong
preference to applicants that know TeX. This is
particularly true in mathematical sciences, physics, chemistry,
and engineering. Some require students to use TeX (or a
derivative language) in preparation of a thesis. Many
technical journals require use of TeX, LaTeX, AMSTeX, or RevTeX. |
 |
The music world has embraced MuTeX, MTeX, and other
variations, for typesetting music. Much work is done in
marrying MIDI instruments with musical adaptations of TeX to
support keyboard composition. There is a possibility that
it could also provide an opportunity for the reverse: providing
a way for using symbolic representation of musical score to
drive MIDI instruments. This would greatly compress
instrumental music files, and make it easy to change expression
of music from one instrument to another, or to a group of
instruments. |
|
 |
LaTeX, AMSTeX, RevTeX. These macros for Tex define
typesetting languages that produce consistent results that satisfy
many users with less need for manipulating details. These are
used in publication of computer science, engineering, science, and
mathematics texts and journals, and by major quality book
publishers. |
 |
MathML: an attempt by the HTML community to adapt Web based
publishing to the needs of the technical community. Unlike TeX,
MathML is not intended to be a language that authors would use
directly. Success of this approach is still
undetermined. Vendors of front ends of technical publishing
software want this approach because it makes the technical community
dependent on them. Some technical people will not mind, others
will revolt. The technical community is qualitatively
different than the business and liberal arts community. The
desire to control precision of symbolic expression is strong, and
vendors of word processors in the past have failed miserably, or
have produced second rate approaches that satisfied needs of
undergraduates, but not graduate level needs. One event that
may help MathML is that the author of TeX has ceased to support TeX
and has frozen its development. |
|
 |
Stanford Base SUIF Compiler Package (``basesuif''). SUIF is a framework for building large, complex compilers, targeted particular toward research in compiler algorithms. This package is
the core of the system. It contains a kernel, which supports the Stanford University Intermediate Format (file I/O, manipulation, etc.), and a toolkit consisting of passes and libraries for program transformation.
http://www.idiom.com/free-compilers/ECATEGORY/mathemat-1.html |
 |
The Optimizing SISAL Compiler. Sisal is a functional language aimed at parallel numerical and scientific programming.
http://www.llnl.gov/sisal |
|
 |
See “The Language List” at http://cui.unige.ch/langlist. |
 |
Program Development Tools
 |
Application Generator, Program Generator |
 |
Menu Generator |
|
 |
Macros, Macro Recorder
 |
Visual Basic for Applications
 |
Can be used with Excel, Word, PowerPoint, Access. |
 |
Allows access to objects (cells, worksheets, etc) associated with
application software. |
 |
Since Microsoft robbed us of Basic (which used to be distributed
with DOS), VBA is the only commonly available programming language
available on PCs unless you purchase one separately. |
|
|
 |
Rapid Application Development (RAD) Tools
 |
Visual Basic, Delphi, PowerBuilder |
|
 |
Web Page Program Development: See Chapter 2 lesson plan.
 |
HTML: An easy web browser formatting language. Most public high school graduates
know how to program HTML beginning with the Class of 1999. |
 |
HTML: Hypertext Markup Language
 |
The language used for Web page specification. |
 |
Most high school students know basic HTML before graduation. |
 |
XML will be replacing HTML over the next several years. |
|
 |
Script: an interpreted program that runs on a client. |
 |
Applet: a Java or JavaScript program that runs on a client Web
browser. |
 |
Servlet: an applet that runs on a server. |
 |
CGI: Common Gateway Interface: A message format standard that defines how a Web server
communicates environment and data. |
 |
Java, JavaScript, Perl: All are interpreted languages.
 |
Use Java Development Kit
 |
Stand-alone Java programs are called Java applications, not
applets. |
|
 |
JavaScript
 |
Does not support multithreading. |
|
|
 |
Dynamic HTML
 |
includes basic HTML |
 |
scripting languages |
 |
cascading style sheets (CSS) |
|
 |
XML: eXtensible Markup Language |
|
 |
Selecting a Programming Language or Program Development Tool
 |
Externally defined requirements or specifications. |
 |
Interface with other programs, or understand the details of
languages used.
 |
Issues: data format, call sequences, coordination. |
|
 |
Suitability of the language to the application. |
 |
Portability to other systems. |
|
 |
Developing Multimedia Applications
 |
Analysis |
 |
Design
 |
Project script |
|
 |
Production |
|
 |
Multimedia Preparation Software
 |
"Authoring" is a buzzword, and bad English. |
 |
Toolbook: click2learn.com, Inc. |
 |
Authorware: Macromedia |
 |
Director: Macromedia |
 |
Flash: click2learn.com, Inc. |
|