sea_ljf

Anyway, stop recommending bazookas to kill flies in programming

原文链接: itnext.io

There’s something that really annoys me in the programming community, and I’ll illustrate this using Vue examples, though it concerns programming in general.

First, let’s get to the source of the problem here.

When you work on some code, you may run into issues and then ask for help. When you ask for help, you expect is an answer to your question, to resolve your bug or coding issue. I hate when people tell you to change the whole tool, framework or library, instead of giving you a solution to correct your code whenever it’s possible.

Very often, people don’t try to understand your question or context. They will tell you to use the bazooka before even asking what you want to kill.

That’s insane! If I’m baking a yogurt cake, and I ask you:

at how many degrees should I put my oven for A YOGURT CAKE?

I’m expecting an answer involving degrees to this issue and not:

have you tried making a Salad instead?

I see this very often. I’m not trying to be mean here, but this is not a good habit. I have done this myself when I had less experience in programming, but I realised, it’s not the way to go.

Just to be clear, I’m not saying that recommanding another tool may not be the solution, I’m saying: understand the need and the context.

Telling people “use what I use”, instead of resolving their issue by understanding or asking the context, is not being a developer that improves, it’s being a developer that only stays in his comfort zone and tries to bring people in it.

Okay, so what about the Vue community?

In the Vue community, whether on Facebook, forums or Discord, anytime someone have an issue with state handling or SEO, people repeat the same answer without asking what kind of project the OP (original poster) has.

- OP: I have an issue with SEO in my current Vue project […] how can I do? - Community: Have you tried nuxt?

What kind of answer is that? If the guy already has a project not using nuxt, try to resolve his issue in his context first instead of telling him straight away to use nuxt.

Don’t get me wrong, I like nuxt, the makers are French and I’ll always support my French bros. That being said, nuxt is not the only solution for SEO issues on Vue.

Migrating to nuxt when you already have your own architecture is not so simple, because nuxt has its own architecture.

So telling someone : “just use nuxt”, is really not resolving anything in this particular case. Things like prerender-spa-plugin & others exists too.

- OP: I have two components, I want to share data, how can I do? - Community: Just use vuex

OMG, is Vuex the only way to share state between components? Fucking no!

Same thing here, I love Vuex, I use it very often, but Vuex may be overkill depending on the project’s size and needs. Ask for context!

There are at least 3 different ways to share state in Vue: Object reference with reactivity, Event Bus, Vuex. https://vuejs.org/v2/guide/state-management.html#Simple-State-Management-from-Scratch

Before recommending a whole new tool to the OP, unless that was what he was asking for, ask for context to give a suitable solution.

Though I love Vue, if someone asked me: “What should I use to create a simple landing page”, I wouldn’t tell him immediately: “use Vue!”, I would ask him first what features he needs on his landing page.

Keep in mind that these are just basic examples to show you the problem.

Well, that was my rant of the day. I used to do that too, but I feel like doing this is imposing what you like instead of resolving what the OP needs.

Have a nice day, programming is good, be a programmer.

EDIT: Some people on reddit talked about the XY problem and I’m aware of that issue. I’m not pointing out the fact that people may suggest a bazooka if the initial tool is wrong, I’m pointing bazooka lovers that would only recommed that straight away without asking for context. As for the “writting style”, I’m a non-native english speaker ;)

PS: Want to discover a new kind of music? https://foreignrap.com/ PS 2: Like beautiful places and traveling? https://mustsee.earth/