All Questions
Tagged with patterns-and-practices coding-style
8 questions
0
votes
1
answer
298
views
Should I use SCSS mixins as shortcuts for default CSS syntax?
This question is mainly about readability and understanding of the code. Im am also in the process of creating a SCSS framework like Compass and Bourbon.
I struggle to write SCSS because I like to see ...
4
votes
2
answers
528
views
How to avoid duplication in a for loop when "initialization step" is identical to "update step"?
I often find a situation where I need to write duplicate codes in a for loop, where the "init step" to identical to the "update step":
// duplicate `next()`
for (let x = next(); p(x); x = next()) {
...
4
votes
7
answers
1k
views
How do you know where you stopped in your codes after a 2-week break? [closed]
I just had a more than 2-week long vacation/business trip and I couldn't remember actually what was I working in my coding and where I stopped. Could someone recommend a best practice to solve this?
18
votes
7
answers
27k
views
Why unused variables is such an issue?
I was cleaning unused variables warnings one day, and I started to ponder, what exactly is the problem about them?
In fact, some of them even help in debugging (e.g. inspect exception details, or ...
1
vote
1
answer
109
views
Is nesting component properties maintainable in the long run?
I'm building components in Vue.js. They look like this:
<template>
<form :schema="form.schema" :options="form.options"></form>
</template>
<script>
export default {
...
3
votes
4
answers
1k
views
Function wrappers with no args: bad practice?
My colleague likes to write classes containing methods looking like this:
public function doTaskA()
{
return $this->doTask('A');
}
public function doTaskB()
{
return $this->doTask('B');
...
14
votes
2
answers
10k
views
Which is a better pattern (coding style) for validating arguments - hurdle (barrier) or fence? [duplicate]
I don't know if there are any accepted names for these patterns (or anti-patterns), but I like to call them what I call them here. Actually, that would be Question 1: What are accepted names for these ...
30
votes
3
answers
14k
views
What is the name for the idiom using method chaining to build an object?
I frequently use a pattern where I using method chaining to setup an object, similar to a Builder or Prototype pattern, but not creating new objects with each method call, instead modifying the ...