Pharo is like a time machine for coding - it lets you travel through your program’s runtime while it’s still running. This modern Smalltalk dialect isn’t just a language; it’s an interactive world where your objects live, breathe, and respond to every keystroke. Let’s explore why you should give it a spin, and how to get started without losing your mind.
Why Pharo? The Short Story of ‘Small Talk’
Smalltalk began as a research project at Xerox PARC in the 70s, aiming to make computers as easy to use as children’s toys. Pharo carries this legacy forward, but with modern twists. Here’s the magic trick list:
- Live Coding: Code while your program runs. Debugging becomes a conversation with living objects.
- Simplicity: No constructors, no types declarations. Just pure object messages all the way down.
- Powerful Tools: The debugger lets you pause time, inspect objects, and modify code mid-execution.
- Community: 100+ contributors per release. Like a coding commune, but with fewer man-buns. Pro Tip: The name “Pharo” comes from the lighthouse of Alexandria - a beacon guiding developers through complex systems.
Pharo Bootcamp: From 0 to Object Wizardry in 3 Steps
Step 1: Install Your Time Machine
# Download and launch Pharo
wget -O- https://get.pharo.org/64 | bash
./pharo Pharo.image
What to Expect:
A bare-bones image appears. You’re meant to build everything from scratch. It’s both terrifying and liberating.
Step 2: Hello Galaxy!
In Pharo Playground:
Transcript show: 'Hello Galaxy!'. "Print to console
42 factorial "Calculate 42!
Cheat Code: Highlight code → Right-Click → “Do it”. Magic happens instantly.
Step 3: Unscramble Words Like a Pro
Let’s create a simple anagram solver using live code:
wordlistUrl := 'http://wordlist.aspell.net/official'.
words := (ZnUrl fromString: wordlistUrl) retrieveContents.
wordDict := Dictionary new.
words linesDo: [:line |
wordDict at: line sorted put: (wordDict at: line sorted) add: line].
"Unscramble 'taerg'"
wordDict at: 'taerg' sorted "Returns {'great'}"
Visualization: How This Works
Advanced Wizardry: Live Coding in Production
Hotswapping Code
Pharo lets you:
- Pause Execution → Inspect Live Objects → Modify Methods → Resume
Example: Fix a bug in production while users are still online.
The Object Inspector
1/2 inspect
Opens a visual debugger where you can:
- View object relationships
- Modify state
- Aspect step-wise execution Pro Tip: The inspector is like having X-ray vision for your code.
The Ecosystem: Your New Best Friends
Resource | Type | Link |
---|---|---|
Pharo Books | Guides | Books |
Pharo Mooc | Video Tutorials | YouTube |
Prof Stef’s Tutorials | Hands-on Lessons | Prof Stef |
Exercism Track | Coding Challenges | Exercism |
Why It Matters: Beyond Nostalgia
Pharo isn’t just for Smalltalk enthusiasts. It tackles modern problems with unique solutions:
- Reflection: Everything is an object, including the compiler and runtime.
- Hot Deployment: Update production systems without downtime.
- Collaborative: Workspaces allow team members to edit the same codebase simultaneously. Pro Tip: The Pharo community likes puns. “Smalltalk is more than just a chat” became a conference slogan.
Join the Rebellion
Pharo challenges traditional software development practices. It’s not for everyone, but for those willing to embrace its radical simplicity, it offers:
- Mental Model Shift: Code isn’t just text - it’s living objects.
- Efficiency Gains: Live debugging reduces 90% of console.print debugging.
- Joy of Creation: The immediate feedback loop feels illegal. Final Words: Pharo is less about deathly inputs and more about lively outputs. Try it, and you’ll understand why this “old” language keeps winning new converts.