Smalltalk and Object-Oriented Programming Concepts
Background
Object-oriented programming is a Solution to Complexity
With a small number of independent parts, it gives Simplicity and Generality which make system easy to learn, productive and maintainable.
Complex systems are hard to build with conventional programming languages. Object-oriented programming is an approach in which software organization corresponds closely to the system being simulated. When one supplants conventional procedure calls with the more general mechanism of sending messages, it greatly enhances the flexibility and reusability of software components
Evolution
Process
- Machine instructions
- Formulas BASIC, symbolic instruction, programming language start uses symbols, or mnemonics, for expressing operations and operands.
- Procedures Lib, kit
- Structured programming Structured programming is a programming paradigm aimed at improving the clarity, quality, and development time of a computer program by making extensive use of the structured control flow constructs of selection (if/then/else) and repetition (while and for), block structures, and subroutines.
Data
- Memory cells
- Variables
- Data Structure
- Abstract Data Type
Modularity
Principle
If any part of a system depends on the internals of another part, then complexity increases as the square of the size of the system.
Smalltalk
- Object An instance of some class
- Class Defines behavior of instances
- Selector Name of a message(member method signature)
- Message Selector with param values
- Method Code found in class for responding to message(member method implementation)
Remaining problems
- Must write each class from scratch
- Many copies of same code
Solution
Using more Simpler and general classes, and use the Inheritance.
Automatic Storage Management
Code should not be cluttered with irrelevant statements that may even be inaccurate.
Essential Characteristics
- Uniform reference everything is an object
- Uniform access only messages
- These guarantees Simulation
Contexts
An Object form of stack frame Can read temporary variables Single-step Make simple debugger. simulator
Exceptions
when a message not understood