1 ENERGY 211 / CME 211 Lecture 26 November 19, 2008.

Slides:



Advertisements
Similar presentations
Chapter 11 Introduction to Programming in C
Advertisements

Chapt.2 Machine Architecture Impact of languages –Support – faster, more secure Primitive Operations –e.g. nested subroutine calls »Subroutines implemented.
Part IV: Memory Management
P5, M1, D1.
Programming Languages and Paradigms
Copyright © 2002 W. A. Tucker1 Chapter 1 Lecture Notes Bill Tucker Austin Community College COSC 1315.
1 Starting a Program The 4 stages that take a C++ program (or any high-level programming language) and execute it in internal memory are: Compiler - C++
Creating Computer Programs lesson 27. This lesson includes the following sections: What is a Computer Program? How Programs Solve Problems Two Approaches:
Documentation 1 Comprehending the present – Investing in the future.
CIS 101: Computer Programming and Problem Solving Lecture 8 Usman Roshan Department of Computer Science NJIT.
3/17/2008Prof. Hilfinger CS 164 Lecture 231 Run-time organization Lecture 23.
Chapter3: Language Translation issues
1 Introduction to Software Engineering Lecture 42 – Communication Skills.
CS1061 C Programming Lecture 3: The Programming Environment + Introduction to the Concept of an Algorithm A. O’Riordan, 2004.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
1 Lecture 5: MIPS Examples Today’s topics:  the compilation process  full example – sort in C Reminder: 2 nd assignment will be posted later today.
Introduction to Computer Programming CSC 1401: Introduction to Programming with Java Lecture 2 Wanda M. Kunkle.
CMP 131 Introduction to Computer Programming Violetta Cavalli-Sforza Week 1, Lab.
COP4020 Programming Languages
Chapter 24 - Quality Management Lecture 1 1Chapter 24 Quality management.
Computers: Software Patrice Koehl Computer Science UC Davis.
OOP Languages: Java vs C++
CS102 Introduction to Computer Programming
1 Chapter-01 Introduction to Computers and C++ Programming.
Chapter 3.1:Operating Systems Concepts 1. A Computer Model An operating system has to deal with the fact that a computer is made up of a CPU, random access.
Language Evaluation Criteria
P51UST: Unix and Software Tools Unix and Software Tools (P51UST) Compilers, Interpreters and Debuggers Ruibin Bai (Room AB326) Division of Computer Science.
Language Systems Chapter FourModern Programming Languages 1.
chap13 Chapter 13 Programming in the Large.
1 Computing Software. Programming Style Programs that are not documented internally, while they may do what is requested, can be difficult to understand.
Dale Roberts Procedural Programming using Java Dale Roberts, Lecturer Computer Science, IUPUI Department of Computer and.
Cosc 2150: Computer Organization
1 Comp 104: Operating Systems Concepts Java Development and Run-Time Store Organisation.
Programming With C.
CST320 - Lec 11 Why study compilers? n n Ties lots of things you know together: –Theory (finite automata, grammars) –Data structures –Modularization –Utilization.
School of Computer Science & Information Technology G6DICP - Lecture 9 Software Development Techniques.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
Silberschatz, Galvin and Gagne  2002 Modified for CSCI 399, Royden, Operating System Concepts Operating Systems Lecture 7 OS System Structure.
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 5: Software Design & Testing; Revision Session.
1 CISC181 Introduction to Computer Science Dr. McCoy Lecture 1 February 8, 2005.
Basic Semantics Associating meaning with language entities.
COP4020 Programming Languages Names, Scopes, and Bindings Prof. Xin Yuan.
Memory Management. Memory  Commemoration or Remembrance.
Chapter 4 Software. Chapter 4: Software Generations of Languages Each computer is wired to perform certain operations in response to an instruction. An.
FORTRAN History. FORTRAN - Interesting Facts n FORTRAN is the oldest Language actively in use today. n FORTRAN is still used for new software development.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
Introduction to OOP CPS235: Introduction.
Programming Language Concepts (CIS 635) Elsa L Gunter 4303 GITC NJIT,
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
CSCE 240 – Intro to Software Engineering Lecture 3.
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Eliminating External Fragmentation in a Non-Moving Garbage Collector for Java Author: Fridtjof Siebert, CASES 2000 Michael Sallas Object-Oriented Languages.
Lecture 3 Translation.
Visit for more Learning Resources
14 Compilers, Interpreters and Debuggers
Why study programming languages?
Types for Programs and Proofs
Programming Language Hierarchy, Phases of a Java Program
CSCI-235 Micro-Computer Applications
Compiler Construction
Introduction to the C Language
Coding Design, Style, Documentation and Optimization
Chapter 11 Introduction to Programming in C
Chapter 11 Introduction to Programming in C
CMP 131 Introduction to Computer Programming
ENERGY 211 / CME 211 Lecture 27 November 21, 2008.
Presentation transcript:

1 ENERGY 211 / CME 211 Lecture 26 November 19, 2008

2 Libraries Nearly all programs need external functions (e.g. Standard Library) Functions pre-compiled,.o files stored in libraries Static libraries (.a ) contain.o files that are linked with your code Shared libraries (.so or.dll ) are loaded into memory when needed –only one copy of code resides in memory –executable files are kept smaller –costs: functions calls slower, executable less portable due to library version differences

3 Interpreted Languages C, C++, FORTRAN are compiled languages: code is executed by hardware MATLAB, Lisp, Java are interpreted languages: code executed by other software (much slower!) Many interpreted languages provide compilers now, which generate object code Java instead uses a virtual machine to run intermediate code generated by its compiler, for portability (run slower, everywhere!)

4 Software Engineering Definition: the task of designing and implementing software Separate from designing algorithms A "just do it!" attitude is fine for small programs, but costly for large ones! Requires: –consideration of the user's perspective, which is very different from that of the programmer –coordination of many people playing diverse roles to make software successful –considerable patience and diligence –high tolerance for stress!

5 Software Life-cycle Software is eternal, and constantly evolving: –New features –Bug fixes –New hardware –Reliance on other software With car maintenance, for example, the design stays the same but the parts are updated With software maintenance, the design is updated and the "parts" remain the same This makes software maintenance high-risk!

6 Programming in the Large Requirements specification: what should the program do? What data structures should be used? (databases?) What libraries can be used? Will they be too constraining? How to divide up the work? Is the design modular enough for division? What language to use? Can it be used to communicate with other software? How portable should it be? What operating systems might it be run on?

7 Programming in the Small "Premature optimization of the root of all evil" (Donald Knuth) Don't optimize until you know you need to Compilers are very good at optimizing, so let them do their job! What you can do to help: –Temporal locality: nearby memory accesses in time should be to nearby locations in memory –Memory usage: try to re-use dynamically allocated memory, to cut down on memory leaks and overhead from allocating and de-allocating

8 Variable and Function Names For code based on mathematical algorithms, which use short (single-character) names, best to use same names For complex objects that don't have a mathematical representation, use longer, more descriptive names Some programmers prefix variable names with an indication of its type: int nNum, string sName, int *pnValue Use upper case for names that are #define d, or have mathematical upper case names

9 Style and Layout In languages such as C++, indentation is very helpful to for the reader to understand the structure of the program Always indent the body of a compound statement (anything between { }'s) Also indent single statements that belong to an if statement or loop Typical indentation is 4 spaces Use parentheses to make order of operations clear Avoid long lines of code; free-format rules allow going to next line without Matlab's ' … '

10 Next Time More on Software Engineering Programming in the Middle Interface Design Development Strategies Documentation Cross-Language Development Modularity