Archive for the 'Smalltalk' Category

Why use Smalltalk?

July 30, 2009

Even if this was written by someone who is (perhaps too) deeply involved in Smalltalk world, it still got some points that should make you think.

Now, if you are of that kind and don’t want to take your head out of… the sand, then simply ignore this. For everybody else, no matter how skeptical you might be, at least some of this should get your curiosity juices flowing:

Top Ten Reasons to Use Smalltalk

Help, I’m failing to install Squeak Smalltalk on 64 bit AMD FreeBSD box

February 18, 2009

I’m web developer and I have my own server (amd64 running FreeBSD, 2GB of RAM) co-located at local ISP. All web sites that I host are running Rails. The problem is, however, server is running out of RAM. Every Rails process eats up roughly 50-60 megabytes of RAM and I have near 20 sites running. This leaves me with maybe up to ten new sites to run on this setup.

Looking for a way to get out of this situation, I’ve looked at few alternatives. Being fond of Smalltalk lately and it’s relatively small memory footprint, I decided I’ll try putting Squeak on this server and develop sites with Aida/Web. Janko is a good friend of mine and he lives in the same city as I do, so his web framework would be natural choice. He once stated he got more than 50 sites running smoothly in one Smalltalk image burning roughly 400MB of RAM. Nice numbers. I learned something little about Aida and found it quite nice to work with. Of course, having it’s creator nearby helps a bit. :-)  

There is just one little problem. I can’t get Squeak to run on my server. I’ve tried the 64 bit version but no luck. It does not compile. I’ve tried installing it from ports collection but it’s for 32 bit only. After almost a week of trying and failing, I’m slowly giving up. I even looked at other Smalltalk distributions and found none that would run on my setup. If you have any suggestions, please, I’d really need some.

One other solution would be to add another Linux server and put Squeak there, leaving current server untouched. This should be doable without much hassle and I’d prefer not to play too much with my production server. But doubling hosting expenses isn’t what I want… :-) Maybe I could move all Rails web sites onto this new Linux server and replace FreeBSD one with it. Doable but lot’s of work.

What to do? Linux route seems the safest one. Ok, more work for me, but this would get me out of current situation. If you don’t mind sharing, what is your Smalltalk web setup? How do you deploy web sites into production Smalltalk image? What are the problems I can expect with my setup (Linux with Squeak)?

Smalltalk – not just for big players

February 14, 2009

Remember your early days when you were a kid and how you loved playing with your toys. Imagine programming so joyful you’d want to do it a little bit longer even if your dinner is getting cold and somebody is not too happy about it. Imagine having fun while refactoring code. Where can you get this nowadays? And you can get it for free.

I admit it. I’m newish here and I’ve been playing with Smalltalk for only about few months. This explains the excitement and I’ve never been so excited about programming. In the last two to three weeks I’ve had lots of those “a-ha” moments where suddenly all make sense. And just after I thought I understand some parts of it quite thoroughly, I get introduced to even leaner and simpler way of doing it.

Coding and code refactoring is actually fun with Smalltalk. It’s like having this big new toy where all the things I’ve learned so far get turned upside down. No more SQL, no more server and application restarts, no more multi-tier setups. Built-in persistence, instant state reflection, hot code deployment and unified language and tools are just some of advantages Smalltalk has to offer.

I’m sold.

Smalltalk image persistence – definitive developer advantage

February 9, 2009

Difference between good and bad application model design can make or brake the application. Having bulletproof app spec can help, but let’s not kid ourselves. There’s no such thing as rock solid application model. Models are prone to change every so often and you can easily paint yourself in the corner.

Any SQL based software suffers from this issue and there’s little you can do. ORM helps to offload this burden, but all it actually does is mask under laying SQL statements. With every update to SQL schema, you need to restart the database server, update application code, restart the application itself and hope you didn’t introduce another bug or two. If all goes well, users probably won’t notice few seconds of downtime.

The story is different with Smalltalk. For small to medium sized projects you can use Smalltalk image as data persistence. This offers quite some advantages, both while developing and when in production:

  • no need for third-party software (SQL servers)
  • no server and application restarts upon model change
  • you edit live code while application is being used
  • faster data access – data is stored in RAM, not on remote TCP accessed server
  • some serious tools to help you craft, debug and maintain your code like a pro :-)

With real-time object reflection you can play with the application model all you want and still be on top of it. As there are no restarts and with changes visible the moment you make them, modeling becomes almost trivial compared to code-fu you need to do with SQL based models. It’s not all honey and milk, but the difference is big enough it should make you interested.

However, there is a down side too. You have to get used to Smalltalk. It’s so different you have to make the effort to really grasp it. Newcomers, including me, tend to leave too soon and not really take enough time to understand the power Smalltalk gives you. Don’t make this same mistake I did a year ago. If you’re interested in Smalltalk, invest the time to really understand it.

Smalltalk is primarily used by blue chip professionals

February 7, 2009

Few days ago I’ve posted a question on Stack Overflow and it went ballistic. Few thousands views and two dozen answers later I’ve got my answer: Smalltalk is still in heavy use today, primarily by professionals in various businesses. Ranging from transport logistic (OOCL’s IRIS-2) and financial services (JPMorgan’s Kapital) to web professionals using either Aida/Web or Seaside web frameworks for developing complex web applications.

While some answers exposed difficulties when using Smalltalk, most of them were void after some explanations. Smalltalk was presented as right choice for demanding and complex environments where high flexibility, robustness and speed of development are main requirements.

I encourage you to read all answers and consider Smalltalk as a possible solution for your next projects. 

Thanks to all who answered my question.

Modeling web store with Smalltalk

January 30, 2009

Last few days I’ve been playing with Aida/Web trying to model a web store. I’ve done this before with RubyOnRails and MySQL so relations and what data should be where is known ground. What was unknown to me is how to represent this in Smalltalk object system. No SQL, only objects.

I’ve started with basic class named Store with sections and items as OrderedCollection’s:

 

Object subclass: #Store
	instanceVariableNames: 'name caption sections items'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'WebStore'

 

Then I’ve added Section, Item and Image classes. The idea is one store can have multiple sections and items. Items can belong to none, one or many sections. All items belongs to the store.

 

Object subclass: #Section
	instanceVariableNames: 'parent name caption items'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'WebStore'

 

 

Object subclass: #Item
	instanceVariableNames: 'parent name caption'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'WebStore'

 

 

Object subclass: #Image
	instanceVariableNames: 'parent name height width content-type caption url'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'WebStore'

 

 
The parent instvar is there for back linking to parent object. This way web store can have nested sections (ie. sections within sections) and items as supplemental to items (ie. item variations on price, design, …). 

With this model setup done I’ve added methods for adding items to web store. First one is addItem: and second one is class method newNamed:

 

addItem: anItem
	self items add: anItem.
	anItem parent: self

 

 

newNamed: aName caption: aCaption
	^self new
		name: aName; caption: aCaption

 

With this in place, basic web store model is done. At first glance this might not seem much better then building SQL relations. It is practically the same except some minor details (primary keys, indices, etc).

What I’m expecting later on is easier updating and managing this model. With growth, model will become more complex. Managing complexity like this should be one of Smalltalk advantages.

Aida/Web – This is how the web works

January 28, 2009

With this title as slogan, web framework written in smalltalk called Aida/Web just got new version of it’s web site. Nothing describes Aida/Web better then authors quote:

AIDA/Web is a Smalltalk web application framework for building complex web applications with integrated Ajax support, rich collection of web components to build web pages programatically, MVC-like separation of presentation from domain, REST-like nice looking and bookmarkable url links, with integrated session and security management, a Swazoo web server and many more.

Aida’s core values are simplicity and elegance of use. It makes building simple web applications easy and demanding one fun again. Based on smalltalk, you get all goodies of mature and stable language:

AIDA/Web is known by its simplicity but still allows building most demanding web applications of many sorts. It has everything you need for a real web app, together with Ajax (which is not additional but integral part of Aida).

It is also a mature one, running web apps in production since 1996. It is used in many intranet business apps from Gas billing system for all gas in Slovenia to logistics management system called e-logis and recently a CMS like system for Quality and Business process management.

Licensed under MIT license, Aida/Web can be used freely. Give it a try and be sure to visit community IRC channel on irc.freenode.net, channel #aida.