HN user

saturnflyer

318 karma

I'm the owner of Saturn Flyer, lead developer of Radiant CMS and author of Clean Ruby (http://www.clean-ruby.com)

[ my public key: https://keybase.io/saturnflyer; my proof: https://keybase.io/saturnflyer/sigs/1b51SrA-WjDVL6tnHd3bv3EXpAkCGn4nwo7b9ADqafQ ]

Posts30
Comments41
View on HN
github.com 3y ago

Polyfill-data gem adds the Ruby 3.2 Data class to lower Ruby versions

saturnflyer
2pts1
www.saturnflyer.com 7y ago

Reading Ruby Metaprogramming Inside Devise

saturnflyer
2pts0
www.saturnflyer.com 8y ago

Fix it now

saturnflyer
1pts0
www.saturnflyer.com 9y ago

7 ways to evaluate Ruby gems, and 1 crazy idea

saturnflyer
1pts0
www.saturnflyer.com 9y ago

Why write code when more dependencies will do?

saturnflyer
2pts0
www.saturnflyer.com 9y ago

Building tools and building teams

saturnflyer
1pts0
www.saturnflyer.com 9y ago

Building a Ruby tool that's easy for your team to use

saturnflyer
2pts0
www.saturnflyer.com 11y ago

Ruby: the difference between instance_eval and instance_exec

saturnflyer
3pts0
clean-ruby.com 11y ago

Ruby DSL Handbook

saturnflyer
84pts29
www.saturnflyer.com 11y ago

Ruby Forwardable deep dive

saturnflyer
1pts0
confreaks.com 11y ago

Eastward Ho a Clear Path Through Ruby with OO

saturnflyer
1pts0
www.saturnflyer.com 11y ago

Forwarding Messages with Tell, Don't Ask

saturnflyer
2pts0
www.saturnflyer.com 12y ago

Delegation Is Everything And Inheritance Does Not Exist

saturnflyer
2pts0
www.saturnflyer.com 12y ago

How abstractions encourage good thinking

saturnflyer
3pts0
www.saturnflyer.com 12y ago

Easy Metaprogramming For Making Your Code Habitable

saturnflyer
34pts1
www.saturnflyer.com 12y ago

What to code (in Ruby) when you know what you want

saturnflyer
4pts0
www.saturnflyer.com 12y ago

How to make your code imply responsibilities

saturnflyer
38pts9
www.saturnflyer.com 12y ago

How to work with presenters and collections of objects in Ruby

saturnflyer
1pts0
www.saturnflyer.com 12y ago

Finding conventions in Ruby code and handling display of dangerous data

saturnflyer
1pts0
www.saturnflyer.com 12y ago

The Easiest Way To Handle Displaying Bad Data in Ruby

saturnflyer
1pts0
github.com 13y ago

Temporarily add behavior to Ruby objects with Casting

saturnflyer
1pts0
www.saturnflyer.com 13y ago

Simplifying JS function arguments for recursion with this

saturnflyer
1pts0
www.saturnflyer.com 13y ago

Ruby delegate.rb secrets

saturnflyer
32pts2
arrgyle.com 13y ago

Automated web testing is hard

saturnflyer
1pts1
cascade.io 13y ago

Cascade - custom design toolkits for startups

saturnflyer
15pts4
codefol.io 14y ago

Deep dive into Rails/Rack parameter parsing

saturnflyer
1pts0
leanpub.com 14y ago

Functional Programming for the Object-Oriented Programmer by Brian Marick

saturnflyer
80pts28
richkilmer.blogs.com 14y ago

Striving for Civility in the Ruby and Rails Community

saturnflyer
1pts0
www.saturnflyer.com 14y ago

How To Preserve Idioms In Ruby Subclassing

saturnflyer
1pts0
www.stellman-greene.com 14y ago

User Stories vs. Use Cases

saturnflyer
1pts0

I'm on a project that isn't yet on ruby 3.2 and wanted to use the new Data class. I implemented this to allow me to move to it easily.

It does still have 1 failing test about redefining the initialize method with a block, but it works for all other cases.

The Ruby 3.2 Data class is based on C code from Struct. This is all implemented with Ruby.

Ruby DSL Handbook 11 years ago

Yes. Too often this is done even with complex procedures inside methods. A good DSL should be syntactic sugar for making things easy or at least provide some syntactic vinegar for doing non-recommended things (while still allowing them).

Ruby DSL Handbook 11 years ago

Ah. I see. That Ruby doesn't afford this can be somewhat annoying. A counter example is using "alias". It can accept bare words, symbols, or strings. If you really wanted to get around this you could use method_missing on the class but that can open a can of worms.

Ruby DSL Handbook 11 years ago

This surprises me. Can you offer an example of those types of problems in some Ruby code?

Ruby DSL Handbook 11 years ago

Not yet. But you can signup for a 5-email crash course. It's being updated almost every day now as I add more content.

Ruby DSL Handbook 11 years ago

I'm the author. In fact, the first bit of advice I have in the book is: Don't. DSLs often involve metaprogramming, but they don't have to. I'm writing it to record the code practices that I have found useful in getting things right and gather advice and tips from others who have done the same. DSLs are always about communication, so my goal is to create a book that helps developers communicate the purpose of the aspects of their project through code.

The article is about writing better code. My guess is that the PHP developers who do want to write better code would probably take the advice. Is your point that nobody should ever suggest that PHP developers write better code?

He says: "Working with others to get patches accepted and bugs closed is a crucial skill in writing good code"

This article does not tell people to patch Apache. The point, as for as I can tell, is to explore the projects you use so you can learn to write better code.

Then you say "they can't patch the most used webserver in the world like that"

What is "like that"? As far as I can tell it's "working with others". Although I've never patched Apache, I'm confident I'll need to work with others to do so.

The article gives good advice. I don't understand why you would jump to the Dunning–Kruger effect to seemingly assume that the readers are incapable of following the advice.

This is why I made the point about killing my other "product". I had nowhere to go with it. Perhaps I didn't say it well enough, but my initial plan was to build something but the problem wasn't marketing, it was that nobody wanted it.

My book, however, people want. I looked for what developers need first and then built a product around that, rather than thinking of something that might be nice and try to get people to buy it (like my CMS hosting).

This is a really good question. I actually avoided recording this because I didn't want to depress myself during the writing. I spent a LOT of time on this.

It does, however, come from real-world work. My client projects have been successful from techniques in the book. I'd need to split hairs to determine what time was spent where and in the end I just needed to write.

It's the same problem with choosing a ebook platform. No tool does you any good until you are actually using it. I'm currently writing in Apple's Pages app because it was the nearest and easiest way to just get started.

The benefit of a product is that it can become many things and the hours put into it can be easily won back with more sales.

Thanks for clarifying. I had most of it written before posting and had forgotten the code samples. My copy of Design Patterns is packed up for a move. I've update it to refer to C++.

Actually, people have visited, but few have stayed to read. My goal is to clarify the concept. I did plenty of research before writing this including asking Lieberman and others about it. I first wondered how everyone's notion could be wrong and doubted that my understanding was correct.

This is a term that others have attempted to clarify as well http://javalab.cs.uni-bonn.de/research/darwin/delegation.htm...

I'm planning to follow up in another post, but Gunther Kniesel coined the term "consultation" (http://javalab.cs.uni-bonn.de/research/darwin/delegation.htm...) and I've used a generic "attendant" term to refer to the other object.

Here's an excerpt from my take on the 2 characteristics of consultation (or what is typically called "delegation") in my book

---- The first is the connascence of method names between collaborating objects. Connascence refers to the point and type of coupling between objects where a change in one object requires a change in the other. Consultation occurs when the message recipient forwards a message to another object which handles the response to the same message. A calculator would receive a balance message and forward that message to an account which responds to balance. Rails’ implementation of delegate does include a caveat that the message might be prefixed before it is forwarded, but the implementation is still connascent by method name. The second aspect of consultation is that the message recipient makes no modifications to the algorithm for handling the response. ----

I wrote to Lieberman to ask his opinion and he sided with NOT introducing the "consultation" term. But his reason was not because our misguided understanding of delegation is correct, his reason was because we already have a name for this: forwarding. The quote above is from my argument about why I think it is valuable to use the term "consultation".

I never said delegation should be redefined. In fact I'm pointing out that the GoF did the redefining. In the history of Object-oriented programming "delegation" means what it was described to be. I never said that any particular implementation is "better software design". Please show me where you got these things that I supposedly said.

In programming terms, he did. I appreciate that it is an English language word and was initially what I thought it meant. But when he applied the term he meant it specifically. Otherwise, we already have a term for this: forwarding.

So why not argue about people using "delegation" when they just mean "forwarding"?

Lieberman invented this term. It did not exist prior to his work. I have confirmed this with Lieberman himself as well as Jim Coplien and David Ungar.

The Design Patterns book sought to clarify our language yet it has this error. I'm seeking to clarify our language.