HNHacker News
TopNewBestAskShowJobs

codecurve

1,560 karma · joined January 18, 2012

[ my public key: https://keybase.io/danprince; my proof: https://keybase.io/danprince/sigs/8AYDk4-RDKmDfqhI3Zvr4m2aPQy1DeZ86fGOs6WbGLU ]
submissionscomments
codecurve··on Constantly Confusing ‘const’
Probably for the same reasons you can't write

    var function diameter() {}
It's definitely a shame that the only way to achieve consistent behaviour between variables and named functions requires you to write the name twice.

    const diameter = function diameter() {};
If it wasn't for the usefulness of named functions for debugging and hoisting, I would just use:

    const diameter = function() {};
codecurve··on Constantly Confusing ‘const’
Totally agree, it is much more important to be able to reason about mutability.

I would disagree that it's super-easy to reason about var, despite being lexically scoped. It still causes an enormous amount of confusion when loops and callbacks are used together.

The PI example only really works because we all know what PI should look like. If you were using someone else's constant value and it accidentally got rebound it would be much harder to know.

codecurve··on Constantly Confusing ‘const’
I think that completely depends on the flavour of code you write. If you mostly use imperative styles, then the large proportion of your declarations will be `var` and `let`. It definitely makes refactoring harder in the direction you mentioned.

Alternatively, for a functional style, you have to have a fairly good reason for using `var` or `let`. I find myself treating them like I'd treat atoms in Clojure. They end up being the mechanism you use to make controlled side-effects.

I'll concede that `const` does have a complexity to understand...initially. However once you understand the distinction between assignment and value (you only have to understand it once), then you're back to a level playing field between both.

From then on, `const` gives you a guarantee about the assignment. Objectively, this guarantee eliminates complexity, you can look at a variable anywhere in a scope and know that it has the same value as at time of declaration (same TDZ exceptions apply). I don't see how this could be seen as backwards.

codecurve··on Constantly Confusing ‘const’
Why not use `const` as default? I would argue that using `let` instead is a premature optimization of readability.

It's easier to reason about a variable if you know it will always be one value—even if the value may be mutated (which is unfortunate).

`const` is a simpler construct. It has less rules and I would always suggest that using `let` will introduce complexity that only needs to be there when you can identify a genuine need to re-assign a value to your variable.

That said, I enjoyed the post. It's a good read!

codecurve··on The Fastest Blog in the World
You can use the Chrome dev tools to run an audit. One of the performance metrics it tracks is the number of unused CSS rules.
codecurve··on Binary in JavaScript
Sure, the underlying storage mechanisms are different and it doesn't support as many types, but I didn't say it was a good polyfill.
codecurve··on Binary in JavaScript
That's good to hear, I wasn't aware of Typed Objects. I guess the library linked at the end of the post is basically a very non-specific polyfill already? Well, using it like that is one way to get around bitwise littering.
codecurve··on Binary in JavaScript
Author here. There were a lot of ends that I tried to tie up that started to be difficult to find hard evidence for. Some of the string/object storage stuff is discussed casually in mailing lists, but there aren't great places I could point to and say: _this_ is the definitive answer. If you would point me in the right direction for some of these resources, I'd be happy to amend the article. Thanks for reading all the same.
codecurve··on Trine – A utility library for functional programming in JavaScript
(function double() { return this * 2; }).call(2) === 4

I didn't have to box anything to pass a primitive as this. Maybe some other versions are different, but this works in Chrome 40 and Firefox 33.

codecurve··on Ask HN: What accomplishment are you most proud of?
Either being 21 years old with a degree and a company or becoming a proficient musician as a self taught guitarist.
codecurve··on Learning Vim while playing a game
I teach a first year Intro to Unix module (CS and ICT) at a University in the UK.

We ran this for our students as an exercise and it went down really well. We've got people using Vim on a daily basis who probably would have never heard of it otherwise.

It's a great way to beat the learning curve that vimtutor represents, for people who prefer more visual challenges.

codecurve··on Gift of the Moon, Bane of the Spanish: The Story of Yerba Mate
I live in a house of four CS students in the UK and it is the staple drink at home. It fuels many of our programming sessions. However, we can't buy it in shops round here and we have to order it in bulk from the supplier. We probably get through a crate of the stuff every two weeks.

I imagine it would catch on in a far bigger way, but no one has heard of it. It was only through a HN article on SoundCloud's Berlin offices that we decided to try some.

codecurve··on There are too many shiny objects and it is killing me
That's very rarely the case, I think it's more to do with the fact that I'm still learning.

I've become more and more comfortable with FP over the last year and I enjoy being able to utilise the new things I pick up, but I don't think I've ever worked on a project purely to try something new.

I tend to experiment at work too and our products always ship.

codecurve··on There are too many shiny objects and it is killing me
This is really good advice. This is what I get out of hackathons. It doesn't matter whether it's clean, if you want to win, all that matters is that it works. You'll do whatever needs to be done to get there, rather than resting on some set of ideals. I just haven't quite figured out how to create the sense of urgency in my side projects.
codecurve··on There are too many shiny objects and it is killing me
My GitHub profile is a wasteland of dead side projects and my Gandi account is full of .io domains that I never quite got round to using. I very much identify with this post and I don't know why it happens.

When I'm at work I have no problem knuckling down and finishing a piece of software. However, in my free time, I'll come up with an idea, buy a domain, design a logo, create a repo, spin up a Digital Ocean instance, pick a stack, tune Vim, weigh over monetization options, consider open sourcing, the list goes on and on. Finally, I get started and it goes great, the code is really elegant, I put a new programming technique/trick to use, and then I think of something more interesting to do. The cycle goes on.

I enjoy writing music almost as much as programming, so developing games goes a whole level deeper. I'll get hyped up doing the game art, then start writing the soundtrack and by the time I get to writing code for the game, I'll lose focus.

The only times I have ever beat the internal system, is when I've been forced to focus on MVP. Hackathons, proof of concepts and toys. Once I have something working and demonstrable, I can often motivate myself to go back to it.

I don't have any other advice, but just know that you're not the only one who suffers from shiny stuff syndrome.

codecurve··on Retiring Python as a Teaching Language
Most editors have a JSHint plugin, which will check your code as you go and point out when you've made a syntax error or used a bad practice.

I use it with Syntastic + Vim and it's a long time since I've ever loaded up code in a browser and there's been a syntax error. Definitely worth checking it out if that's the last hurdle before switching.

codecurve··on Ask HN: What kind of salary should I be looking at?
At the moment, I'm in North Wales but the tech scene here leaves much to be desired. My first interview is in London and I'm completely open to the idea of moving elsewhere to work.

What's the differential between the salary for Cardiff/Newport and London?

codecurve··on Keypress: A robust JavaScript library for capturing keyboard input
More aimed at game developers, but for anyone who wants a super lightweight subset of this functionality.

https://github.com/danprince/keystate

codecurve··on MIT Scratch – Teach kids to program stories, games, and animations
Scratch was my introduction to programming, around 6 years ago. Since then, I've graduated with a degree in CS and co-founded a successful (and growing) software-house startup. Without having discovered Scratch, I'm not sure I would have decided to do Computing at A-level. No A-level, No CS degree. No degree, no startup.

In my case, it was the perfect way to learn about some of the important principles that underpin programming, without necessarily realising that it was happening. Scratch just allowed me to be creative with ideas for simple games. You can take away a lot of the cornerstones of imperative programming (loops, variables, booleans, conditionals) but also evented programming concepts; which will make sense straight away in a language like Javascript.

My father is a Head Teacher at a primary school in the UK and has introduced it into the ICT curriculum to great effect. There are primary age children (< 10 years old) starting to experiment with Ruby and Python at school, as a result of positive experiences with Scratch. It's is also how I interested my younger brother in programming and he in turn took A-level computing and has applied to study CS at University. I don't think Scratch was as much of a factor in his story, but it was certainly his starting point.

Overall, I think it's a fundamental stepping stone that children should have the chance to try at school. It represents the opportunity to find out whether you enjoy programming. Until I picked it up, it had never crossed my mind that I might.

Hats off to the Scratch team!

codecurve··on Algorithmic Art from the Past
Does anyone know what the name for the pattern #3 is? I've seen it referenced somewhere, but can't remember where or what it was.
codecurve··on Poll: What is your primary editor?
Ubiquity, elegance and efficiency. I've been writing a series of blog posts on Vim that you may find interesting. http://danthedev.com/vim-part-1-why/
codecurve··on Functional Programming for the Web. Lean by solving practical problems
Would be interested to hear what a seasoned Haskell programmer made of Purescript and this book. To me, it looks like a fairly seamless transition, but I'm a long way from an expert.
codecurve··on Show HN: Poll – Voting done simply in real time
Seems the Pusher quota has been exceeded for the frameworks demo.

    Error : {"type":"WebSocketError","error":{"type":"PusherError","data":{"code":4004,"message":"Account over quota"}}}
codecurve··on OkCupid Takes Public Stand Against New Mozilla CEO
This is ridiculous, shall we boycott Javascript as well, OkCupid?
codecurve··on Help Scale NPM
From the JS comments - made me laugh

  /**
   * Simple counter magic to make people engaged.
   *
   * @constructor
   */
codecurve··on Ask HN: Should I focus on my job or my degree?
Thanks for the feedback. I agree, relationships are the priority, but I can then extend the phrasing of the question to ask: are academic relationships more important than their industrial counterparts? I have engaged with most of the professors in the department (it was actually through one of them that I got the job), but almost without exception (it seems that) they are neither driven nor motivated and only a tiny percent of them have had any academic success.

Outside of CS I am a focused musician and graphic designer and I like to use that as both an escape and as diversification, so I'm not too worried about ending up as a boring Jack.

Somewhat due to my poor wording, it seems like people got the impression that I would be dropping out (or giving up on my degree), this is not the case. I just need to know how important it is that I achieve a good grade? Is it worth the sacrifice of job experience and possibly the position within the company?

codecurve··on StarWars + Git logs = StarLogs
From now, every time I create a new repo, the first commit message is going to be "A long time ago in a galaxy far, far away".
codecurve··on Live Chat with anyone on Facebook (even non friends)
After you send a message, you can select open in chat from the actions drop down.
← PreviousPage 3 of 3