The Artima Developer Community
Sponsored Link

Agile Buzz Forum
OO - the Solution to the Problem of Switch Statements

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Keith Ray

Posts: 658
Nickname: keithray
Registered: May, 2003

Keith Ray is multi-platform software developer and Team Leader
OO - the Solution to the Problem of Switch Statements Posted: Jan 27, 2006 9:01 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Keith Ray.
Original Post: OO - the Solution to the Problem of Switch Statements
Feed Title: MemoRanda
Feed URL: http://homepage.mac.com/1/homepage404ErrorPage.html
Feed Description: Keith Ray's notes to be remembered on agile software development, project management, oo programming, and other topics.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Keith Ray
Latest Posts From MemoRanda

Advertisement

Dan Ingalls, principle designer of Smalltalk, with Alan Kay at Xerox Parc. This video was sponsored by Apple, recorded in 1989. In introducing OO (and Smalltalk in particular), he describes the main failing of non-object oriented languages in writing complex software: the switch statement. The switch statement has all sorts of problems with cohesion and coupling. The irony today is that almost all OO languages today, other than Python and Smalltalk (in which it can easily be implemented), still have switch statements.

In most cases, switch statements can be eliminated by either using the Replace Conditional with Polymorphism refactoring, or by using a Map or Dictionary to hold keys and objects (the objects could be blocks of code, "pointers to methods", or regular objects).

On another subject: a recent (still in Beta) full-fledged Smalltalk implementation for MacOS X, which allows Cocoa programming: Ambrai Smalltalk. Screenshots. Cocoa Tutorial

Read: OO - the Solution to the Problem of Switch Statements

Topic: Business Culture Differences Previous Topic   Next Topic Topic: Happy ended tragedy

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use