Linked Questions

31 votes
10 answers
6k views

Does logging inside a class violate the SRP?

I wrote a class that takes a Logger class as one of its arguments: class QueryHandler: def __init__(self, query: Query, logger: Logger) -> None: self.query = query self.logger =...
pstatix's user avatar
  • 1,027
83 votes
8 answers
18k views

How can a class have multiple methods without breaking the single responsibility principle

The Single responsibility principle is defined on wikipedia as The single responsibility principle is a computer programming principle that states that every module, class, or function should have ...
Goose's user avatar
  • 1,898
50 votes
7 answers
12k views

Managing and organizing the massively increased number of classes after switching to SOLID?

Over the last few years, we have been slowly making the switch over to progressively better written code, a few baby steps at a time. We are finally starting to make the switch over to something that ...
JD Davis's user avatar
  • 1,367
7 votes
1 answer
1k views

Does unused code affects the assembly after startup (Memory for example)?

Disclaimer: I come from a PHP background. In PHP, I could have thousands files, which are never loaded, if not needed, due to the autoloader feature (If some code is needed, it would be loaded) How ...
Christian Gollhardt's user avatar
110 votes
12 answers
18k views

Is testable code better code?

I'm attempting to get into the habit of writing unit tests regularly with my code, but I've read that first it's important to write testable code. This question touches on SOLID principles of writing ...
WannabeCoder's user avatar
  • 2,794
185 votes
16 answers
21k views

Why does automated testing keep failing in my company?

We have tried to introduce developer automated testing several times at my company. Our QA team uses Selenium to automate UI tests, but I always wanted to introduce unit tests and integration tests. ...
Mag20's user avatar
  • 3,301
32 votes
8 answers
2k views

What causes bad performance in consumer apps? [closed]

My Comcast DVR takes at least three seconds to respond to every remote control keypress, making the simple task of watching television into a frustrating button-mashing experience. My iPhone takes at ...
Crashworks's user avatar
  • 1,249
41 votes
11 answers
7k views

Is it bad habit not using interfaces? [closed]

I use interfaces rarely and find them common in others code. Also I create sub and super classes (while creating my own classes) rarely in my code. Is it a bad thing? Would you suggest changing ...
jineesh joseph's user avatar
82 votes
14 answers
5k views

When is optimization not premature and therefore not evil?

"Premature optimization is root of all evil" is something almost all of us have heard/read. What I am curious what kind of optimization not premature, i.e. at every stage of software development (high ...
Gaurav's user avatar
  • 3,729
13 votes
12 answers
2k views

What do programmers "micro-optimize" for today? [closed]

Back in the "good ol' days," when we would copy shareware onto floppies for friends, we also used a fair bit of assembly. There was a common practice of "micro-optimization," where you would stare and ...
Macneil's user avatar
  • 8,223
16 votes
8 answers
1k views

When should I care about performance?

For the longest time in places like Java's IRC channel, SO, and other places I've been told something along the lines of "Worry about how the code looks and its readability/understandability now, and ...
TheLQ's user avatar
  • 13.6k