1 / 22

Smalltalk Primer Session

Smalltalk Primer Session. skrishnamachari: LFY article + slides print out Paper + pencil for notes taking Marker Feedback forms Try networking 2 systems. Sudhakar Krishnamachari Cincom Systems Pvt Ltd December 2004. Projects: Software or any other A Typical Scenario….

sugar
Download Presentation

Smalltalk Primer Session

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Smalltalk Primer Session • skrishnamachari: • LFY article + slides print out • Paper + pencil for notes taking • Marker • Feedback forms • Try networking 2 systems Sudhakar Krishnamachari Cincom Systems Pvt Ltd December 2004

  2. Projects: Software or any other • A Typical Scenario…. • Changing or undefined • Customer requirements • Incomplete effort at Design • stage • Not so perfect execution • Time overruns • Cost overruns • Customer dissatisfaction • And so on…. Tools herein are only aids to experience, process and commitment What is Smalltalk….?

  3. Session Contents: • Introduction to Smalltalk: upto Slide 16 1 hour… • Ease of learning Smalltalk and OOPS through Smalltalk 5 min.. • Delivering Value in Smalltalk: Slide 17 15 min… • Live demo with Smalltalk: 30 min • Concluding Note: 10 min.. • Q&A 15 – 30 min

  4. Smalltalk is a comprehensive tool box for the developers… • A Language • An IDE • Team Dev environment…version controlled code sharing automatically linked.. • ToolSet for comprehensive app analysis: Time/ Space profiling… • Framework for various technologies….name a few..? COM, .Net, CORBA, WebServices etc.. • It always comes bundled, not just as a language in its various dialects… • A Whole new ( or the oldest ) paradigm…!!! • Above all the test bed for many of the CS concepts we hear today: • MVC, UI framework, XP Programming, Sunits, Design Patterns, Distributed Computing, • comprehensive uniting of garbage control, bytecode and VM based dev platform etc… • Article on Linux and Smalltalk applicable though for any OS

  5. Introduction… • Why the move into Smalltalk: • Project time comparison: C Project (xdelta) • 12 weeks.. • Java ( file system) • 6 + 6 weeks.. • Smalltalk (Pathfinder) • 3 weeks… • Session Objectives: • Smalltalk as a value proposition for a • software development unit • (Learn all other languages/ dev platform and realize why smalltalk…!!) • This is a two way interactive session… • Put Smalltalk in its right perspective.. Skrish personal Past: Fortran,C, C++, VC++

  6. Introduction cont’d… • Smalltalk Presence: • The biggest presence is the acceptance and emergence of Bytecode based, garbage • controlled, OS/DBMS transparent, MVC based UI and Virtual Machine based • language/ development platforms: Java or .Net… • Corporate: Was 17% of US market in mid 1990’s • Academic: Small but significant in its love and ease in teaching OOPS • Still strong in lots of co’s in the Insurance, Shipping, banking, manufacturing, trading, scientific sectors of programming..A Renewed interest and thrust this 2002 onwards….. • Telecom: > a billion $ project for British Telecom • Shipping: > 50% of world trade software runs on Smalltalk • Insurance: Many insurance companies have significant code in Smalltalk • Finance: Kapital from JP Morgan trades derivatives that other languages cannot… • Regional interests: Entire Deutsch Bahn, Swiss banks, manufacturing units run on • Smalltalk. Significant Japanese interests in VisualWorks usage… • Other dialects/implementations • VisualAge, VisualWorks, Squeak, GNUSmalltalk, Dolphin/SmalltalkMT, Object Studio, Smalltalk X, OOSVM etc….

  7. Grammer of Programming Languages • Show progression to Smalltalk…as realized by Alan Kay • * Starts with on-off gates in electronics to 0-1 in binary: all about raw computing. • * Moves on to Assembly language of programming instructions • mov, mul, add, jump, sub, loop, etc... • * The wakening of easier grammer: Basic and the predecessors • Read , Print, etc.... • * Move over to the procedural paradigm • function oriented Fortran and others... • C ....a system language finally... • Smalltalk is born from: • LISP: The string interpreter for languages...views everything as a collection of characters.. entities • Simula: The real world object syntax and as recursion on objects. First OOPS language • Ivan Sutherland’s paper on UI based, mouse controlled computing system • Real life is made of objects... and divisible into objects nearly ad-nauseum so is Smalltalk the language/ IDE modelled with Object hierarchy now adopted across all dev platforms Binary 0/1 s Assembly Sequential: COBOL Procedural: C / Basic Object Oriented

  8. Smalltalk, the first true OOPS language/environment: 1972-80 The move is steadily to make programming languages as easy as you and me talk...but powerful enough for the computer to understand..you cannot be fuzzy as we are in real English and hope the computer to be using that as of now.. In English: as you would say: so would you in Smalltalk…!!.. Object move, Ball thrown, aCar isDriven, Train runsOn rails Smalltalk function call on a class or Object: Aircraft from: ‘BritishAirways’ flysTo:’London’ atTime: ‘230AM’ . simple isnt it… Others languages Java/ C++: Aircraft.aircraftFlightDetails ( “BritishAriways’ , ‘London’ , ‘2.30AM’ ); Its all about nouns, adjectives, verbs.…a parallel captured in OOPS Read and write in language you understand, in the manner you speak or write.. And above all see it in UI not as passive set of code files…

  9. What are Objects, Classes and Object Oriented Programming Objects: Real World Entities mapped as programming construct computers can understand. Classes: Collection of functions and the relevant local data for these functions. Extend from your knowledge of C: all functions declared are global, all data used from more than 2 functions ends being global So if say 4-10 functions are logically doing one unified functionality, and say 10 data variables are used by these functions. Combine these functions and data description: one logical unit in memory now called Class XYZ.: This is Encapsulation… anObject: Instance of a Class ABC. Create a link to the class structure in memory, Initialize all values of the class local variables in this object’s allocated memory area. Invoke a function call on the object using these variable values. If you have 20 objects of the same class they will have 20 copies of their variable values but point to the same class memory area for execution of functions. anObjOfXYZ01 VALUES OF LOCAL VARS VAR1, VAR2, VAR3 …. Ptr to Class XYZ CLASS XYZ DESCRIPTION OF LOCAL VARS VALUE OF CLASS VARS FUNC01: ALL INSTRUCTIONS… FUNC02: FUNC03: So on….. anObjOfXYZ02 VALUES OF LOCAL VARS VAR1, VAR2, VAR3 …. Ptr to Class XYZ anObjOfXYZ03 VALUES OF LOCAL VARS VAR1, VAR2, VAR3 …. Ptr to Class XYZ

  10. CLASS XYZSuper DESCRIPTION OF Common LOCAL VARS VALUE OF Common CLASS VARS FUNC01: CLASS XYZSub01 DESCRIPTION OF LOCAL VARS VALUE OF CLASS VARS FUNC10: FUNC11: CLASS XYZSub02 DESCRIPTION OF LOCAL VARS VALUE OF CLASS VARS FUNC20: FUNC21: CLASS XYZSub03 DESCRIPTION OF LOCAL VARS VALUE OF CLASS VARS FUNC30: FUNC31: Inheritance: Extract the common functions and data to a super class… Thus create a hierarchy of super, sub classes and sub-sub classes etc… There are other features that are simply further simplification or in a way optimizing the functionality of the language which are: Polymorphism: Literal: “Multiple shapes visible of one entity” . In programming it implies a function name that is common within a class or in two class but has differrent code section to execute, but similar meaning in execution. Data Hiding: This is an automatic feature as variables are now within a class memory structure and only that class or its sub class can access it One step further you can talk of Abstraction too.. Think further on: Object Aggregation or Composition and Object Inheritance creating a pool of interacting Objects in memory to create a program….!!...

  11. History of Smalltalk Development • Smalltalk Conceptualization from Simula, LISP and Ivan Sutherland’s paper • 1968: Alan Kay at Xerox • Smalltalk 72: Conceptual • Smalltalk 76: Bytecode, VM, LISP features incl garbage collection etc.. • Smalltalk 80: First formalized release of the Smalltalk specs, incl the PS VM, • virtually all known core features of the language + basic IDE to program in • Philosophy of the Smalltalk Design: • Dan Ingalls: • “Keep it simple, keep it stupid” • Carry over to Macintosh of window/GUI and then into “M$oft Windows”.. • HP for distributed Smalltalk • IBM for VisualAge • Xerox hives of to Parcplace Smalltalk or VisualWorks • Digitalk Smalltalk that later merges with VisualWorks • Squeak in Disney still maintained by Dan Ingalls and others.. • 1999: Cincom takes over VisualWorks • 2005: VisualWorks 7.3 is the new workhorse… potentially competing with • Java Websphere

  12. Language/IDE Features of Smalltalk • Everything is an object: No primitive data types or primitive operations exposed to user • 1. It is a dynamically typed language: No instantiation of variable types at declaration • Runtime assignment of type, thus variables can be of any type right through the • program. [The future of all languages that exist now..as “Stiffly Typed” …] • Language Syntax: A different syntax to code with, no curly braces, no function params • in closed brackets, plain camel case instead of Hungarian notation… • IDE based live coding: The program is coded within the running application • environment. That is no passive, file based coding to compile and then run cycle. • “Develop an application while the application is running”. Code while Smalltalk is • running inside an IDE that has all user/framework classes visible. This in turn means: • a. Incremental Compilation: Write 1 or n lines of code select and execute, the code • code compiles , interprets the byte code and executes during this cycle automatically • b. Visible Classes and Methods: No docs and MSDN to search for, all classes and • methods are visible in browser. • c. Persistence: All classes, methods, objects created persist in the image. Objects • remain for interaction till they go out of scope/ released. So simply save the dev image • in the state it is and come back later to continue thereof.. • d. Executable: Strip the image of all dev classes and tools and the image now can run • of the OS specific engine in all platforms supported. • Support XP maxim of: “Make it run, make it fast and then make it right” • Code first, refactor later to get the design right in iterations and not in one “Waterfall” go…

  13. Features of Smalltalk Framework as extended now:… 1. Enforces OOPS concept in programming 2. Rapid application development (RAD) in team environment. 3. Total extensibility of the environment 4. Supports most of the new and old technologies including .Net,WebServices, Sockets BSD.. etc 5. Dynamic compilation and debugging.. 6. Completely secure memory subsystem with a GC ( garbage collector) that is highly optimized 7. Smallest footprint amongst any development platform of VC++, VB, etc.. as good as a C code once byte code is loaded and running.( This is true for Smalltalk X but nonetheless better than any other memory managed code ) 8. Special interfaces for web based programming, DBMS supports, networking protocols of TCP/IP, SMTP, SOAP, WML, XML etc. 9. Built in version control system Call it Store in VW and Envy in VA, it is far more stable and powerful than the VSS. 10. The SUnits Testing Suite. 11. The MVC paradigm originated in Smalltalk in 1980..!!.. 11. The new development model of Extreme Programming is rooted in Smalltalk, though adopted by others also now. 13. The design patterns concept recommended for a highly extensible application development is propounded by the top guns in Smalltalk. 14. Eclipse is developed by developers from Smalltalk background OTI and VisualAge. 15. Develop embedded code for any processor chip, as is done for Mercedes cars. 16. Use Pocket Smalltalk to create the quickest and easiest programs for your palm and test it on its simulation test bed. And again lots more… that can be listed endlessly..

  14. Smalltalk Primer 01: Syntax Basics: Start from a function or method inside a Class created… sample01 “Comment: This is just to show some basic Smalltalk syntax" | sum aVar1 aVar2 aVar3 aSet | sum := 12 + 12. aVar1 := ‘This StringNum 1234‘ , ‘ concatenate it to‘, ‘ another Number: ‘. aVar2 := aVar1 , sum printString. aVar3 := sum + aVar1 asNumber. aSet := Set new. aSet add: sum; add: aVar1; add: aVar2; add: aVar3. ^aSet Class creation: Is on the IDE directly by executing the stmt in its given area or even inside any user method too.. So dynamic Class creation for you if you wish.. AnyNamespaceperform: #defineClass:superclass:indexedType:private:instanceVariableNames: classInstanceVariableNames:imports:category: withArguments: (argArray) Now add methods to Class created in the same IDE browser…as quick as any fancy meta modelling tool with UML would help you do…

  15. VisualWorks Smalltalk Virtual Image Virtual Engine Operating System Hardware An application’s development platform: Objects: Objects ( class) description Object header and data Object state (includes contexts as objects) • Compiler • Interpreter • Memory handling aka memory reclamation • Primitives • Numbered <primitive: 123> • For user extensions use: • DLLCC <c: void func( int …)> • new • Named <primitive: ‘a’ module: ‘b’> 03

  16. Smalltalk IDE Primer 02: Multiple Windows IDE: Each window for each specific purpose: System Transcript: The top or main window for accessing all functionality Workspace: A scratch text window to try snippets of code or execute or launch your program Browsers: A whole host of browsers for Code: creating class and methods; locating implementers senders, references of methods/vars Inspector: A powerful tool to inspect Classes, Objects : their object composition and values recursively Debugger: The most powerful debugger with the complete Smalltalk Stack for interactive edit and continue And lots more as you dig deeper… Basic Terms to remember: Parcels: Binary module stored as files ( collection of classes ) in VisualWorks Packages: Collection of classes stored in STORE in VisualWorks Application: Collection of classes stored in ENVY repository in Visualage Configuration Maps: Collection of Applications in VisualAge ENVY: The version controlled source repository in VisualAge ( STORE in VisualWorks) Image File: The file copy containing the classes and objects in the runtime memory. Gives OS independence running over an OS executable

  17. Smalltalk Learning: How to Proceed ?: Language Primer: * Read and interactively run through Ivan Tomek’s “introduction” workspace in VisualWorks Non Commercial * Read through ReadingSmalltalk.pdf * To refresh everything once more read through AppDevGuide.pdf (VW) Chapter on “Syntax” and if need be “Object Orientation” Learn Basic Framework: Online guides in VW or VisualAge… * Boolean: True and False class * Magnitude: Numbers, Characters, Date, Time * Collections: Sets, OrderedCollections, Dictionaries etc… * Streams: Internal and External ( files) ( Object Class, Behaviour and concepts of Metaclass is basic but can be touched upon much later…) * Processes and process management * Basic of GUI development * Vector/ Raster Graphics/ Fonts etc… * MVC and the inherent Controller framework… * Packaging and delivery.. External Frameworks : Source Code Control, DBMS access, web application server, web services, COM, CORBA, .Net access, Sunits, MQSeries, C dll access etc Advanced: * Reflective programming or Meta programming…. VM and the works..

  18. A Demo of Smalltalk.. Modified Unified VisualWorks IDE Demo: • Basic Hello World • UI Painter based GUI screen • Vector Graphics/ Raster Graphics • TCP-IP example • Process fork/ control.. • DBMS transparency • COM connect • DLLCC connect • Web Application • Web Services • .Net • DST • Animation Graphics • Many others not touched upon… Basic VisualWorks Demo: • The IDE and the various windows… • Creating window and manipulating the same • Example factorial, collection operations… • Debugger and inspector… • Refactoring Browser

  19. Keyed up are you..? • Do you comprehend what Smalltalk is all about…. • Are you open to change.. A change for the better, more efficient, and easier computing paradigm…? • You are enthusiastic, “no-compromise in my work” developer / team lead or project manager… • Wish to concentrate on application logic and flow and not on language semantics…a la pointers… in C..!! Curly braces, bracketed in a time warp of compile-run-debug cycle.. • Wish to take up a technology which lets you ride productively right from day one … and lets you take the learning curve at your pace…fast to kick off… Then lets move ahead…. If not have a look at the products based on Smalltalk and mull over it…. As you work on other paradigms, it will make you do better in them for Smalltalk points to the future they are headed for anyways.. Time Learning to time taken: curve for Smalltalk to others.. Basic Conceptual  Advanced Expertise  Expert… (more absolute terms )

  20. Next Steps • Step through VisualWorks or VisualAge Smalltalk and its various components… • Prototype one very real project ( mid sized ) important but not critical in Smalltalk • Staff the project with keen and true Smalltalker’s trained with atleast one skilled mentor • At the end of the project analyze its complete cycle to understand where the organization benefits… • Go ahead and use it from here onwards…benefit from the true RAD tool..

  21. Smalltalk: the right choice…….. So just do it…!!!

  22. Thanks for the patient hearing of the presentation..

More Related