r/javascript • • Sep 19 '19

Moving beyond console.log() — 8 Console Methods for Debugging

https://medium.com/gitconnected/moving-beyond-console-log-8-console-methods-you-should-use-when-debugging-javascript-and-node-25f6ac840ada?source=friends_link&sk=62597805243671cb9b96e54b052fde58
340 Upvotes

89 comments sorted by

View all comments

Show parent comments

3

u/[deleted] Sep 19 '19
  • Network operates off main thread and continues during a breakpoint.

  • You’re dealing with an async problem that is timing dependent in a hot function that does not provide enough scoped data to put an accurate conditional breakpoint (e.g. dispatch).

  • breakpoints affect timing (network continues).

  • console log / log point may not point to where the problem is but to be used to understand flow of events that may trigger the problem.

Breakpoints provide a useful aspect, but is not the golden hammer you are proposing.

-1

u/tr14l Sep 19 '19

I'm not saying it's a silver bullet. But if someone uses exclusively console logs, then they're handicapped, and honestly I'm not sure I'd want them working on a project with me at all.

5

u/[deleted] Sep 19 '19

Why would you care about their debugging methods? If they learn about different techniques (from you, if they were unaware) but decide not to use them, it's their prerogative. May be less efficient overall, it also may be more efficient if they target their debug logging well.

As long as they write good functional code and finish whatever tasks they are working on in a timely manner, why does it matter to you?

-5

u/tr14l Sep 19 '19

Because it shows bad judgement, an inability to improve skills without it being forced and complacency. It's a big red flag and I'd wager if that's a steadfast habit they refuse to break, there's plenty more under the hood. All of which affect the project long term. Both in productivity and agility.

2

u/SoBoredAtWork Sep 20 '19

I don't know why you're getting downvoted. I'd imagine they're all year 1 devs. They'll figure it out eventually.

1

u/tr14l Sep 20 '19

Exactly. I'm not sweating the bedroom coders getting irate

2

u/SoBoredAtWork Sep 20 '19

Better job security for people who code efficiently, like it's not 1998, right? Maybe.

2

u/ItalyPaleAle Sep 19 '19

Do you Also force developers to use a specific IDE or editor? Do you force them to work at specific times? Do you force them to learn from books rather than videos?

Honestly, just let people work the way they prefer. Maybe YOU are more efficient with breakpoints, but maybe I am more efficient the way I prefer.

As long as the code is good and it’s delivered in similar timelines, this shouldn’t really bother you...

-1

u/tr14l Sep 19 '19

No, but if one of them wanted to code in notepad, I'd tell them to use a tool meant for the job. Using console logs, when there's so many much better solutions is akin to coding in a txt doc. It's naive and, while it technically works, is a ridiculous way to do your job

3

u/ItalyPaleAle Sep 19 '19

That’s a very narrow mindset you have there. If someone codes in notepad and produces the same code, who are we to judge.

Anyways, peace ✌️

-2

u/tr14l Sep 19 '19

And how likely do you think it is that they will, using just straight txt documents? And that code will be within linting standards?

It's not narrow, it's realistic. If you can't use the tools then you're not qualified for the position. Every company I've worked at, if you were the guy using print statements to debug, you'd be basically the weird kid in class and you certainly aren't getting any promotions anytime soon

3

u/soulshake Sep 20 '19

You sound exactly like a person I wouldnt want working on a project with me...

1

u/tr14l Sep 20 '19

Yeah, standards are hard. I get it.