Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



"The code twists and contorts ruby in unimaginable ways." Doesn't sound like my idea of beautiful software.


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.


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/


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. :-)


It's more enlightenment / thinking out of the box / less is more beauty.


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.


This is awful code for Python but beautiful for Ruby. Python is "simplicity" and Ruby is "clever".


Isn't Flask made by Armin Ronacher?


Oh right, whatever Kenneth Reitz did then


Notably the "requests" library


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.


requests is built on top of urllib3, BTW.


Too bad TJ stopped writing JS and started writing Go.


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")


'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.


And now he is writing a language https://github.com/tj/luna


Look at the changelog. He seems to have stopped this.


Yeah, too bad. Apex, his first go thing, is pretty great though.


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".


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.


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.


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.


>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


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.


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.


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."


Dereferencing a null pointer is undefined behavior. free() on NULL is defined to be a no-op.




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

Search: