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

Top 5 DEV Comments from the Past Week

peter profile image Peter Kim Frank ・1 min read

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.

The Tell me an unpopular software opinion was one of the most popular threads last week, and had plenty of well-loved replies. If an unpopular opinion receives lots of positive reactions... does that make it popular? In any case, @gypsydave5 was at the top of the thread with this comment:

CSS and HTML are sufficient to build 99% of all websites.

@sunitk shares their frustrating interview experience in Reasons I've Been Rejected For Software Engineering Roles:

I will share an interview experience that happened many many years ago. The question asked was how to reverse a string. It was supposed to test how I can think about breaking down the problem and applying any algorithm if required. So I showed the standard 2 methods using a character array and going through in reverse order. Then I showed the way recursion can be used. The interviewer was okay with my answers and asked me which method I would use. Since the position required Java skills, I said none of these methods but the java provided StringBuffer which has a reverse method. This did not go down well with the interviewer despite my explanation that it's a method available in the JDK and has been tried and tested and hence more reliable.

For the other 2 questions asked, I did show the whiteboard code to solve the problem but suggested using JDK methods.

I did not get the job because the comment the interviewer made was like they needed people who could come up with solutions and not just use someone else's code!! I could not believe what I heard. I was recommending using available, tried and tested JDK methods!!

Thanks for this topic ... I too have many experiences where half way through an interview I knew that I won't get the job or I didn't want to work there.

@beggars adds to conversation in Will you write code after you retire? How will your relationship with our craft change?. Now I'm wondering what the name of that retirement community might be:

Retire? I will be writing code for as long as I am of sound mind. If I am in a retirement village, undoubtedly I will still be working on side-projects and hacking on numerous things. A retirement home for programmers would be a wonderful thing actually.

@marceloadsj adds a thorough reply to an article titled Svelte Needs A Virtual DOM:

Hey, I just created a small snippet to explain better the approach Svelte uses to update the dom:

That's a Svelte version, you can check using devtools:
svelte.dev/repl/567089d42c3b414682...

That's a vanilla version to have a big overview of how Svelte schedule the updates:
jsfiddle.net/n4h7s56y

You can see that it doesn't update the dom multiple times!

The main difference with React will be when the concurrent mode is released. React will have a way to "stop and continue" the rendering process between the cycles/ticks.

But, actually Svelte uses a completely different approach, and I'm not saying it's better or worst. It's just different. I really like React and I'm impressed with Rich Harris (and the community) work on Svelte. I'm pretty sure we have space for both.

The other thing is: actually, if we run, e.g:

(a, b) => a + b

and

() => {}

Which one will run faster? jsperf.com/sum-x-empty
So, if you remove the code, of course it will be faster, and less code, less bugs.

Of course, it's not the only way you can improve the speed of your app, but it's the only one that it's 100% guaranteed it will do.

And about React, well, I think they are thinking too much of how to make the things faster, run smooth, but, maybe would be good to think like Rich Harris? Instead of trying new ways to speed up, just remove the code, make ReactDOM bundle smaller, maybe tree-shakable, less boilerplate on the events layer, or even, invest on an ahead of time compilation.

So, my 2cents: Svelte don't need a virtual DOM. :)

Some useful links about the topic:
// some links talking about the virtual dom (opinionated maybe? go for your own risk, haha)
svelte.dev/blog/virtual-dom-is-pur...
twitter.com/thekitze/status/107858...

// real world implementation in svelte an react+redux
github.com/sveltejs/realworld
github.com/gothinkster/react-redux...

// compile time computations to js to minimize the work in runtime
prepack.io/

// build react to html in compile time
twitter.com/trueadm/status/1002812...
github.com/trueadm/ssr-with-prepac...

Finally, @thompcd thanks the author and reiterates one of the tips from ✒️ Some 🔥 tips on using the JS console (console.log & console.table):

Thank you! I always used console.log("waste my time", wasteMyTime), didn't know about console.log({wasteMyTime})!

See you next week for more great comments ✌

Discussion

pic
Editor guide
Collapse
peter profile image
Peter Kim Frank Author

Congrats to @gypsydave5 , @sunitk , @beggars , @marceloadsj , and @thompcd for making the list this week!

Collapse
thompcd profile image
Corey Thompson

🙌🏻🙌🏻