slides - Computer Science

advertisement
Abstraction in Computer
Science
Abstraction
• An abstraction is an intellectual device
to simplify, for the user, by eliminating
factors that are irrelevant to the key
idea.
Abstraction Example
• Driving a car – An example that the march
of technological progress is, at least in part,
a march toward greater and greater
abstraction.
Abstraction in Computer Science
• Much of the activity of computer science is
concerned with inventing abstractions that simplify
thought processes and system development and
data representation.
• Abstraction enables the
– ability to “forget the details”
– ability to separate “what” from “how”
• But there is still value in both understanding that
various abstractions exist and some basic
knowledge of those abstractions.
One Problem in CS
• Programs are complex.
– Windows XP: ~45 million lines of code
– Mathematica: over 1.5 million
Computer programming is easy, as long as the
programs are small. What's hard isn't the
programming, but the keeping track of details in
a huge program. The solution is procedural
abstraction .
Two Types of Abstraction in CS
• Procedural Abstraction (blocks in Scratch/BYOB)
– Function specification and parameterization
• Data Abstraction (sprites, strings, numbers in
Scratch/BYOB)
– What you can do with the data is separated from
how it is represented.
CS Abstraction Examples
• A document in a word processor program.
• Ordering concert tickets.
Why do we care?
• Sometimes abstractions hide details that can
cause users problems.
Download