I subscribe to JS Weekly to try and keep up on the amazing monster that JavaScript has become. What with V8, node.js, and asm.js, everybody* thinks that JavaScript is the god damned cat’s meow nowadays. Well, not me – I think in a decade or so, it’s going to be about as relevant as the phrase “cat’s meow” is today. Continue reading “What’s wrong with developers today?”
Clarification about the unions
To clear up some things that seem contradictory between my “public employee apology” and my recent “OUS is ripping us off” posts, I offer a few bullet points.
But first, check out what software engineers get paid to understand why I feel OUS underpays us. The general IT positions are even lower, of course, but I don’t have as much of a frame of reference for those pay scales vs. the private sector. Continue reading “Clarification about the unions”
OUS vs. SEIU 2013
Two years ago I went on a rant about how unions aren’t demanding as much as the public sometimes perceives they are. Now, after seeing the IT world of the Oregon University System (I’ve worked in two of the universities over the past three years), I have to say the union pay structure is indeed crap, even with the benefits. Continue reading “OUS vs. SEIU 2013”
The horrible cost of using explicit returns in Ruby….
At my lovely new job, we got a trainer to teach us about Ruby, Rails, and agile methodologies. She was pretty good overall, but one thing she mentioned a few times really got on my nerves: “use implicit returns in Ruby because there is a performance hit when explicitly returning”. Continue reading “The horrible cost of using explicit returns in Ruby….”
Why Ruby is so sexy-awesome, part XXXIV
I use Ruby whenever I can. Not specifically with Rails – Rails extends the language and adds some nifty things, but the beauty is all Ruby’s.
Today I was using Ruby (in a Rails app, as it happens), and I had this “API” that returns generic hash data. I want to be able to take data from any source (Oracle, flat text, web service) and return data that’s in a very simple and easy-to-use format, so I chose to just convert data to a hash on a per-source basis.
But how do I handle typos in hash keys? What if somebody asks for “person[:name]” when they’re supposed to ask for “person[:full_name]”? They just get blank data and wonder WTF happened…. I can’t live with this situation, because it’s just too easy to forget a key’s name, or make a simple typo. I could return default data from the hash, such as “YOU FUCKED UP WITH YOUR KEY, SIRS”, but that could find its way into production and then I’m out a job.
So after a tiny bit of digging, I discovered that a Hash can not only have a default value, but also call a default block when a nonexistent key is requested:
irb(main):001:0> a = Hash.new {|hash, key| raise "#{key} not found!"}
=> {}
irb(main):005:0> a[1] = :foo
=> :foo
irb(main):006:0> a[1]
=> :foo
irb(main):007:0> a[2]
RuntimeError: 2 not found!
irb(main):008:0> a.default = nil
=> nil
irb(main):009:0> a[2]
=> nil
Normally I’m good with non-strict default data, but in this case it’s great to know I can actually validate data in a way that makes it hard to miss typos.
It’s not as safe as C++ (edge cases are only caught at runtime), but it’s far better than Perl (and nicer to read or write than both, IMO).
Dotproject strikes again…
I’m sure I’ve bitched about open source plenty of times, but I have to rant once again. Dotproject is my project management application of choice. It does everything I want, and in particular allows for very awesome time estimation which was extremely useful for Bloodsport Colosseum. I was able to break down every task into subtasks and really get a feel for how much effort was left by looking at the accuracy of past estimates.
But it’s programmed by idiots. I mean, these guys are actually pretty stupid compared to the average rock. I’m sorry, it’s a great tool designed by somebody who had a head for project management, but programmed by idiots.
After not using dotproject for a while (after the death of bloodsport colosseum, I had little to track), I got a contract job that really needs careful design. So I jumped back into a semi-recent version of this awesome/disgusting app, and found that it uses overlib for popup help! (No, that isn’t the problem. Overlib is actually really nice for web-based hover-help) But the dotproject devs by default chose to make the popups STICKY. That is, when you hover over a link you think is just a link, a popup shows up that will not go away until you explicitly mouse over the “close” button.
This is revolting.
So I know overlib. I’m not phased a bit. I used it for Bloodsport Colosseum and it’s really a pretty straightforward JS library (a rarity these days). It’s open source, so it probably sucks monkey balls, but as a user of the tool, I liked it.
Overlib has a central area to put all your app’s default preferences for things like font, colors, opacity, and, of course, sticky. To override the defaults, you can actually specify “commands” in your call to the overlib methods, which is handy for special cases.
The dotproject dimwits actually ignored the defaults altogether, and put the exact same preferences into their HTML in seven different places. I’m not sure what can happen to a programmer where they learn the number one failing of software. The first thing you learn in your first CS class is about code reuse. Functions, code centralization, that sort of shit. HOW can somebody be so stupid as to ignore these amazingly simple principles when the library already provides a really easy and central place for this stuff?
Then I remembered my first dotproject disaster – an old version had some broken SQL for calculating the % left on a task, and to fix it I had to change this SQL in 3 or 4 places, and rewrite a couple rather large sections of code.
No, that memory didn’t comfort me, but at least I was able to say, “Oh yeah, they’re just dotproject developers. They didn’t know better.”