You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
-
11@Gulzar: From personal experience in writing both production-quality and single-use throwaway code: Yes, they do make you faster - initially. As you correctly point out, dirty coding can come back to haunt you much sooner than you'd expect. And, obviously, the long-term cost usually outweighs the short-term gains by a large factor. In fact, the only legitimate use case I see for these techniques would be small, time-critical emergency hotfixes (system is down and customer loses $$$ per hour), but even then I'd try to replace it with a clean solution as soon as possible.Heinzi– Heinzi2022-04-09 11:19:06 +00:00Commented Apr 9, 2022 at 11:19
-
81. But don't attempt to obtain 100% code coverage either. You won't get it. There is a sweet spot for testing; write enough tests to demonstrate that the code works, and no more than that.Robert Harvey– Robert Harvey2022-04-09 12:02:26 +00:00Commented Apr 9, 2022 at 12:02
-
62. Copy/pasting code and modifying it is absolutely the right thing to do in many cases. DRY can be taken to absurd extremes that waste time, make the code more complex and difficult to read, and do nothing to improve the overall architecture.Robert Harvey– Robert Harvey2022-04-09 12:07:32 +00:00Commented Apr 9, 2022 at 12:07
-
24. It depends. If you're in a small local scope, x, count or var are perfectly good names for variables, and if you are writing your code correctly, you should be in a small local scope much of the time.Robert Harvey– Robert Harvey2022-04-09 12:11:12 +00:00Commented Apr 9, 2022 at 12:11
-
55. Your code should be easy enough to read so that you don't need comments most of the time. Comments should be reserved for explaining why, not how, and should be used primarily to point out relationships between classes and methods (i.e. architectural considerations).Robert Harvey– Robert Harvey2022-04-09 12:13:12 +00:00Commented Apr 9, 2022 at 12:13
|
Show 5 more comments
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. design-patterns), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you