Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
Naming things depends on whether it’s possible to have namespaces or other context for that name.
In general, don’t repeat the name of the context. It’s redundant.
Yes, it may help with searching but only if you are using a dumb text search.
Your IDE should provide to you tools to search with context, which is better anyway and will keep your code clean. -
You can just go with named models in Vue. In given context, I don't see such need though: TodoList is supposed to accept a list of todo as primary two-way binding, and duplicating name for it would be redundant, especially if you don't plan to add more models to component.
-
Some random opinons
* For views with 1 input I do like it if that input is called the same thing everywhere. model or viewModel or whatever.
* If it comes up multiple times that devs are confused due to the generic nature of a name, I'll gladly change it to something verbose and specific
* I dislike multiple files with the same name. I think opening article.js and talking about "I edited article.js" is way simpler than having 50 components that all have an index.js file and having to refer to "article/index.js" or seeing multiple tabs in your editor named index.js and having to look at the folder names. -
To expand: I really think it's faster if you have a standard for what you name your view data,
When you're working inside of a view it's really nice to just know that you can write "model.something" no matter what, and there's rarely any confusion as to what the model is.
Makes copy-paste view files so much faster when you don't have to find-and-replace and change stuff from "todoModel.date" to "articleModel.date" or "todoModel.title" to "articleModel.title"
Related Rants
-
vergil32Who, after switching to Linux, started naming their files and folders without spaces?
-
fsociety0013In all honesty, if there was a course on giving variables good, informative and not completely stupid names......
-
Cas97Just finished writing a script with all the classes and variables named after the characters from Sherlock Hol...
How do you guys like to name things, do you prefer being specific/verbose or generic? Say, we have a vue component to which we need to pass props. Would you prefer:
<todo-list todo-model="TodoModel" />
or rather:
<todo-list model="TodoModel" />
For me, the first is easier to search for, the other is more elegant and decouples what is happening from why is it happening.
question
naming