Smalltalk: an Introduction to Application Development Using
Total Page:16
File Type:pdf, Size:1020Kb
Contents i Contents Contents.........................................................................................................................i Preface.............................................................................................................................xi Typographical Conventions......................................................................................xi Trademarks...................................................................................................................xii Acknowledgements.....................................................................................................xii Chapter 1: What is Object–Oriented Programming?...........................................1 1.1. Objects................................................................................................................1 1.2. Messages............................................................................................................2 1.3. Classes and Instances......................................................................................4 1.4. Class Hierarchy................................................................................................5 1.5. Methods............................................................................................................7 1.6. Alternative Object–Oriented Programming Languages.........................8 1.6.1. Simula......................................................................................................8 1.6.2. Smalltalk..................................................................................................8 1.6.3. Eiffel..........................................................................................................9 1.6.4. C++............................................................................................................9 1.6.5. Objective–C.............................................................................................9 1.6.6. C+@...........................................................................................................10 1.6.7. Object Pascal............................................................................................10 1.6.8. CLOS.........................................................................................................10 1.6.9. Self.............................................................................................................10 1.6.10. Dylan.......................................................................................................10 1.7. The Advantages of Object–Oriented Programming................................11 1.8. Summary..........................................................................................................12 Chapter 2: Introduction to Smalltalk.......................................................................13 2.1. What is Smalltalk?.........................................................................................13 2.1.1. A Language..............................................................................................13 2.1.2. A Programming Environment...........................................................13 2.1.3. A Class Library........................................................................................14 2.1.4. A Persistent Object Store......................................................................15 2.2. Smalltalk Implementations.........................................................................15 2.2.1. Smalltalk–80...........................................................................................16 2.2.2. Smalltalk⁄V..............................................................................................17 2.2.3. SmalltalkAgents.....................................................................................17 2.2.4. VisualAge................................................................................................17 2.2.5. Smalltalk⁄X..............................................................................................17 2.2.6. Apple Smalltalk.....................................................................................18 2.2.7. Little Smalltalk.......................................................................................18 2.3. The Books.........................................................................................................18 2.4. Summary..........................................................................................................18 Chapter 3: Language Basics........................................................................................20 3.1. Smalltalk Expression Syntax........................................................................20 3.2. Literals...............................................................................................................20 3.2.1. Numbers..................................................................................................20 3.2.2. Characters................................................................................................21 3.2.3. Strings.......................................................................................................21 3.2.4. Symbols....................................................................................................21 Contents ii 3.2.5. Literal Arrays..........................................................................................21 3.2.6. Byte Arrays..............................................................................................21 3.3. Variables...........................................................................................................21 3.4. Pseudo–Variables............................................................................................22 3.5. Messages............................................................................................................22 3.5.1. Unary Messages......................................................................................22 3.5.2. Binary Messages.....................................................................................22 3.5.3. Keyword Messages.................................................................................23 3.6. Parsing Rules...................................................................................................23 3.7. Assignments....................................................................................................25 3.8. Returning.........................................................................................................26 3.9. Blocks.................................................................................................................26 3.10. Variables (again)............................................................................................26 3.11. Comments......................................................................................................27 3.12. Summary........................................................................................................27 Chapter 4: Getting Going with the User Interface.................................................28 4.1. Windows..........................................................................................................28 4.2. Menus, Prompters, etc...................................................................................29 4.3. The Mouse........................................................................................................29 4.4. Cursors..............................................................................................................30 4.5. Using VisualWorks........................................................................................31 4.5.1. Unix..........................................................................................................32 4.5.2. MS–Windows.........................................................................................32 4.5.3. Macintosh................................................................................................32 4.6. The Launcher...................................................................................................33 4.7. <Window> Button Menu Operations.......................................................35 4.8. The Window Menu.......................................................................................36 4.9. Help....................................................................................................................36 4.10. Summary........................................................................................................38 Chapter 5: Typing and Editing in Workspaces......................................................40 5.1. Introduction.....................................................................................................40 5.2. Typing and Selecting......................................................................................40 5.3. Editing...............................................................................................................45 5.4. Scrolling............................................................................................................48 5.5. Evaluating Smalltalk Code...........................................................................50 5.6. The Settings Tool............................................................................................54