skysight-inc/HackerNews huggingface dataset:
Sometimes, comments are a justification. Sometimes you have to do things that seem like the wrong thing to when reading the code (like sending a POST request instead of a GET when a GET is clearly more appropriate, but you have to talk to a poorly-written API that will only respond to POSTs on that route). Comments help rationalize that decision for the next guy.

I also find TODO comments quite helpful. It requires far fewer brain cycles to process a TODO comment than to parse the code, figure out what it's doing, and make an assertion that it's incomplete.

Comments can also make code much more approachable to junior programmers, who may not have heard of principles like Tell Don't Ask, or Composition Over Inheritance. When I'm working with a junior dev, I find that comments usually reduce the number of interruptions I receive that are along the lines of, "Hey why did you do this thing this way?"

Really, it's just not a good idea to make sweeping generalizations like, "Comments are always failures". The real world has time and budget constraints, and comments are sometimes the most effective way to satisfy those without screwing the next developer to read the code.
What can I do for Mozilla? – Please enable JavaScript in your Browser. :)
Code may explain what your code is doing, not necessarily why it is doing what it does in the way it does.

Comments may be a code smell when it is necessary to explain what your code is doing.

Anywhere where you have some freedom to solve a problem one way or the other it may clarify why the implemented approach was chosen.
Keep your ego under control and close those deals
Then you will read the comment that says to do one thing but the program will do a completely other thing. I don't see any problem, do you?
I have to wonder if "breaking the wall" is correlated with being able to write more densely and create more functionality with less code.
List of Web Business Models
Commonly when traversing hierarchical data structures. If you're certain the data structure isn't accidentally cyclic or extremely deep, there should be no problems.
It’s an old list by now, but I keep updating it; you can also contribute to the original list (http://news.ycombinator.com/item?id=4924647) on which this was based.

I’m sure you have more great suggestions for what can go on the list; new models keep popping up with companies like Patreon.

Feel free to—also—post your suggestions on the Gist. GitHub currently does not support notifications for gists, so don’t get mad if I don’t get back to you. :)
I've certainly come across situations where the code and the comment don't line up, but that seems to arise from laziness more than anything else. If the comment is directly attached to a region of code, most developers I've come across will process both at the same time. The area where I see it fall apart most commonly is with javadoc-style comments. Most IDEs will even flag these issues, but they're often ignored.

A comment on its own isn't inherently harder to maintain any other piece of code or documentation. Sure, it's not zero cost, but I find more often than not they exceed the cost associated with not commenting.
If someone made a display, or some sort of filter for my macbook so I could see the screen properly outside, I'd be out there all the time!
There are times when you absolutely want to comment something like an "Add" or "Swap" function.

eg.

// The reason we use a custom swap function instead of

// the one that is shipped with the framework is because

// of an edge-case that occurs quite frequently in our

// scenario

// Refer to Change Request 345.

void Swap (Foo a, Foo b)
....
Most people here have mentioned how a reflective or transflective display helps a lot. These used to be much more plentiful, they were standard on PDAs for example. Kind of rare and expensive now.

One thing that no one has touched on. It is much easier to work if you use an inverted color scheme for your terminals. Black text on a white background works better when front-lighting LCD technology.
Ask HN: Recommended SSL CA?
I've had mixed experiences with a couple of different certificate authorities (Comodo and StartSSL) and began searching for some reviews, but I'm seeing a lot of sites that appear to be pretty biased for marketing purposes. So I figure why not ask HN, a reputable source for this kind of info.

I'm not looking for anything high-end since it's just for my SaaS startup that is not yet live and paying for itself. If things take off, I'll probably upgrade the cert, but for now, an easy to install cert for under $100 is probably ideal. What would you recommend these days?
I work in an open space in London. Even if I could setup hypothetically get access to a rooftop like you, I'd be pretty much drenching my laptop and catching a cold.

TL;DR: Jealous!
Stack limits are pretty large. It's a natural way to express many problems such as graphs (and their subsets trees).

When people talk of "Tail Call Optimization" (TCO) they are talking about a way to recurse without leaving things on the stack (tail-call meaning that the recuse call is the last thing in the function so the state of the function doesn't need pushed on the stack, it can be discarded.
From my personal experience, I just want to suggest you to avoid swimming pools areas and kids with water guns. Anyway, no working outdoors for me anymore.
yeah right, I'm totally going to give you my credentials. You from Nigeria by any chance?
It depends on what you call 'everyday imperative-style code'.

Without defining that, every answer to your question is correct.
How does the code handle a stack overflow? Stack overflows seems opaque to me, while preallocating memory (malloc) has mechanism to signal failures for proper handling. Can you point me to some code?
Well, native language and programming languages aren't the same thing and you express yourself differently in them. That's basically a given.

But comments are most useful when they explain why something is being done, not what's being done. The latter is usually simple to work out with even the most hideous code. But if I don't know what you were trying to do or why you did something in a particular way, seeing what you did alone may not be all that helpful, especially when maintaining code.
The Stanford Prison Experiment was flawed
Oh, I definitely see the elegance of expression programs or concepts recursively.

Is TCO used in C++? I've only ever seen it mentioned in reference to Scheme and Haskell. It's a compiler optimization, so it would be transparent to the programmer, right?
Because actors are famous for being "lucid and sensible"...?

(This is not a dig at Sir Stewart, I'm just pointing out that the two concepts "working actor" and "lucid/sensible person" are not necessarily linked -- as demonstrated by Brando, Depardieu etc.)
Apple Discharged Q3 2014 Earnings:-35.2M iPhones, 13.3M iPads, 4.4M Macs,
Have you ever considered that Valve is successful because of open allocation? It's not like this massive cashflow was conferred upon them by God.

That success exists because they're doing things right.

If you look at closed-allocation software companies that succeed, what you find is that a politically fortunate subset does exist on essentially open-allocation terms. They work on what they want, where they want, aren't penalized for creative output, and get shit done. That small percentage ends up driving the whole company. That being the case, why not improve the odds by giving more people (or, even, all the engineers) that freedom?

Google and Microsoft also have massive free cashflow and they don't use open allocation.

Microsoft has been in decline for 15 years and a large part of that is stack-ranking, which goes hand-in-hand with closed allocation.

Google is doing OK, but it's in cultural decline and has been since the ~2009 introduction of more traditional management... which is around when Google's engineering organization became more rigidly closed. (From 2002-2007, Google was somewhere between open and closed allocation, solidly mid-spectrum because it was engineer-driven.)
Try it, just write a tiny function that calls itself and has a local variable (make sure to use the variable after the function call so it's not optimized away).

Something like:

int recurse(int foo) {
int bar;
printf("%d\n", foo);
bar = recurse(foo + 1);
printf("%d\n", bar); //this is just to avoid bar being optimized away
return bar;
}

By me it seg-faults after 174,594 calls. Presumably that has to do with the size of the stack and the memory allocated for the function.
A simple(r) system to track your sleep without a wearable
The sky crane solves a very particular set of problems with landing a (relatively) small, functional rover on Mars. It's not really a general solution to returning a large payload intact to Earth.
I have never seen comments like these except during arguments that good code doesn't need comments.
If my garden was big enough, I'd get a shed. Or a gazebo, but I'd still call it a shed.

http://www.shedworking.co.uk/2010/07/neil-gaiman-shedworker....
Or create a function to handle that case, name it appropriately, and call it. Thus, no comment is required. You can also test the additional method in isolation, if you wish.

I appreciate that this type of thing is language dependent.
C++ optimizes only with -O2 or /O2 passed to the compiler (for GCC and MSVC++, not sure about Clang).
Pipelines 2014 – Conferência Internacional de Projeto e Construção de Tubagens
> I've never seen a language's style guide recommend avoiding comments before

An official style guide? Maybe.
But it is one of common philosophies. See for example:

"If you need to comment something to make it understandable it should probably be rewritten."

http://kotaku.com/5975610/the-exceptional-beauty-of-doom-3s-...
More than the language du jour, many of us evolve. The way I wrote in code in language X today is a bit different than how I wrote it 6 months ago. This is especially true when first starting a language. Then, as I've worked in more languages, I've been exposed to better techniques and those influence how I think about problems.

At any given time I'm writing code as clearly as I can given my experience and body of knowledge. It also is representative of my exposure to and familiarity with the problem domain at that point in time. As these things evolve, my older code ceases to be as clear as I thought. It may very well not be the way I'd solve the problem again.

And that's before I need to start making changes to code clarity to satisfy a hard requirement (reduce memory usage, cache values, tighten up performance, etc.).
But all too often, people who write hideous code sprinkle it with comments that merely explain what is done, at the lowest level.
The TPM is un-simulatable, that's the purpose of it.

The hypervisor is included in the remote attestation. The theory is, if you trust the signing keys used in the TPM (i.e. Intel/the hardware), then you can get a message from the remote computer that attests what code is running including the hypervisor. Thus you can conclude that the remote environment is safe against all but quite sophisticated hardware attackers (assuming a modern setup where you can lock cache lines and the TPM is integrated with the northbridge).
I think you are missing the point there. Sure, I completely agree with you that those comments are crucial, but they are not informing about the code doing a swap, they are explaining the need of the applied workaround.
> For scientific coding, comments should align with the underlying theory for the code

100x this. Scientific software should be held to a different set of standards than non-scientific software, primarily because you can probably not assume that your reading is familiar with the underlying domain.
Buy Yourself Time by Systematizing Your SaaS With Trello
He raises several interesting point and apple addresses only a few of them.
CSS Variables in Firefox 31 – new syntax
He's referring to the problem of comments becoming out of sync with the code they're referring to. Not everyone updates comments as they update code.
Google using python
http://www.google.com/support/accounts/bin/answer.py
Life Inside an Accelerator
Seriously cool. Please keep working on this!

Also, please make it a sidebar instead of a split bottom navigation bar. that would be much easier to read
Okay, that makes sense. Except it's so poorly executed in some examples that it doesn't look like the name hovering above a planet, but a name that's just been crossed out.
Well, there's exactly the reason I try and avoid distributor packaging as much as possible and prefer to use Maven from upstream. Not only is it much simpler but it means it's not being patched with "ugly hacks" by people who dislike the project. Sorry, Debian proved multiple times that this whole arrangement is a recipe for disaster. Maven is convenient and fast, I think I'll stick with it for now.
Yes. The industry is full of hacks. I don't see how that's a problem with comments though. They're going to write hideous code with or without comments.
http://www.google.com/support/accounts/bin/answer.py
did google accidently reveal their directory structure....
For those looking for a video tutorial, this one by David Sanders at SciPy 2014 https://www.youtube.com/watch?v=vWkgEddb4-A is a great start. More stuff at http://julialang.org/teaching/
“Stuck”
Good programmers sometimes have to do weird things.

Leaving a note about that weird thing is probably a good idea.
Splitting up a Git repo
They might think that the sleep pill will invisibly clip to my pillow, but I can guarantee that my hand or my face or my arm will constantly find it.
It's too much of a security liability for most of Apple's market. It shouldn't be there. Some slight convenience for 5 percent of Apple's market isn't a good trade-off.
That's why good comments are about explaining WHY you're doing something, or HOW to use the code, and possibly making the code itself clearer but only if there's no way to do that by introducing better variable and method naming.

Comments are highly valuable but like any tool they can be abused, or done in such a way that they don't make things better.
I disagree. You don't need to comment simple and universal concepts like this:

swap :: (a, b) -> (b, a)
swap (x, y) = (y, x)

or even this:

map :: (a -> b) -> [a] -> [b]
map f [] = []
map f (x:xs) = (f x):(map f xs)

Those functions actually are self-documenting. Trying to explain them further is just going to clutter the page.

On the other hand, at 10,000 lines of code, a lot of that being parochial business logic, I'm going to want high-level documentation of why all this code exists. My emotional impulse is going to be to throw out all this shit code (in the business world, all code is shit) so please tell me why that is a bad idea. (I know it is, and I'm not going to do it, but please tell me why I'm not going to do it.) I'm going to want an entry point. I can't count the number of days of life I've lost just looking for entry-points in gigantic enterprise codeballs. Like, what actually runs?

Actually, 10,000-line single-programs should be rare-- Big Software is almost always a mistake, see here: http://michaelochurch.wordpress.com/2012/04/13/java-shop-pol... but that's another rant.
TCO is available in plenty of other languages as well. Scala, Clojure, Erlang, and Elixir support it out of the box. Ruby has a VM setting for it, and there was a proposal to add it to JavaScript. I'm sure there are plenty of others.
Get a cert from Namecheap or gandi.
Thanks -- I just tried it, it came out to over 200k calls for me.

It is big, yes, but, in writing robust code, you have to anticipate and handle a stack overflow cleanly. How do you do this?
You could add some other exchanges to the P2P Gambling section. e.g. Betdaq http://www.betdaq.com
Examples of procedural noice algorithms
What i don't understand is how are they going to solve the problem of landing precision. The stage is passive from the retroburn (just after the stage separation) for the several hundreds seconds it is flying back, and large part of that trajectory is in atmosphere, and stage has a high sail factor: it is big and, being almost empty, lightweight. So it might be dragged by wind too far from the landing site to compensate in hover mode which is i assume only 100-200 meters or so, even if original entry trajectory is perfect. Ballistic missile warheads for example, accumulate about 100 meters or error due to this factor despite they are much smaller/have higher density and fly several times as fast. A an additional short mid-flight engine burn to compensate may be a solution but so far i haven't heard of that. Anyone has an idea?
Sorry, that slipped my mind. I thought it was a Reddit post. In any case, it wasn't a random Tumblr blog, it was reblogged by someone who has been the target of online hate because of whatever reason. Hate transfers onto associates.
I really love fig, it is a great tool to easily deploy multiple containers without a hassle and without having to know the intricacies of the docker command line. I nowadays use it for all my projects. Great to see it joining Docker. Very cool.
The thing with comments is: You should add them for people that don't want to read your code line by line.

I don't want to run my internal compiler in my head when i'm reading your code, so you better make sure there's at least a docblock above every function that describes in 2 sentences what it does so I can get a global overview of what the heck this file is doing.

People that suggest that 'the code is the documentation' are always forgetting that reading code is way more taxing on the brain than reading english.
ISRO Launch Vehicles [Infographic]
Here's a small function from a real world module used in a Haskell web backend. It decides whether a "work unit" is appropriate to pick from a queue. The first iteration was a pretty complex piece of code. When I refactor, I often think "this is unclear and should be commented," but I've learned instead to think "this is unclear and should be factored out and given a significant name." So I ended up with this:

shouldPickWorkUnit :: (ImportId, WorkUnit) -> STM Bool
shouldPickWorkUnit (k, u) =
case hostNameFor url of
Nothing -> return True -- Invalid URLs are fast to process.
Just hostName ->
takeWorkThat'sAlreadyDone <*>
(don'tTakeSomeoneElse'sWork <*>
don'tExceedTheRateLimitFor hostName)

This way, the domain logic is legible from the actual code, which strikes me as almost always better than having tricky code with comments. Trying for this also encourages "domain-driven abstraction," and this is one of Haskell's greatest strengths.

In fact, the remaining comment can be factored away too:

shouldPickWorkUnit :: (ImportId, WorkUnit) -> STM Bool
shouldPickWorkUnit (k, u) =
takeWorkWithInvalidUrl <*>
(takeWorkThat'sAlreadyDone <*>
(don'tTakeSomeoneElse'sWork <*>
don'tExceedTheRateLimitFor hostName))

Advice like "avoid comments" needs to be taken as a calling for actually spending time and effort to write obvious code, and for using appropriate abstractions!
Admittedly recursion is not done often, but in some cases it's very useful.
For example, recently I created an application with a tree record structure where the user could delete a node and it needed to delete all sub-nodes.
With recursion it's easy to tell: 'call yourself for all subnodes you have, then delete yourself'. This is something that's much more difficult to express with the usual for/while constructs.

Example:
https://github.com/skriticos/tac_workflow/blob/9890e66d60851...
Realdeal covering App Promotion Summit, London 2014 on the blog
Well, Osborne 1 was 10.7 kgs and it was considered a laptop, so there is that.
It's all in the delivery. But yours is pretty much the experience I have seen from the outside: anonymous tech female worker is NOT receiving rape/death threats on a daily basis from co-workers or customers.

I'm glad your life is as uninteresting as the regular IT guy ;)
Right, also, it doesn't actually say avoid comments, it just gives examples of where it's best to try and find an alternative.

In the bitcoinj code style guide there is a big section on comments that gives positive examples as well as negative examples:

http://bitcoinj.github.io/coding-conventions
ISS Debris Avoidance Maneuver – July 23, 2014
You're rather oddly equating free speech as what makes the US "the best place on earth". Which is an odd one on an article about the US having an impaired legal system, in the UK there may be more criminal sanctions against certain speech but you'll also get very well defended in a much fairer legal system.

Take the instance of the Robin Hood Airport Twitter trial -in the US you'd be relying on a public defender to make a 1st Amendment argument - win and you're grand, lose and the American justice system would bury you as a terrorist.
Almost no chance these will fly this year. We will only see 3 more launches this year IMO, and 2 will not attempt stage rescue, 1 will attempt on water as the previous ones. So wait till 2015...
We thought that there could be a good discussion on what are the advantages of being inside a startup accelerator (like http://jfdi.asia) vis-a-vis doing it all on your own. There is very little written by the incubatees themselves, so for entrepreneurs considering the benefits (that goes beyond just mentoring) against giving equity is difficult to judge. Hope this article helps.
If inmates are allowed to email, and also allowed private communication with their lawyers, why wouldn't they be able to have a registered lawyers' email address not be monitored, or to be able to flag an email as privileged exactly in the way they do with postal mail?

>Prosecutors once had a “filter team” to set aside defendants’ emails to and from lawyers, but budget cuts no longer allow for that, they said.

They seem to know that it's wrong, they're just becoming more confident that judges will let them do whatever they want.

I'd accept that inmates shouldn't be allowed to use the internet at all before I'd accept that budget cuts have made it too expensive for prosecutors not to use privileged communications in court.
Funnily enough, Russia 'copied' the shuttle design for the Buran.

That ship was almost exclusively designed for millitary use. It was speculated that they planned to carry nuclear weapons up in the cargo bay.
Whatever they go with, the tech is going to make a really killer subwoofer amp.

Looking at the requirements (mostly the high DC input) it seems that an IGBT class-D would be the logical starting point, but those are hampered by a 150kHz-ish max switching rate. I think Don Lancaster's Magic Sinewaves (http://www.tinaja.com/magsn01.shtml) meet the distortion requirements while offering the slowest switching requirements.

Would be fun to be on one of the teams for this.
> you have to anticipate and handle a stack overflow cleanly. How do you do this?

You use sigaltstack and catch SIGSEGV.

It's probably easier to handle if you hit a soft limit rather than the heap. Then you raise the limit, set a flag to make your functions unwind and reduce the limit again.
ha! I think its ok as long as all parties involved are travelling on the earth and not around it near the speed of light

http://en.wikipedia.org/wiki/Relativity_of_simultaneity
Because simpler code usually leads to less bugs, which is faster and cheaper than complex, buggy code.
Aha, so now we're back to talking about online harassment, which is NOT what the title of the linked article is implying.

People in this thread need to make up their minds.

And if you want me to listen to your arguments, don't side with people who are trying to hijack entire populations for their own agenda.
You just don't write a recursive program if there is the possibility that it may run out of stack space due to the provided arguments.
The nanny state in action. There are plenty of solutions available if you wish to block certain content. This just looks like it's doing something good.
Recursion isn't allowed for safety critical code in automotive or avionics applications

http://spinroot.com/p10/rule1.html