If you are into programming languages, you’ve probably heard people talk about how slow Ruby is, and how you should use Python instead. I’ve always loved Ruby’s beautiful syntax. On the other hand, Python isn’t that ugly, and it’s hard to argue with raw speed. Ruby 1.9 brought major performance improvements to the table, and recently [...]
Archive for the ‘Codealicious’ Category
Ruby vs. Python vs. PyPy: Is Ruby Slower than Python for Web Development?
Posted in Codealicious on September 5, 2011 | Leave a Comment »
When and How to Use Singletons
Posted in Codealicious on March 29, 2011 | 1 Comment »
Is the singleton design pattern inherently flawed? I don’t think so. Can you abuse the singleton pattern? Certainly. Can you use it effectively? Absolutely. A few questions I ask myself when deciding whether singletons really should be singletons: Is the singleton external to my app? Databases, queuing services, and ESBs are all perfectly valid macro examples of [...]
You say semaphore, I say mutex
Posted in Codealicious on February 18, 2011 | Leave a Comment »
Suppose you are interviewing a candidate–let’s call him Ben–for a programming job and you ask the well-worn question: What’s the difference between a mutex and a semaphore? Ben: The difference between a mutex and a semaphore? Well, a mutex allows only one thread at a time, while a semaphore can allow several threads [...]
Behind the Scenes of the C++ STL Algorithm Model
Posted in Codealicious on August 17, 2010 | 1 Comment »
Ever wonder why the C++ STL uses an external, non-member function model for implementing algorithms for containers? The following article sums it up. Although a few of the “no less efficient” examples are debatable, the underlying principles definitely have merit. Monoliths “Unstrung” One downside to the functional approach outlined in the article–that I didn’t see mentioned–is [...]
WCF Madness: Method Not Allowed on Missing Query Parameter
Posted in Codealicious on February 13, 2010 | Leave a Comment »
While testing some web services, I was not-so-pleasantly surprised to find that WCF cannot disambiguate two methods when one is a GET nd the other a POST: [OperationContract] [WebDispatchFormatter] [WebGet(UriTemplate = "/{encodedGameId}?startDate={startDate}&endDate={endDate}&tag={tag}")] Contracts.Out.Statistics GetStatistics(string gameId, string startDate, string endDate, string tag); [OperationContract] [WebInvoke(UriTemplate = "/{encodedGameId}", Method = Verbs.Post)] void AddSample(string gameId, Contracts.Sample newSample); [WebDispatchFormatter] If [...]