OOPortal OOPortal


Data Types  «Prev  Next»
Lesson 9

Number Text Storage Conclusion

This module discussed how a computer stores the numbers and text that are used in computer programs.
You now have the skills and knowledge necessary to:
  1. Explain how numbers are stored in binary and hexadecimal form
  2. Convert numbers between binary and decimal form
  3. Convert numbers between binary and hexadecimal form
  4. Explain how signed integers are stored in two's complement form
  5. Convert signed integers between decimal and two's complement form
  6. Explain how real numbers are stored as floating-point form
  7. Explain how characters are stored using ASCII and Unicode

Misconceptions About Compiler Quality

In the early days of the personal computer revolution, high-performance software was written in assembly language. As time passed, optimizing compilers for high-level languages were improved, and their authors began claiming that the performance of compiler-generated code was within 10 to 50 percent of hand-optimized assembly code. Such proclamations ushered the ascent of high-level languages for PC application development, sounding the death knell for assembly language. Many programmers began quoting numbers like my compiler achieves 90 percent of assembly's speed, so it is not practical to use assembly language.
The problem is that they never bothered to write hand-optimized assembly versions of their applications to check their claims. Often, their assumptions about their compiler's performance are wrong. The authors of optimizing compilers were not lying. Under the right conditions, an optimizing compiler can produce code that is almost as good as hand-optimized assembly language. However, the HLL code has to be written in an appropriate fashion to achieve these performance levels. To write HLL code in this manner requires a firm understanding of how computers operate and execute software.

Computer Science Structured Approach

Why Learning Assembly Language Is Still a Good Idea

When programmers first began giving up assembly language in favor of using HLLs, they generally understood the low-level ramifications of the HLL statements they were using and could choose their HLL statements appropriately. Unfortunately, the generation of computer programmers that followed them did not have the benefit of mastering assembly language. As such, they were not in a position to wisely choose statements and data structures that HLLs could efficiently translate into machine code. Their applications, if they were measured against the performance of a comparable hand-optimized assembly language program, would surely embarrass whoever wrote the compiler. Vetran programmers who recognized this problem offered a sagely piece of advice to the new programmers: If you want to learn how to write good HLL code, you need to learn assembly language. By learning assembly language, a programmer will be able to consider the low-level implications of their code and can make informed decisions concerning the best way to write applications in a high-level language

Why Learning Assembly Language Is not Absolutely Necessary

While it is probably a good idea for any well-rounded programmer to learn to program in assembly language, the truth is that learning assembly is not a necessary condition for writing great, efficient code. The important thing is to understand how HLLs translate statements into machine code so that you can choose appropriate HLL statements. One way to learn how to do this is to become an expert assembly language programmer, but that takes considerable time and effort, and it requires writing a lot of assembly code. A good question to ask is,
"Can a programmer just study the low-level nature of the machine and improve the HLL code they write without becoming an expert assembly programmer in the process?" The answer is a qualified yes. The purpose of this course, the second in a series, is to teach you what you need to know to write great code without having to become an expert assembly language programmer. In the next module you will learn the fundamental concepts of structured programming.