CIS 15 - Advanced Programming Techniques Using C Professor Yedidyah Langsam
Download
Report
Transcript CIS 15 - Advanced Programming Techniques Using C Professor Yedidyah Langsam
CIS 15 - Advanced Programming
Techniques Using C
Professor Yedidyah Langsam
525NE
718-951-4161
[email protected]
icq: 10661149
AOL IM: BCCISProf
http://eilat.sci.brooklyn.cuny.edu
Required Texts
C Programming: A Modern Approach, King,
K. N., W. W. Norton & Co., 1996
Learning the UNIX Operating System, 4th
ed., Peek, J., et. al., O’Reilly, 1998
Data Structures Using C and C++, 2nd ed.,
Langsam, Y., et. al., Prentice-Hall, 1996
Supplementary Texts
The C Programming Language, 2nd ed.,
Kernighan, B. and Ritchie, D., PrenticeHall, 1988
Fun with Unix, Landy, S., Brooklyn College
Press
CIS 15 Class Notes, Langsam, Y.
Class Requirements
Midterm
Final
Programs (5-6)
30%
40%
30%
5 point penalty for each class day an
assignment is late.
Programs are to be an individual
effort.
Structured Programming Rules - 1
Code one statement per line
Use meaningful variables
Divide each program into functions
Each function should perform a
single task
Structured Programming Rules - 2
Use proper documentation
Each function must begin with a
comment
Avoid trivial comments - code should
read like English
Avoid clever code
Structured Programming Rules - 3
Use proper & consistent indentation
(3-5 spaces)
For functions - place { and } on
separate lines
For statements - place { on the same
line as the statement and line up the
} with the keyword
Structured Programming Rules - 4
Comment every }
Skip lines for clarity - but do not
double space
Separate all functions
Structured Programming Rules - 5
Use lowercase for all variables and
keywords
Use uppercase for all #defined
symbolic constants
Documentation - 1
Every program must begin with
complete documentation
Identification
–
–
–
–
–
Name
Instructor
Program number
Date submitted
Class & Section
Documentation - 2
Statement of Problem
Input & Output requirements
Algorithms used
Assumptions used and conditions
under which program will fail
Characteristics of C - 1
C is standardized (ANSI C)
C is ubiquitous
C is a low-level language
C is a small language
C is a permissive language
Characteristics of C - 2
Strengths
– Efficiency
– Portability
– Power
– Flexibility
– Standard Library
– Integration with UNIX
Characteristics of C - 3
Weaknesses
– C programs can be error prone
– C programs can be difficult to
understand
– C programs can be difficult to modify
Effective Use of C - 1
Learn how to avoid C pitfalls
Use software tools to make
programs more reliable (debuggers,
lint, etc.)
Take advantage of existing code
libraries
Effective Use of C - 2
Adopt a sensible and consistent set
of coding conventions
Avoid “tricks” and overly complex
code
Use ANSI C
Avoid non-portable features