11 years ago I first encountered Java. Before then I mostly used C. I immediately loved how Java kept familiar C constructs but protected me from the most common, most difficult, and most time-consuming bugs. No more string buffer overflows? Awesome! Out-of-bounds array indices caught at runtime? Awesome! No need to allocate and (forget to) release memory? Awesome! No more core dumps? More than awesome! This is what I imagined programmer heaven to be like.
Even expert C programmers often wrote code that had buffer overflows and memory leaks. Making sure code didn't have such problems took a lot of hard-to-test mental reasoning. Introducing such problems in maintenance code was a continual danger.
I doubted that Java could offer these features while giving reasonable performance. And in fact, in early versions it couldn't. But over the years all sorts of optimisations have made Java performance adequate for most computing tasks.
Jump forward to today. My most troublesome bugs in Poker Copilot lie in a different area: concurrency mostly in the form of thread-safety. It's possible to have two or more pieces of code running more-or-less in parallel, accessing the same resources, sharing information, and needing to co-ordinate their activities.
Even expert Java programmers have trouble writing thread-safe code. Making sure multi-threaded code doesn't have synchronisation problems takes a lot of hard-to-test mental reasoning. Introducing such problems in maintenance code is a continual danger.
I use the Java concurrency API. It's good. It helps me a lot. I've read, re-read, and tried to grok Java Concurrency in Practice. It's also good and helps me a lot. But these are not enough.
What I long for is a language that's similar to Java but designed at every level to help write multi-threaded code. Something that offers me familiar constructs and concepts. Yet something that offers me better help for writing thread-safe code. Perhaps a language where objects are immutable by default, unless I specifically mark them as not immutable (Immutable objects make concurrency easier). Perhaps a language where I can mark a class as synchronized, which automatically makes all methods in the class synchronized (therefore ensuring that only one method in the class can run at once). Perhaps a language where parameters are passed as deep copies by default, or as copy-on-write objects, unless I mark them otherwise.
Many Java projects are riddled with obscure concurrency bugs. It's hard to get even the most basic code right, as I demonstrate with code to format a date as a String.
The Poker Copilot Blog
Tracking the development of Poker Copilot, Mac OS X software for poker analysis and statistics.
Saturday, 6 June 2009
C is to Java as Java is to what?
Subscribe to:
Post Comments (Atom)
Poker Copilot Translation Project
Want to use Poker Copilot in your language? Then help with the Poker Copilot Translation Project.
About This Blog
In May 2008 I started working on Poker Copilot, initially as a product to help me with my own poker playing. Soon I joined a "30-day Challenge", where the participants each aimed to launch a software product in 30 days. As a result of this challenge, Poker Copilot version 1.0 was launched in July 2008.
This blog tracks the ongoing development of Poker Copilot. Who would find this blog interesting? People interested in 1-person software development, in Poker, or in both.
Contact me via email at steve at pokercopilot dot com.
This blog tracks the ongoing development of Poker Copilot. Who would find this blog interesting? People interested in 1-person software development, in Poker, or in both.
Contact me via email at steve at pokercopilot dot com.
Blog Archive
-
►
2012
(31)
-
►
January
(29)
- Coming in the Next Update: Ignore Old Hand History...
- Coming in the Next Update: Poker Copilot can forma...
- From the "It's About Time, Too" Department
- Poker Copilot Business Cards
- Playing on Entraction Network?
- Unofficial Update for Ongame Players
- One Person with Two Accounts Playing on Ongame?
- Small Tweaks in Poker Copilot Preferences
- Ongame Network and Poker Copilot
- Buy Poker Copilot via Bank Transfer
- Improvement to Appearance of HUD Popup
- Improvement for Poker Copilot Translators
- Coming in the Next Update: HUD Layout has an extra...
- Unofficial Poker Copilot Update for Ongame Network...
- Poker Copilot Demo Video in French
- Reason I Like My Mac #17,823
- Updated Poker Copilot Demo Video
- Poker Copilot 3 Coming...
- News for Poker Copilot Translators
- Updated Poker Copilot Translations
- New Poker Copilot Screenshots Reveal How Version 2...
- Poker Copilot Translation Project: Update
- PokerStars now has built-in Auto-Hotkeys
- Reflection on the PokerStars Update that Broke Pok...
- Poker Copilot 2.101 Now Available
- Poker Copilot Website in French
- Spanish Website Translation
- Poker Copilot Website in Spanish
- Update for PokerStars Denmark Users (PokerStarsDK)...
-
►
January
(29)
-
►
2011
(154)
-
►
December
(10)
- New Unofficial Update
- Poker Copilot Discussion Forum in French
- Coming in the next update: multiple HUD layouts
- Poker Copilot Fact of the Day
- Unofficial Poker Copilot Update for the Brave
- Coming in the next update: All-in Equity in $ or B...
- Who uses BarrierePoker.fr?
- Coming in the next update: Filter tournaments by t...
- Help Wanted: BlazingStars or AHK for Merge Network...
- Coming in the next update: choose a language for P...
-
►
November
(13)
- MacKeeper's "Real-time protection" breaks Poker Co...
- PokerStars Playing History Audit CSV Problems with...
- Poker Copilot 2.99 Now Available
- HUD not working on PokerStars in update 2.98?
- PartyPoker support in Poker Copilot
- End of a Troublesome Week
- Poker Copilot 2.97 Problem Fixed?
- Desperately Seeking Help to Solve the Crashing Pro...
- Is Poker Copilot 2.97 Crashing For You?
-
►
December
(10)
-
▼
2009
(337)
-
▼
June
(29)
- Poker Copilot: One Year Old
- Poker Copilot 2 Early Access Program Update
- Poker Copilot 1.76 Released
- A Lousy Poker Copilot Week - And a New Feature
- Stuff from Aidan + Posterous = Instant New Blog
- Food, Inc
- Poker Copilot HUD always on?
- Sub-Millisecond Query Optimisation
- Poker Copilot 2 Early Access Program Update
- Multi-table HUD demo
- What's Poker Copilot Missing that Hold'em Manager ...
- Finding Memory Leaks in Cocoa + Objective-C
- FastSpring and Credit Card Fraud
- Does Poker Copilot have Ongame Network Support?
- Poker Copilot 2 Early Access Program Update
- Poker Copilot Tutorial in French
- Mac-ify your Full Tilt Poker
- Why does Poker Copilot talk to the Internet?
- Poker Copilot's Crash Reporter
- Sentence of the Day
- What I've Been Reading
- Obscure Sentence of the Day
- Cha-ching!
- Statistic of the Day
- Hero Stats for Current Table Only
- Poker Copilot 1.74 Released
- C is to Java as Java is to what?
- Competitors for Google?
- Poker Copilot goes Cyrillic?
-
▼
June
(29)


4 comments:
I have no idea what Im talking about but cant you just develop with Xcode?
List of concurrent programming languages: http://en.wikipedia.org/wiki/Concurrent_computing#Concurrent_programming_languages
I don't think any satisfy the familiarity requirement (Join Java only exists in thesis form). Scala supposedly (no first hand experience) inter operates well with Java and would seem to be a good bridge to functional programming.
It's conceivable you could write Java methods in the FP style (methods don't change data, only return new data) but that seems a pain as well as wasteful.
I can't say much because of the NDA, but I was at the WWDC a couple weeks ago, and just wait til the new version of Leopard/XCode comes out. You will have to use Objective-C, but there may be a very elegant solution to the multi-threaded issues you're talking about.
Then again, maybe there won't be... I can't say for sure :)
Check out Objective Caml. It's not especially tailored to writing multi-threaded applications, but it satisfies many of your other requirements (e.g. immutability by default, familiar OO idioms). It's mature and has a large user community (many academic, but quite a few industry folks).
Post a Comment