Hacker News new | past | comments | ask | show | jobs | submit | more c141charlie's comments login

Go nails code readability and documentation better than any other language I'm aware of.

For example, look at the package documentation for Go's list data structure at http://golang.org/pkg/container/list/.

5 seconds of reading this you immediately get what the package does and how to use it. Now let's say you want to know how the list is implemented. No problemo. Click the package files link list.go, http://golang.org/src/pkg/container/list/list.go, and you're presented with very readable source code.

Now compare this with Java. I just Google'd Java List. First link is this: http://docs.oracle.com/javase/6/docs/api/java/util/List.html

Documentation looks OK, but wait, this is the interface. I want to see docs for a concrete implementation. I'm tempted to click on the AbstractList link, but oh wait, that's just another non-concrete class that other List classes probably inherit from. Let's see, let's go to the ArrayList ... this looks good. http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList...

Nice. I wonder how they implemented this. And I'll keep wondering because I can't find a link to the source code. Maybe there is a link to it, maybe not. We're talking about Oracle so without knowing better, I'll assume there is not ...

Let's try Scala. Google "Scala List". Click on first link. http://www.scala-lang.org/api/current/index.html#scala.colle...

What the fuh is a "sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A, List] with LinearSeqOptimized[A, List[A]]"

Oh sweet, this thing has all kinds of methods, i.e. ++, ++:, +:, /:, :+, ::, :::, :\

Reading further, I see section in the documentation called "Shadowed Implict Value Members". Wow, I have no idea what that is.

Looking back to the Go documentation, I immediately "relax" as another commenter put it.

For some reason, I think Scala will end up being the next Java. It has so much momentum, runs on the JVM, has seamless interop with Java code. Has the Play Framework, AKKA, and thousands of other awesome libraries written for it. And if Scala powers Twitter, then I think this answers the scalability and concurrency question.

While I'm bullish on Scala, at the end of the day, I find Go's simplicity make it more beautiful than any other language.


>Nice. I wonder how they implemented this. And I'll keep wondering because I can't find a link to the source code. Maybe there is a link to it, maybe not. We're talking about Oracle so without knowing better, I'll assume there is not ...

If you were using Java the way people do in the real world, from your IDE, you'd already be looking at the source code.

>What the fuh is a "sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A, List] with LinearSeqOptimized[A, List[A]]"

It's an abstract class (generic, and covariant in that generic parameter) that implements some interfaces. It's not hard.

>Reading further, I see section in the documentation called "Shadowed Implict Value Members". Wow, I have no idea what that is.

Take it one word at a time, it's pretty easy. Value - a value. Member - a member of the class. Shadowed - perhaps a scala-specific term, but it means it's in some parent class but hidden because it's also defined in this class. Implicit may be a new and scary concept, but it's pretty core to scala; if you use the language you get familiar with it pretty quickly.


Right, you know exactly where everything is when it's your own messy room, but if an outsider wanders in, he can't tell the bed from the curtains.

I grant that there is sometimes a necessary tradeoff between power/abstraction and readability, but readability is still extremely important, and you can't just handwave away confusing language constructs and documentation with "it's obvious after you code in the language for a couple years". Simplicity and intuitiveness are powerful features in themselves.


I don't think we're not talking a couple of years, more like weeks or days.

How many actually new concepts are there? "sealed" (very simple, but ok it doesn't exist in other languages), "+A" for covariance (genuinely new, but you can ignore it until you want to use it). "with" for multiple inheritance I guess is new, but it works the same as "extends" inheritance (you might have questions about how it handles diamonds, but there aren't any here). Values and members should be familiar, as should the concept of shadowing if not the name (but there's not really a standard term for it).

Implicits are genuinely new, and genuinely complicate the code; I think of them the same way I think of lisp macros (they're too powerful, they're too easy to make the code incomprehensible with - but they enable things that we can't live without, and that we haven't found a safe way of allowing yet). But even then, the concept is very simple and easy to understand.

A big block of text with lots of unfamiliar words in is intimidating, but I don't think it's truly confusing or unreadable if you just take your time and actually try and read it.


> Go nails code [cut] documentation better than any other language I'm aware of.

That's because you haven't seen PHP's documentation.

Look at your Go's list example.

It doesn't even show how to create a list and fill it with items.

It doesn't have users' comments.

It doesn't explain much about the data structure. Can it be a circular doubly link list, for instance?

Is there a method to empty the list, or quickly insert more than one element?

Instead it has strangely named sections (like "type Element") that aren't obvious to somebody new to the language.

Sorry, but this documentation is shit.


  "Sorry, but this documentation is shit."
Woah. That's way off the mark. I'm currently having to use both the Go documentation and the PHP documentation and I will take the Go docs anytime.

Yes, they are short of useful examples but, then, so are the PHP docs. Worse than that I find most of the user comments on the PHP docs are noise: self-proclaimed PHP gurus trying to out-clever each other.

The Go Library docs have one major advantage: you can click on the supplied link to see the simple, understandable implementation.


That's a bit harsh. Library docs are for users of the language. I grant that the list package could use more docs (I personally find it a bad example) but for someone who knows Go, all the important stuff is there.

Juba surprised that you rate the PHP docs so highly, particularly the user comments. Typically those comments contain terrible advice!


Users' comments are important to figure out unusual behaviors, bugs, edge cases, to clarify documentation in general, and to add code examples. Of course, some of them will be incorrect and bad advice, that's why I think PHP docs should add up/down voting on each post.

More than anything, it creates the sense of community. You always know there are people reading and writing stuff about a specific method, and, most of the time, it's helpful.

Considering how bad and inconsistent PHP is, their documentation is amazing.


Documentation is for documentation by the people who implement the language and know how it should be best used. User comments on official documentation are likely to have tons of different coding styles, so a new user would pick up a lot of bad habits.

If all of the docs are written by go developers/contributors who know that the code in examples should be consistent, then all those bad habits aren't ingrained in new users.

Something golang has that I don't know anyone else has is this:

http://talks.golang.org/2012/concurrency.slide#1

Also another thing about Go, is the source code for each of those packages is extremely easy to understand... it's truly self documenting... there's also the option of looking at the list_test.go file.

I will admit a method to empty the list as well as insert more than one element would be nice.


Facebook. Twitter. Uninstalled. What about a moratorium on Hacker News? Personally, I could have launched several apps with the time I've spent reading Hacker News. However, I get a lot out of HN ... Damn ...


I am a bit late to this thread, so you may not see my response. Regardless...

I have wondered about this as well. I am considering two strategies:

1) Stop checking HN at all, and subscribe to Hacker Monthly (http://hackermonthly.com/), which is the best articles of the month in a nice format.

2) Schedule a time to check it once a week, and only look at the list of posts with over 200 points. http://news.ycombinator.com/over?points=200

We have to stop spending time on these sites, even when it seems valuable. Nothing is as valuable as actually building something and interacting with users.


>> Women stay the hell away from hacker-spaces, conferences and tech initiatives because of on-going experiences of misogyny, abuse, threats, put downs, belittlement, harassment, rape.

To be clear, anyone who has abused, threatened, or raped someone should be criminally prosecuted. And if you act unprofessionally, you should be disciplined, fired, removed, etc. It doesn't matter what your race, sex, age, sexual orientation, or educational background is, there is no excuse for mistreating or restricting the liberty other another human being.

That said some of this post doesn't fit with what I see historically, globally, or in my day to day activities.

For example, Ada Lovelace is widely recognized for envisioning the first computer program. Marisa Mayer is the CEO of Yahoo. Meg Whitman runs HP. I work on a team of ridiculously talented software engineers, many of whom are women. Several books I've read to learn how to program were written by women. There are many women who have been tremendously successful and influential in tech.

With regard to women's rights and attitudes towards women, we've come a long way, and undoubtedly have further to go. But I'm optimistic that tremendous opportunities await women. I'm hopeful that ultimately intelligence, ingenuity, drive, knowledge, and experience will lift women above the experiences described in this article.


Very moving. Now inverse the situation, where it's your child who dies. The pain would be at least 2x worse. And this is what happened in Connecticut today.


This is a simple one, just watch Dr. Strangelove.


WRT "if I drank radiation laced water because a chemical company was disposing of their waste in my backyard and I didn't know" from my limited understanding of Libertarianism, they do believe the government and legal system should promote property rights. Therefore, if a company pollutes your water supply, you would have legal recourse to recover damages assuming you live long enough.


I don't know what Apple stole/didn't steal. But do you remember what the number 1 selling phone was before the iPhone? According to Wikipedia it was a Nokia 1200. I had a Motorola Razr.

Jobs and Apple were a decade ahead of their competition.


I often hear people talk up how the iPhone was never tested in usability labs with non-apple employees. Then I hear that the iPhone was heavily tested.

What actually happened? Does anyone know definitively whether or not it was tested by non-Apple employees before launch?


Fabulous work.


Gee, I wish Microsoft would fix the innumerable bugs associated with Mac Office Outlook & Word before getting all excited about retina displays.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: