Abstraction and the General Case

In common speech, the adjectives “abstract” and “general” have connotations of vagueness, lack of substance, or unsuitability for real-life problems of one kind or another. (“His argument was rather abstract.” “That's too general a solution to apply to my situation.”)

In the realm of computer programming, however, abstraction and generalization have to do with some very nonvague habits of thought and program design.

To abstract” comes from a Latin root meaning “to pull or draw [something] away.” When you abstract from something, you pull or draw from it what you consider its essential, defining features. Abstract imagery works on this principle. A simple circle might represent a head, the sun, a coin, or the ...

Get Sams Teach Yourself Ruby in 21 Days now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.