lecture30-apr15 - Lecture 30 Assignment 6 Q&A; due Friday...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Lecture 30 • Assignment 6 – Q&A; due Friday • Topics of the day – Introduction to C++ • The simple additions • OO capabilities (time permitting) C Std C (c89) C99 C++ Geneology of C C++ Std C (c89) Efficiency of C One of C’s strengths is the ability it gives programmers to write efficient programs. The right way to achieve efficiency: – Focus on choosing the right algorithms and data structures. – Use a profiler to find the program’s “hot spots”—sections of code that consume most of the program’s running time. – Once the hot spots have been identified, rewrite them for greater efficiency. The wrong way to achieve efficiency: – Condense code as much as possible. The gains from “micro-optimization” are small at best (perhaps a few percent) and are often offset by a decrease in readability and modifiability. Many of today’s compilers routinely perform the sort of optimizations that programmers used to do by hand. There’s nothing wrong with making code shorter; just be sure that the primary goal is clarity, not efficiency. What’s Wrong with C ? • It’s really a middle level language • Its not strongly typed • Its not machine independent • It has little run time error checking • bit twiddling is OK for systems programming and embedded systems, otherwise NOT useful • Not block structured, but function based • It does not support OOP • It places few restrictions on programmers • It has no graphical programming capability • Lots of other little nits that are annoying • It does not easily support certain key software engineering concepts; e.g. abstract data types Abstract Data Types A module that encapsulates a data structure has one disadvantage: there’s no good way to have multiple instances of the data structure. To accomplish this, we need a new data type; the users of the module can then define several variables of that type. When the details of a type’s implementation are hidden from
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/24/2010 for the course EE 312 taught by Professor Shafer during the Spring '08 term at University of Texas.

Page1 / 4

lecture30-apr15 - Lecture 30 Assignment 6 Q&A; due Friday...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online