by Andy Oram, Greg Wilson
ISBN: 9780596510046
Buy from O’Reilly
Found in 19 comments on Hacker News
Took a minute to track that down (Oran is spelled Oram?) https://www.oreilly.com/library/view/beautiful-code/97805965...
gls2ro · 2022-07-16 · Original thread
First, I do agree that Ruby ecosystem could do some things better and IMO in the last year or so there are some good projects happening in this space.

Second, I cannot refute your arguments. That is because I see them more of a personal preference or somehow expectations based on your programming history (I might be wrong of course as I don't know your programming history). As Ruby feels similar with other programming languages I think some kind of expectations of how things should be kick in. But Ruby has a specific design that is for example focused on "brevity" or "beauty" among multiple other thigs.

I worked so far in the last 15 years in multiple codebases in Ruby: large Rails apps, Sinatra apps but also smaller webapps. In all kind of combinations some of them I built and maintained alone and some of them were built in a team.

This being said, I don't remember a time when we have a big name conflict because we used a couple of gems and they were colliding.

I do remember when some colleagues were over using meta-programming too much or changing default behaviour of stdlib. But this can be fixed with coding guidelines and I take imposing coding guidelines over removing these features from Ruby as sometimes they make more sense than anything else.

Regarding ".self" I don't feel the need to use it. Once I got the call hierarchy I prefer not needing to write "self" where it is not needed.

But also in Ruby everything* is an object thus I feel that self is a bit more powerful so it should be used when when it is really needed like when defining methods and you want to indicate where that method belongs.

Regarding having multiple ways of doing the same stuff in stdlib, here we diverge as I prefer this diversity. I really like that we are multitudes in this community so code can be written in multiple ways, it is for me almost like a form of art when I read some case and I see how expressive can it be and how easy it is to get what it does even if it uses a different std method than I normally use.

I think if you want to get Ruby you should start by thinking that Ruby is a programming language created (IMHO) with the intention to let you express yourself but also make it so that other people should easily understand it.

It also worth reading this beautiful essay by the creator of Ruby: https://www.oreilly.com/library/view/beautiful-code/97805965... (sorry I could not find a direct link unwalled) and from there you will get a glimpse of why Ruby is in a specific way and see if you agree or not with that.

For example regarding your point with no leading self, Matz says in that essay "programs should ideally contain no unnecessary information" thus a lot of what you see in Ruby including having prepend instead of "insert(0, object)" is a manifestation of that.

ibejoeb · 2022-05-02 · Original thread
Elegant construction and elegant use can be disjoint. For construction, Beautiful Code is a good read on a bunch of real specimens.

https://www.oreilly.com/library/view/beautiful-code/97805965...

fanf2 · 2022-04-30 · Original thread
There is a chapter by Hank Warren all about popcount in the Beautiful Code book, https://www.oreilly.com/library/view/beautiful-code/97805965... and there is much more along similar lines in Warren’s book Hacker’s Delight https://en.m.wikipedia.org/wiki/Hacker's_Delight

My favourite use of popcount is for packing sparse vectors.

_xrjp · 2021-04-27 · Original thread
I found it, Greg's chapter `The Linux Kernel Driver Model: The Benefits of Working Together` on page 267

- https://www.oreilly.com/library/view/beautiful-code/97805965...

- https://github.com/stormtrooper96/books/blob/master/software...

So I'll definitely give it a read. Thanks!

adriantam · 2020-02-13 · Original thread
This is chapter 1 of "Beautiful Code" (http://shop.oreilly.com/product/9780596510046.do)
wallflower · 2019-11-26 · Original thread
“Beautiful Code” is flawed but it aims towards what you mentioned.

http://shop.oreilly.com/product/9780596510046.do

“The Architecture of Open-Source Applications”

http://aosabook.org

You also might be interested in “Coders at Work”.

https://www.goodreads.com/book/show/6713575-coders-at-work

andyjpb · 2019-04-01 · Original thread
That's great!

If you're interested in more detail about how a VFS (Virtual File System; the bit where it finds the file and then finds the data in the file) works, Chapter 17 (Another Level of Indirection) in Beautiful Code (http://shop.oreilly.com/product/9780596510046.do ) is well worth a read.

It explains how the VFS in FreeBSD works. How disks, partitions, volumes, filesystems, offsets, etc all get orchestrated together so that the Unix "single directory hierarchy" abstraction works as intended even tho' the actual data may be spread around a number of locations (both local and remote).

The concepts and ideas are largely applicable to other Unixes and Unix-like operating systems.

It's also a great example of how elegantly one can express polymorphic code, even in plain C.

msinghai · 2017-03-13 · Original thread
A few weeks ago, I spent some time in reading O'Reilly's Beautiful Code (http://shop.oreilly.com/product/9780596510046.do). The book is essentially a collection of essays from various programmers describing what they think of as beautiful code.

I particularly liked Brian Kernighan's description and implementation of a regex matcher, and Travis Oliphant's discourse about multidimensional iterators in NumPy.

Worth a read.

ibejoeb · 2016-12-20 · Original thread
I love reading commentary along with code, especially from the original authors. It's dated by now, but Beautiful Code[1] was a fun read. I really appreciated the chapter on the implementation of Subversion.

1: http://shop.oreilly.com/product/9780596510046.do

niftich · 2016-07-18 · Original thread
Urbit [1] is a real software effort that many have considered a deliberate performance art.

Beautiful Code [2] is a well-known book that attempts to examine the development of some successful software projects from the perspective of the lead developers, and how they came to design decisions.

Beautiful Architecture [3] is a similar book focusing on large-scale project design.

[1] https://urbit.org/

[2] http://shop.oreilly.com/product/9780596510046.do

[3] http://shop.oreilly.com/product/9780596517984.do

weej · 2016-03-13 · Original thread
"Beautiful Code: Leading Programmers Explain How They Think" is a book that attempts to to tackle this topic. "The authors think aloud as they work through their project's architecture, the tradeoffs made in its construction, and when it was important to break rules." The book has been sitting in my to-read stack forever. You might want to check it out.

http://shop.oreilly.com/product/9780596510046.do

mark_h · 2012-03-07 · Original thread
Beautiful Code (O'Reilly, http://shop.oreilly.com/product/9780596510046.do) has a chapter on the dictionary implementation.
slug · 2011-07-03 · Original thread
This an excerpt of the excellent book http://oreilly.com/catalog/9780596510046
There is a book called Beautiful Code by O'Rielly http://oreilly.com/catalog/9780596510046
ecaron · 2011-03-31 · Original thread
This is discussed best in the opening chapter of O'Reilly's Beautiful Code: http://oreilly.com/catalog/9780596510046. Google Books has a readable snippet of the section at http://bit.ly/g34QRh, but I highly recommend buying the book because it is a great read.
gnubardt · 2010-05-27 · Original thread
Sounds like Beautiful Code (http://oreilly.com/catalog/9780596510046).

Maybe if a user's submission becomes well liked they could be asked to write a more in-depth explanation or article.

fredoliveira · 2010-05-21 · Original thread
Here's a few recent buys:

  - Javascript: The Good Parts (http://oreilly.com/catalog/9780596517748/)   - High Performance Javascript (http://oreilly.com/catalog/9780596802806/) 
It's always a good time to buy a few classics:

  - Information Architecture for the WWW (http://oreilly.com/catalog/9780596527341/)   - Javascript: The definitive guide (http://oreilly.com/catalog/9780596101992/)   - Beautiful Code (http://oreilly.com/catalog/9780596510046/)