DEV Community

Discussion on: You're a Dev > So Write Like One. Thoughts on writing long-form, not short.

 
brad_beggs profile image
Brad Beggs

Fair point about being able to assume correctly what the expected output is of a function. When you say generic is the way to go, what do you mean by generic? The names, or something else?

Thread Thread
 
hopemanryan profile image
Ryan Hoffman • Edited

It means not naming arguments (dataFromUserInput) => {...} and other examples can be added if needed.
simple is smooth, smooth is fast.
Making complex code is cool, but what happens if you want to change something, add something. how many places do you need to update your code in order to make your app not break, plus how many do you need to add to make the app show your change.

When you keep functions generic , i.e any one can use it and get the same result if they pass the same arguments , means many components of your code can use the same function for getting the information it wants, so changing only one function updates in a way in your entire application/server/whatever.

I went through your project and saw this line of code

<div className="service-specs" onClick={props.specClick}>
  1. I have no idea what specClick does,
  2. If I will want to run the same logic on inputChange what will you do ? add another prop ? I think not