DEV Community

loading...
Cover image for Top 5 DEV Comments from the Past Week
The DEV Team

Top 5 DEV Comments from the Past Week

Avery D
Dev Community Business Development and Growth Intern (she/her)
・1 min read

Hi everyone!

Avery here, taking over for Peter this week. Enjoy the 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.

We all make mistakes and in the What is your debugging approach? thread @mohanarpit forgets to remove printf but owns it:

  1. Grep through the logs for any obvious issues or errors. With decent logging, 50% RCA happens here.
  2. Try to replicate the scenario in local environments and see the bug in action.
  3. Keep adding printf statements after each line of execution. Occasionally use the debugger as well on local to triage the issue.
  4. Forget to remove printf statements when committing fix.
  5. Create hotfix commit to remove debug logs πŸ˜„
  6. Actually deploy fix to production.

@cjbrooks12 brings out the math skills to figure out DEV's production database in How large is the dev.to production database πŸ€”:

I believe all uploaded images/videos are stored on a CDN, so I will not include them in my estimate. But let's get a few other numbers to try and get a better estimate.

  • This article has an ID of 186129, so I'll round to 200k articles for easy math.
  • The text in an article doesn't take up much space at all. I would guess most articles are a few KB in size, and the largest ones less than 100KB. Let's go with a median estimate of 50KB per article.
  • The most popular articles have a couple hundred comments, but most are probably around 10 or so. - Comments are much smaller than articles, so lets go with an estimate of 1KB per comment.
  • The homepage for logged-out visitors has "239,226 humans who code". So let's around to 250k registered accounts. I couldn't even begin to put an accurate estimate on the size of each account record, so lets just say 10kb to account for a bio, linked URLs, etc.

So let's do the math!

(200,000 articles * 50kb) + ((200,000 articles * 10 comments) * 1kb) + (250,000 users * 10kb) = 14.5 GB

I'm gonna put my official guess at 25 GB. Text-based media takes up much less space than you might expect!

Pulling up with graphs and breaking down blockchain @jmfayard tells us to work smarter not harder in Is Blockchain really changing the world at all?:

Hello, I have a boring answer for you.

Blockchain is neither useless nor it is likely to be a revolution.

products matter more than technologies

Blockchain is not a product, it is a technology.

New products that solves a real important problem in the real world can cause a revolution. That usually do not require a super sophisticated technology.

Wikipedia is built with PHP. It is a genuine revolution.

The guy who asked doctors to wash their hands before helping women to give birth caused a revolution.

The technology used there? water.

The result? Countless millions of women stopped to die.

Bitcoin is a product. But it solves as a problem that almost nobody has: there is no single Central Bank on Earth that I trust more than I trust my own cryptographic skills.

Bitcoin's main use case is: unregulated internet gambling.

It's pretty good for that to be honest.

the technology

What about the technology?

It is a technology at the peak of its hype cycle. Or maybe on the descending phase.

Lots of blockchain fans love to use complex words.

But what you have to understand is that Blockchain is basically two things

  • Blockchain is a merkle tree structure - better known to us with the three letters git.
  • Blockchain is a distributed consensus protocol.

The first part (GIT) is very useful, but it's not new. It is git

en.wikipedia.org/wiki/Git#Data_str...

The second part is new, but it's almost never the simplest solution to a given problem.

People are always asking the wrong question.

It's not: can we build dev.to on the blockchain?

Yes you can, but there is a much simpler solution that works.

The consensus algorithm is also terribly wasteful. If you care about climate change, and more generally about energy, the first thing you should throw away is the whole blockchain industry.

the right vision for the future?

The point about "democracy" are usually fake.

Trusting no-one is not the right ideal to strive for.

In the dark ages, we trusted no one.

@avalander uses the iconic line from the Princess Bride to format an introduction in What's a better way to start a conference talk than "Uh... okay, so I guess it's time to get started?":

Hello, my name is IΓ±igo Montoya and today I'll talk about why you killed my father, prepare to die.

Is usually a good format. Avoid filler words, state your intent and move on.

Another option is to start with an interesting fact loosely related to what you're going to talk about. People love learning silly things.

Did you know that potatoes originally come from Peru, where they have more than 1200 varieties of potatoes? In that sense, potatoes are a lot like Javascript frameworks.

I strongly dislike speakers that start with good morning or whatever and expect the audience to answer back and then they're like c'mon we can do better than this or I can't hear you, like, this is a conference Brad, not Bikini Bottom.

And speakers that start with I have a lot of slides, so I'll try to finish on time lose me immediately.

Finally, @worsnupd reminds us that objects as lookup tables come with a +1 in The Art of Refactoring: 5 tips to Write Better Code:

Great article! An important thing to keep in mind when using objects as lookup tables is that objects have prototype chains that will also be checked if you are not careful. Look at this example, using some code from the article:

There are a few fixes for this:

  1. Create the object without a prototype (Object.create(null)):

    const pokemon = Object.assign(Object.create(null), {
        Water: 'Squirtle',
        Fire: 'Charmander',
        Plant: 'Bulbasur',
        Electric: 'Pikachu'
    });
    // pokemon.toString does not exist!
    
  2. Only check the object's "own" properties (hasOwnProperty)

    function getPokemon(type) {
      return pokemon.hasOwnProperty(type) ? pokemon[type] : 'Mew';
    }
    
  3. As you also suggested: Use a Map which inherently doesn't have this problem.

Thanks for the content!



See you next week for more great comments ✌

Discussion (5)

Collapse
avalander profile image
Avalander

Oh, hey, I made it to the list! I want to thank everybody who bothers to read my (questionably useful) comments and my mum for raising me to be a reasonably okay person.

Collapse
averyd profile image
Avery D Author • Edited

Congrats to @mohanarpit , @avalander , @worsnupd , @jmfayard , and @cjbrooks12 for making the list this week! πŸŽ‰

Collapse
worsnupd profile image
Daniel Worsnup

Wow, I wasn't expecting this. Thanks for featuring my comment!

Collapse
simonholdorf profile image
Simon Holdorf

Thanks Avery! How come Arpit made it to the list again as he was already featured last week with this comment?

Collapse
averyd profile image
Avery D Author

Whoops! Human error. πŸ˜… just giving a little extra love from DEV I guess.