I recently needed to parse some #smalltalk source and be able to diff method versions. In the past, I would've automatically done this in #smalltalk. After all, almost everything you need is there - the source itself of course, and reflection capabilities are superb in #smalltalk, and I can build a UI easily enough. But - as it turned out, in this case the source wasn't quite so easily accessible, as it exists outside the image - in .st files, and so I'd have to parse it and store it somewhere - and of course, I'd have to write some code to do the diff...
And there's the rub - the things that would've taken some time to do in #smalltalk - parsing that source, storing it somewhere, diffing it, and then handling the presentation - well, they were pretty near trivial in #ruby.
PARSING - #ruby has a lot of #perl in it - and nothing beats #perl when it comes to string handling/parsing.
DIFFING - This would've taken some time - I don't have a standard diff algorithm in #smalltalk. I could've called out to ... well, in this case it would've been #cygwin. It could've been done but would've been a little ugly. In #rails I had several gems to choose from.
PRESENTATION - Ok, this wouldn't have been particularly difficult in #smalltalk - and it would've been nice to integrate what I wanted directly into the #smalltalk ide - but as it turned out, just doing a simple RESTful #rails app, and using a readily available gem for the diff - made this a no-brainer. Plus, I've gotten used to the flexibility of manipulating user interfaces (even low-grade ones created just for my own usage) via css.
And there's the rub - the things that would've taken some time to do in #smalltalk - parsing that source, storing it somewhere, diffing it, and then handling the presentation - well, they were pretty near trivial in #ruby.
PARSING - #ruby has a lot of #perl in it - and nothing beats #perl when it comes to string handling/parsing.
DIFFING - This would've taken some time - I don't have a standard diff algorithm in #smalltalk. I could've called out to ... well, in this case it would've been #cygwin. It could've been done but would've been a little ugly. In #rails I had several gems to choose from.
PRESENTATION - Ok, this wouldn't have been particularly difficult in #smalltalk - and it would've been nice to integrate what I wanted directly into the #smalltalk ide - but as it turned out, just doing a simple RESTful #rails app, and using a readily available gem for the diff - made this a no-brainer. Plus, I've gotten used to the flexibility of manipulating user interfaces (even low-grade ones created just for my own usage) via css.
All in all the effort took perhaps 5-6 hours, and I have a simple web app - I can easily upload #smalltalk source files, parse and store the source and metadata, do RESTful calls against that data, and easily diff the results. Nice.
)(