DEV Community

MurrayVarey
MurrayVarey

Posted on

Which Single Resource Has Most Affected How You Code?

There are so many programming resources available. With that said, is there a single one that had the biggest effect on your code?

For me, it would be Practical Refactoring by Llewellyn Falco and Woody Zuill.

On the face of it, this video should be extremely dry -- it's literally just a couple of guys refactoring code for two hours. In spite of that, those two hours shook me to my legacy-coding core. Refactoring has since become vital to my work and (dare I say it) fun!

So how about you? Be it book, blog, video, or whatever -- which single resource has most affected how you code?

Oldest comments (8)

Collapse
 
vonheikemen profile image
Heiker

This talk by Anjana Vakil. A non scary introduction to functional programming. It really gave me the tools to start digging into the "practical" parts of functional programming that I could use in javascript.

This one is interesting. In this you see how powerful pure functions can be.

Collapse
 
murrayvarey profile image
MurrayVarey

Sounds awesome! I've shied away from functional programming in the past, so will definitely check this out. Is it something that you use a lot?

Collapse
 
vonheikemen profile image
Heiker • Edited

Sure. Even just using pure functions can change the way you write things.

Whenever I get to write a function from scratch I end up with something like this.

function big_function() {
  const data = get_data();

  const errors = validate(data);
  if(errors.length) {
    show_errors(errors);
    return;
  }

  const clean_data = some_process(data);
  const saved = save_stuff(clean_data);

  if(saved == false) {
    show_errors(['oops, something went wrong']);
    return;
  }

  show_message('we good');
}

I have a 'big function' that coordinates a bunch of 'little functions.'

The things that can have an effect on the outside world get their own functions and most of the time don't process anything, they just show/save/send whatever you throw at them.

Almost everything ends up being a two step process, handle the data and using the data.

The most important thing is to make the little functions as predictable as possible. Given the same inputs should always give you the same result.

Collapse
 
deciduously profile image
Ben Lovy

I'm late to this party, but I cannot credit The Little Schemer enough for resetting how I think about code and computation. I think back on lessons directly from this text nearly every single time I write code, I can't think of anything else as indispensable or thoroughly enlightening.

Collapse
 
murrayvarey profile image
MurrayVarey

I think back on lessons directly from this text nearly every single time I write code

That's a serious endorsement! Do you use Scheme (or some other form of Lisp) much?

I see The Little Schemer recommended a lot, but have never read it myself. Maybe now is the time ...

Collapse
 
deciduously profile image
Ben Lovy • Edited

Nope, never before reading that and not once since, save a little Clojure a few years ago. It's a book about programming, and more specifically recursion, not necessarily Scheme. Scheme is a very minimal language and almost functions more as a formal notation for computation than anything else.

Thread Thread
 
murrayvarey profile image
MurrayVarey

Awesome -- I'll definitely check it out. From the link you've provided, I can see that the writing style is up my street.

Thanks Ben!

Thread Thread
 
deciduously profile image
Ben Lovy

If you dig in, I highly recommend following along with Racket. It takes a little discipline, but don't let yourself read the "answer" column until you've taken a stab at implementations yourself. The code built up throughout the book is cumulative, by the end you'll want to have it all saved anyway.