Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I am teaching the course "Introduction in Programming" for the first-year students and would like to find interesting examples where the datatype size in bits, chosen by design, led to certain known restrictions or important values.

Here are some examples:

  1. Due to the fact that the Bell teleprinter used 7-bit-code (later accepted as ASCII) until now have we often to encode attachments in electronic messages to contain only 7 bit data.
  2. Classical limitation of 32-bit address space leads to the 4Gb maximal RAM size available for 32-bit systems and 4Gb maximal file size in FAT32.

Do you know some other interesting examples how the choice of the data type (and especially its binary length) influenced the modern IT world.

Added after some discussion in comments:

I am not going to teach how to overcome limitations. I just want them to know that 1 byte can hold the values from -127..0..+127 o 0..255, 2 bytes cover the range 0..65535 etc by proving examples they know from other sources, like the above-mentioned base64 encoding etc. We are just learning the basic datatypes and I am trying to find a good reference for "how large" these types are.

share|improve this question
    
The goal of designing "infinitely future-proof" technology is not achievable. Instead, we strive to design "intention-revealing code" and "self-describing data" so that the additional information (intention, and description) will ease the migration of code and data to their future formats. –  rwong Nov 19 '11 at 19:38
    
This is absolutely clear to me and to the students. The basic idea here is to get used to the 8-bit-pro-byte world and to get some overview of "how much data" one, two, four etc. byte structures may hold. –  Alexander Galkin Nov 19 '11 at 19:44
    
My suggestion is to look for examples which are contemporary with the students' age. That is, they may not fully appreciate the situation in old technologies, the price of RAM, etc. (At one point, a 64KB memory module is a separate enclosing outside the computer, made of hand-woven magnetic cores.) –  rwong Nov 19 '11 at 19:51
    
If you want to teach how to overcome the limitations, teach binary additions with carry, prefix code (needed to understand machine instructions), Unicode (an example of a coding scheme), and invite the students to design an ad-hoc coding scheme for fun. Touch on a little bit of "information" and "entropy". –  rwong Nov 19 '11 at 20:02
    
Maybe I formulated my question in a bit vague way: I am not going to teach how to overcome limitations. I just want them to know that 1 byte can hold the values from -127..0..+127 o 0..255, 2 bytes cover the range 0..65535 etc by proving examples they know from other sources, like the above-mentioned base64 encoding etc. We are just learning the basic datatypes and I am trying to find a good reference for "how large" these types are. –  Alexander Galkin Nov 19 '11 at 20:31

5 Answers 5

up vote 9 down vote accepted

IPv4 is a very good example where a limited spec size caused a very expensive problem down the line. 4.3 billion addresses just aren't enough anymore. Now ISPs around the world are desparately rolling out IPv6 with a 128-bit address space which translates into an address for every atom in your body or something like that.

share|improve this answer
1  
Yeah - Consider this: If there were 1 million addresses allocated every picosecond, it would take 10783127828133.15 years to consume them all. There are 2^128 addresses available with IPV6. In one second, there are 10^6 / 10^-12 addresses allocated (1 x 10^18). So (2^128) / ( (10^6) / (10^-12) ) = 340282366920938463463.37 seconds. Assuming there are 31,556,926 seconds in a year (according to google.com), this yields 10783127828133.15 years. Since this is older than the earth, we should be fine. –  Jack Nov 20 '11 at 0:08
    
@Jack the Y11T problem? :) –  rightfold Nov 20 '11 at 2:32
    
@Jack : until we aren't, we are going to lose a lot of address due to network segmentation. –  Wyatt Barnett Nov 20 '11 at 2:33

Here's a good jumping off point for one version, the "497 day bug."

share|improve this answer

The year 2000 problem was similar, except that people used decimal numbers instead of binary, and encoded just two last digits. This can be a useful example if explaining to someone who has little experience with binary.

FAT12/FAT16/FAT32 were adapted to cover for bigger and bigger storage.

TeX has some interesting properties when representing dimensions (from The TeXBook):

TEX represents all dimensions internally as an integer multiple of the tiny units called sp. Since the wavelength of visible light is approximately 100 sp, rounding errors of a few sp make no difference to the eye. [...]

TEX will not deal with dimensions whose absolute value is 2^30 sp or more. In other words, the maximum legal dimension is slightly less than 16384 pt. This is a distance of about 18.892 feet (5.7583 meters), so it won’t cramp your style.

(pt is a typographic unit approximately equal to 1/72 of inch)

share|improve this answer

Microsoft Excel - try to graph more than 32K items. There's got to be a signed 16 bit field in there somewhere. (although they round the limit down to 32000 even for some reason).

share|improve this answer

I just want them to know that 1 byte can hold the values from -127..0..+127 or 0..255, 2 bytes cover the range 0..65535 etc by proving examples they know from other sources, like the above-mentioned base64 encoding etc. We are just learning the basic datatypes and I am trying to find a good reference for "how large" these types are.

Your goal doesn't make much sense to me.

The sizes of these numbers / ranges should be self-evident to anyone with basic high school mathematics. You know ... how big is 1,000, how big is 1,000,000.

It sounds to me like you are looking to the IT equivalent of those pointless news media analogies: like where disc space is measured relative to the size of the Library of Congress, or weight is in multiples of "Full grown African Bull Elephants".

Treat your audience as intelligent people who are capable to thinking for themselves. A large percentage of them are. And don't cater for the mathematically illiterate. They shouldn't be doing your course in the first place.

share|improve this answer
3  
-1, Does not answer question, is unconstructive and argumentative. –  mattnz Nov 20 '11 at 5:46
    
1,000 is a decimal number one can easily imagine. We are talking about binary numbers and for beginner it is not easy to estimate how one byte is smaller than two bytes etc... –  Alexander Galkin Nov 20 '11 at 9:27
    
@Alaudo - umm ... are we talking about mathematically illiterate people again? Anyone with an ounce of mathematical intuition has a feel for how big 256 is and how much bigger X*256 is than X. They don't need dumbed down analogies for that. –  Stephen C Nov 20 '11 at 12:27
    
@StephenC: Sure, as long as they get used to it. But my students are not CS students, they study GES (General Engineering Sciences) and I can easily imagine they don't always remember how large one or two bytes are. That's why I am trying to find a good reference for them. –  Alexander Galkin Nov 20 '11 at 12:39
    
@Alaudo - at the risk of beating a dead horse, if they are doing engineering, you should be able to assume that they have enough maths common sense to be able to understand how big / small a number is. And if they can't memorize the powers of two up to 1024, there's something wrong with them. –  Stephen C Nov 20 '11 at 23:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.