DEV Community 👩‍💻👨‍💻

Cover image for Top 5 DEV Comments from the Past Week
Peter Kim Frank for The DEV Team

Posted on

Top 5 DEV Comments from the Past Week

This is a weekly roundup of awesome DEV comments that you may have missed. You are welcome and encouraged to boost posts and comments yourself using the #bestofdev tag.

@abraham chimes in with a very relatable confession in the Tell me a coding confession thread. Obviously there's a time and place to commit something to memory, but IMO it's fine if you also want to rely on a accessible reference you know is there:

I Google almost everything because I don't remember the APIs, just that there is a way to do it.

In Please don't commit .env, @bgadrian provides some guidance on what to do right after installing your operating system:

  1. Install the operating system
  2. edit your user global gitignore vim ~/.gitignore
  3. paste:
.idea/
.vs/
.env
.pk
.pem
.pub
Enter fullscreen mode Exit fullscreen mode
Enter fullscreen mode Exit fullscreen mode
Enter fullscreen mode Exit fullscreen mode

Do not think you will not make a mistake, be proactive and presume you will, we are only humans.

Edit: this will prevent adding to your project your IDE config files, environment and private keys

I really enjoyed the Stop trying to be so DRY, instead Write Everything Twice (WET) article. Sometimes a concise re-statement can help make the central take-away a bit more concrete. That's what @nielsbom does here:

Yes.
So summarizing: only make an abstraction for something if you can remove three repetitions.

Tasked to Explain Lazy and Eager Loading Like I'm Five, @ryan very much comes through:

Your friend is coming over to play.

Eager Loading: You open the toybox and pull all the toys out.
Lazy Loading: You leave the toybox alone until your friend arrives.

When should we use them?

Eager Loading: You open the toybox and pull out the toys you know you are going to play with. Your friend arrives and you start playing right away.

Lazy Loading: You aren't sure what your friend wants to play, so you wait for her to arrive.

When should we not use them?

Eager Loading: You open the toybox and pull out every toy just in case you will play with it. Your friend rings the doorbell. You can't answer because you're still pulling out toys. Eventually you answer the door after she's been waiting a while and let her in. When she leaves you have unused toys all over the floor.

Lazy Loading: Your friend's favorite toy is your cowboy figure. But you don't like it, so it's buried at the bottom of the box. Your friend arrives and wants to play with the cowboy. She has to wait for you while you dig through the toy box to find it.

Finally, @henrique answers What is the hardest thing about learning to code? with some thoughts about the perpetual struggle to continue learning. If you can't learn on the job, that can easily contribute to an unhealthy work/life balance:

Usually they (bosses) think not, but learning constantly is part of the job and should to be done in working hours, precisely to have this work-life balance.

See you next week for more great comments ✌

Top comments (2)

Collapse
 
peter profile image
Peter Kim Frank

Congrats to @abraham , @bgadrian , @nielsbom , @ryan , and @henrique for making the list this week!

Collapse
 
henrique profile image
Henrique Macedo

It's a pleasure! 👊

Let's Get Hacking

Join the DEV x Linode Hackathon 2022 and use your ingenuity and creativity to build using Linode.

Join the Hackathon <-