News for hackers. Stuff that matters.
Re:Ask HN: What are some examples of beautiful software? by tbrock on Sunday March 13, 2016 @08:55PM (#11280294)
C: anything by antirez (redis, etc...) Redis is the epitome of well written understandable C.

Ruby: anything written by _why (if you can find the source) He once gave a whole presentation on the splat operator and it's bizarre uses that gave me goosebumps. A true artist. The code twists and contorts ruby in unimaginable ways.

JS: anything written by TJ hollwaychuck (express, mocha, etc...) Express is so simple but powerful, when you read the source you can't help but wonder where the rest of the code is.

Python: anything written by Kenneth Reitz (Requests, legit, records...) This guy can lay down some serious Python and gets things done. He writes the batteries that python should have had included.

Re:Ask HN: What are some examples of beautiful software? by oluckyman on Monday March 14, 2016 @12:52AM (#11281140)
"The code twists and contorts ruby in unimaginable ways." Doesn't sound like my idea of beautiful software.
Re:Ask HN: What are some examples of beautiful software? by skewart on Monday March 14, 2016 @01:25AM (#11281225)
I completely agree. It sounds like the opposite of beautiful software if you ask me. Maybe it's interesting, thought-provoking, or amusing code, but not beautiful.
Re:Ask HN: What are some examples of beautiful software? by ikurei on Monday March 14, 2016 @04:48AM (#11281701)
Beauty comes in very different forms. Not all beautiful paintings are pleasing and peaceful fields for flowers; IMHO, something can be dark, strange, even scary, and still beautiful. E.g.: The Garden of Earthly Delights[1], or It Follows[2].

[1] https://en.wikipedia.org/wiki/The_Garden_of_Earthly_Delights [2] http://www.imdb.com/title/tt3235888/

Re:Ask HN: What are some examples of beautiful software? by tbrock on Monday March 14, 2016 @02:01AM (#11281306)
I found it beautiful because I had never thought to use the language in that way before I had seen him do it. It wasn't hard to understand once you understood. :-)
Re:Ask HN: What are some examples of beautiful software? by agumonkey on Monday March 14, 2016 @06:58AM (#11282099)
It's more enlightenment / thinking out of the box / less is more beauty.
Re:Ask HN: What are some examples of beautiful software? by Obi_Juan_Kenobi on Monday March 14, 2016 @02:12AM (#11281336)
I think it's perhaps not inappropriate for Ruby; it has a community that's all about 'magic' and even 'tricky' beauty. I certainly agree there are problems with this, but I also see how this is appealing in certain contexts.
Re:Ask HN: What are some examples of beautiful software? by azaras on Tuesday March 15, 2016 @05:16AM (#11288368)
This is awful code for Python but beautiful for Ruby. Python is "simplicity" and Ruby is "clever".
Re:Ask HN: What are some examples of beautiful software? by Biganon on Sunday March 13, 2016 @09:03PM (#11280331)
Isn't Flask made by Armin Ronacher?
Re:Ask HN: What are some examples of beautiful software? by tbrock on Sunday March 13, 2016 @09:09PM (#11280362)
Oh right, whatever Kenneth Reitz did then
Re:Ask HN: What are some examples of beautiful software? by Hovertruck on Sunday March 13, 2016 @09:30PM (#11280468)
Notably the "requests" library
Re:Ask HN: What are some examples of beautiful software? by tbrock on Sunday March 13, 2016 @09:53PM (#11280553)
That's the one! The reason I fell in love with requests was because it was leagues better than python's own http lib. Pay attention to the way he designed he API, it's genius. Updated my comment.
Re:Ask HN: What are some examples of beautiful software? by vram22 on Thursday March 17, 2016 @03:07PM (#11306740)
requests is built on top of urllib3, BTW.
Re:Ask HN: What are some examples of beautiful software? by abustamam on Monday March 14, 2016 @12:33AM (#11281088)
Too bad TJ stopped writing JS and started writing Go.
Re:Ask HN: What are some examples of beautiful software? by max_ on Monday March 14, 2016 @02:18AM (#11281352)
TJ tends to jump mon on from one language to another.. first Ruby(when Ruby was the thing), then JS(when NodeJS became popular) and now Golang(the current "thing")
Re:Ask HN: What are some examples of beautiful software? by lucidquiet on Monday March 14, 2016 @02:47AM (#11281400)
'jump' -- I doubt it was hasty. Languages have issues, why stick with one when there are plenty to choose from. Of course, I like Golang, so somewhat biased -- it just appeals to my sensibilities, perhaps it does for TJ as well.
Re:Ask HN: What are some examples of beautiful software? by timqian on Monday March 14, 2016 @05:57AM (#11281875)
And now he is writing a language https://github.com/tj/luna
Re:Ask HN: What are some examples of beautiful software? by Matthias247 on Monday March 14, 2016 @10:48AM (#11283148)
Look at the changelog. He seems to have stopped this.
Re:Ask HN: What are some examples of beautiful software? by tbrock on Monday March 14, 2016 @12:36AM (#11281097)
Yeah, too bad. Apex, his first go thing, is pretty great though.
Re:Ask HN: What are some examples of beautiful software? by kakwa_ on Tuesday March 15, 2016 @03:53PM (#11292478)
I've not used it in recent years, but PolarSSL (now mbed TLS) was quite nice for a crypto library. It's a light, simple and clear C library.

Not directly code, but the "Beyond pep 8" talk at PyCon 2015 by Raymond Hettinger is quite nice (https://www.youtube.com/watch?v=wf-BqAjZb8M). It gives interesting tips on how to separate "business logic" (the high level problem you try to solve) from the "purely technical stuff".

Re:Ask HN: What are some examples of beautiful software? by skewart on Monday March 14, 2016 @01:34AM (#11281246)
I think that list is more of an answer to the question "What are some examples of widely-used FOSS projects created by famous programmers" than it is an answer to OP's question about beautiful software.
Re:Ask HN: What are some examples of beautiful software? by codezero on Monday March 14, 2016 @02:17AM (#11281351)
I'd love to see your recommendations. Personally I find the redis source code to be extremely readable and well organized.

Also these people didn't become "famous" for their Instagram selfies.

Re:Ask HN: What are some examples of beautiful software? by iurisilvio on Monday March 14, 2016 @09:53PM (#11286952)
Python: anything written by Kenneth Reitz or Armin Ronacher. You probably already used something from them.

Beautiful APIs and clean code. It is easy to contribute to their projects.

Re:Ask HN: What are some examples of beautiful software? by blablabla123 on Monday March 14, 2016 @05:32AM (#11281800)
>C: anything by antirez (redis, etc...) Redis is the epitome of well written understandable C.

The first file I opened has 3 gotos but maybe it's pure randomness... ;p

Re:Ask HN: What are some examples of beautiful software? by lorenzhs on Monday March 14, 2016 @07:15AM (#11282162)
gotos are sometimes used in C for error handling (to release resources), it's a simple way to do cleanup:

    void foo() {
        int* foo = malloc(...)
        if (foo == NULL) goto err_foo;
    
        int* bar = malloc(...)
        if (bar == NULL) goto err_bar;
    
        /* code */
    
    err_bar:
        free(bar);
    err_foo:
        free(foo);
    }
That's a use of goto that's often considered non-evil, probably because the alternatives are typically a lot more ugly.
Re:Ask HN: What are some examples of beautiful software? by lokeshk on Monday March 14, 2016 @12:36PM (#11283795)
Sorry to be a stickler, but the error handling in your method "frees" a resource even when nothing was allocated to it. Freeing a null pointer is as such an undefined behavior.
Re:Ask HN: What are some examples of beautiful software? by Someone on Monday March 14, 2016 @03:32PM (#11284962)
http://www.open-std.org/JTC1/SC22/wg14/www/docs/n1124.pdf, section 7.20.3.2 "The free function":

"The free function causes the space pointed to by ptr to be deallocated, that is, made available for further allocation. If ptr is a null pointer, no action occurs."

Re:Ask HN: What are some examples of beautiful software? by PeCaN on Monday March 14, 2016 @05:00PM (#11285549)
Dereferencing a null pointer is undefined behavior. free() on NULL is defined to be a no-op.