HNHacker News
TopNewBestAskShowJobs

glassx

372 karma · joined April 28, 2011

submissionscomments
glassx··on Ask HN: What did the really successful programmers do differently?
Well, most early returns are avoided mostly because it makes it harder to understand the code. But when you use guard clauses, like on your Linux Kernel example, you actually improve the code, because you reduce cyclomatic complexity (everything is now a linear path: a -> b -> c), you can reduce nesting, you can avoid unnecessary mutable state... so it's a win. The problem with early returns is when you use them in non-obvious places.

I believe that the majority of programmers agrees that using early returns for guard clauses is an okay exception.

glassx··on Ask HN: What did the really successful programmers do differently?
Exactly.

Also, for example, when you have lots of "if" clauses, those languages force us to use mutable state (and a variable initialized as null) just to avoid early exits. But we can avoid both by treating the "if" as an expression, as in Ruby, Lisp, etc, or with the ternary conditional operator...

Plus, IMO, there are some situations where early exits are a good idea even in languages derived from C, such as with guard clauses/preconditions.

There's a nice discussion about that here with some points I made: http://c2.com/cgi/wiki?SingleFunctionExitPoint

(EDIT: I edited a lot but still couldn't make it clear that I agree with you, but I still ended up making points about completely different things, sorry about that, my english skills are lacking sometimes)

glassx··on Perl Regex Removed From Grep in Mountain Lion
> I don't have to download monstrosity that is Xcode just to get a damn compiler.

They fixed that. On newer OS X versions you can download the Command Line Tools (just 110mb) from Apple's website. You just need a free account: https://developer.apple.com/downloads

glassx··on Announcing the First Beta Release of Persona
Interesting changes to the API. We now have an observer API, instead of just a function that invokes the login window.

https://developer.mozilla.org/en-US/docs/DOM/navigator.id

I believe this merges the old BrowserID Session Management parts with Persona, or am I wrong?

glassx··on Announcing the First Beta Release of Persona
It's not really a "password manager", it uses signed assertions instead of plaintext passwords. It is similar to client certificates, but with a much better UI.

Plus, your keys are stored in the browser, according to callahad, so Mozilla doesn't have to know where you signed up: http://news.ycombinator.com/item?id=4232774

Also, in the future you probably won't even need to contact Mozilla anywhere in the process: your browser will store your certificates for you, natively.

glassx··on What is spaghetti code?
Agreed, that wouldn't be too terrible, but then, again, I think that I always end up using a while loop for those cases when I have to "redo" stuff.
glassx··on What is spaghetti code?
The article mentions that as well: "Backward gotos could be ok when it makes sense that your error case would repeat the last iteration"

Btw, in Ruby there are two keywords that are basically backward gotos: redo and retry.

glassx··on What is spaghetti code?
I like the position of this C2 article on goto: http://c2.com/cgi/wiki?GotoConsideredHarmful

It argues that forward gotos (that work like continue, break, returns mid-function) don't contribute to spaghetti code, while backward gotos are more problematic.

glassx··on Everything's broken and nobody's upset
And it's not just with computers.

I have a Sony Bravia TV and with every update its "UI" got slower and slower, until I disabled updates. I know it's got a lot of cool features in it, but I just wanted a simple TV.

glassx··on T-mobile password reset does not allow you to type the letter "V"
Only up to 2006, at least according to this link:

http://www.quora.com/Orkut/Why-was-Googles-Orkut-built-on-AS...

glassx··on Show HN: HackerNews reimagined without tables or center elements.
Isn't the problem with JSBin (or CoderWall)?

His updated version of Hacker News isn't really that complex or incompatible with older browsers.

glassx··on Programming is not algebra
He's talking about intermediate representation and how some optimizations, such as SSA [1], are closer to functional style. In the end it's all imperative assembly, but during the optimization phase it can be something else.

[1] http://en.wikipedia.org/wiki/Static_single_assignment_form

glassx··on No, that's not why OO sucks
I really don't know why people seem to think that post is the final position of Joe Armstrong about OOP. It's a very old post, without any context, and since then he has gone on record praising Smalltalk and Alan Kay's take on objects many times:

http://infoq.com/interviews/johnson-armstrong-oop/ http://erlang.org/pipermail/erlang-questions/2010-August/052...

glassx··on Joe Armstrong: Why OO Sucks
Agreed. And Joe Armstrong himself used this argument here: http://www.infoq.com/interviews/johnson-armstrong-oop
glassx··on Joe Armstrong: Why OO Sucks
I don't know the context of the post, but remember that Erlang is a community effort, not a dictatorship. He has to expose his arguments and motives in order to keep using his favourite methodology.
glassx··on Introducing Mozilla Persona, An Identity System for the Web
It's hard to explain, but it's not much a "service" - the current implementation is just a "shim", since no browser supports it natively. Client-wise, it's just a JavaScript API. In the future, your browser will store your keys, not Mozilla.

But even with the current implementation it is possible to validate the assertion in your server without contacting browserid.org, but AFAIK nobody did it yet.

(I tried to find a reference for that, but they took it down from their Wiki. It used to say "You may choose to validate assertions on your own server": https://github.com/mozilla/browserid/wiki/How-to-Use-Browser... - the verification code is still online, though)

glassx··on Introducing Mozilla Persona, An Identity System for the Web
I believe that a native implementation has been on their plans from the start, but I haven't heard much about it lately. Here's some mockups:

http://people.mozilla.com/%7Efaaborg/files/projects/firefoxA...

There's also some work on integrating existing e-mail providers, so you can get instant identities:

http://identity.mozilla.com/post/17207734786/id-provider-sup...

This is probably the web-thing I'm most excited about today, even though the development is kinda slow. I really want to implement it as a sole identity provider on my websites some day.

EDIT: I also began writing a Safari extension that would work like the mockup above, but gave up halfway since it was too convoluted and totally insecure... maybe I should try writing a SIMBL plugin or something like that.

glassx··on Coding Horror: The PHP Singularity
Nope. In this line he's talking about a web app he's writing and how he considered writing it in PHP to boost adoption. Here's it in context:

"I'm starting a new open source web project with the goal of making the code as freely and easily runnable to the world as possible. Despite the serious problems with PHP, I was forced to consider it."

glassx··on Coding Horror: The PHP Singularity
For Ruby there's Passenger/Ruby Enterprise Edition, which is simple to setup IMO, but it's stuck on 1.8.x, AFAIK...
glassx··on Coding Horror: The PHP Singularity
<rant>Okay, not directed at you, but... It was posted yesterday. Does this really have to be posted EVERY SINGLE DAY?

Every time anyone suggests improving anything, or make another product in a crowded space, this comic is posted. The author of this article doesn't even suggest a new platform - he suggests improving a platform that exists to enable easier deployment. It was posted yesterday for Chocolat... do we really have to stop making editors?

In a site targetted to hackers and startups it is disturbing that people are so unwilling to learn something new, support a new product, improve the world, do anything new. Yes, redundant standards suck sometimes, but it's not always the case.

I wish that the comic author would consider deleting this from the server, or maybe pg could ban it.</rant>

glassx··on RIM announces $518 million loss, 5,000 job cuts, delays BB10 to 2013
> When Steve Jobs came back, he terminated all those projects and discontinued most of the product catalog.

Woah, that was a crazy idea...

glassx··on Whoa: It's 2012, and the World's Most Popular Email Service Is ... Hotmail
Similar results here, we're an university with about 16 thousand: 41% hotmail, 21% yahoo, 10% gmail.
glassx··on Functional Programming for the Object-Oriented Programmer by Brian Marick
Well, to nitpick, the first, fourth and fifth example are just variations of the other ones, and they're (ab)using Haskell features - respectively n+k patterns, laziness and point-free programming.

Those features aren't available on every functional language, and they're not really used indiscriminately as shown here on most Haskell code bases, so yeah, I maintain that this page is a terrible example (albeit a very educational and fun one).

Here's a Python version, showing that even on an imperative language there's a lot of ways of doing the same things:

https://gist.github.com/289467

glassx··on Functional Programming for the Object-Oriented Programmer by Brian Marick
> How many ways can a reasonable programmer write the factorial function imperatively

This page is a terrible example. Most of these are not not what a "reasonable programmer" would do.

An unreasonable programmer would be able to screw up on any paradigm. You'd probably have even more ways to screw up like this with an OO language, creating classes for recursive functions, trampolines, a pattern matching class, implement an language interpreter inside your factorial implementation, etc.

glassx··on I analyzed the chords to 1300 popular songs for patterns. This is what I found.
Ooops, yes, you're right on both!
glassx··on I analyzed the chords to 1300 popular songs for patterns. This is what I found.
The chord choices in Garageband are the chords found within the scale of C, plus Bb (even the Bdim - but, to be pedant, it should actually be a B7b5). Having Bb you can modulate (or "change the key") to F without having to switch scales etc.

Also, the fact that he found D, E and A among the results is probably because of modulations. It's VERY common for pop songs to modulate a whole step during some chorus near the end [1]. As mentioned, G, F and C are V, IV and I. If we modulate a whole step, from C to D, the V, IV and I are A, G and D. It would be nice to consider those modulations into the research.

About the key choice, I believe it's irrelevant. It depends a lot on what's your instrument (Bb, Eb is easier on brass instruments), your style (lots of Metal songs in the key of E because E is the lowest note on guitar), your tuning (lots of rock bands downtune their guitars to Eb or D etc), your proficiency, and, most important, the vocalists range.

--

[1] Otis Reeding - My Girl, Celine Dion - Because You Loved Me (actually lots of songs by her), Monty Python/Eric Idle - Always Look On The Bride Side of Life, Talking Heads Nothing But Flowers (If you search "whole step key change" you'll get a bunch)

glassx··on Apple's Crystal Prison and the Future of Open Platforms
Yes, but the statement is still wrong. By default, apps signed with the free-certificates aren't discouraged, they're as first-class as AppStore apps (however, there's a setting to disallow them). Not that Apple is making any effort to clear those misconceptions...
glassx··on How a few lines of code greatly improved a crucial part of UX
The sessions are probably stored on the server, and they expire after some time.

It happens a lot here where I work: our legacy ASP.NET WebForms use Sessions (because it used to be easier this way) and once in a while people complain that the app kicks them after some 20 minutes.

glassx··on The most important tool for Ruby/Rails on *nix
I believe in the case of apt-get it's the responsibility of the Debian project. It's the same with other tools (yum, brew, macports).

Rails itself is normally installed via Rubygems (where it's updated directly by the Rails team), but the problem in this case lies with Ruby: for an up-to-date development/production environment you have to compile it by yourself or use something like RVM.

glassx··on Valve is developing Steam for Linux, says Michael Larabel of Phoronix
Well, it can help OpenGL and other cross-platform frameworks become even stronger. Studios will have more incentive to make games portable from the get-go, instead of relying on Windows/Direct3D. Even mobile, console and OS X users could benefit from that.
← PreviousPage 2 of 7Next →