126 reputation
9
bio website flavius.github.io
location Austria
age 28
visits member for 4 years, 4 months
seen 2 days ago

New policy: I upvote any answer and question I see. It costs nothing!

It's annoying to keep this up to date.

Keywords:

  • open source, linux (ArchLinux)
  • hobbyist programmer
  • PHP PECL contributor

Read more on my homepage: http://flavius.github.com/about.html


Apr
18
accepted Dependency injection vs dependency lookup in a layered architecture
Apr
18
comment Dependency injection vs dependency lookup in a layered architecture
If no object can ever be put in an invalid state (nulls aside), and of course if you use value objects in the entire system, then no object can be put in an invalid state through constructor injection. Anyways, that's already off-topic.
Apr
18
awarded  Autobiographer
Apr
18
comment Dependency injection vs dependency lookup in a layered architecture
That's a language-specific issue, not an architectural one.
Apr
18
awarded  Commentator
Apr
18
comment Dependency injection vs dependency lookup in a layered architecture
I do prefer DI at construction time over setters, because it avoids putting the object in an invalid state. In an ideal world, an object has no setters (one-liner methods which just set a field), just methods which do business-relevant things (and maybe also set a private field as part of it). However, your answer has once again confirmed my fears. Thanks.
Apr
18
revised Dependency injection vs dependency lookup in a layered architecture
added 136 characters in body
Apr
18
revised Dependency injection vs dependency lookup in a layered architecture
added 48 characters in body
Apr
18
comment Dependency injection vs dependency lookup in a layered architecture
I avoid static like hell. Can you rephrase some parts of your answer to frontally answer my questions? It's not quite obvious what are you getting at in respect to my questions. Otherwise, it's a nice answer.
Apr
18
asked Dependency injection vs dependency lookup in a layered architecture
Sep
29
awarded  Scholar
Sep
29
accepted Convincing my boss that touching the Database is integration testing
Sep
29
comment Convincing my boss that touching the Database is integration testing
Today we had a code review and I asked "how would you test this?". He finally said all by himself things that I said for a long time like "static is bad" and "use factories as objects and inject them" - all factories are factory static methods at the time of writing. So I'll continue to ask questions with the right timing and make him think, maybe just ask "what if...?" to give him the direction he should head to.
Sep
28
comment Convincing my boss that touching the Database is integration testing
What I was thinking about was to write a dummy project which shows all the advantages of doing it properly and actually benchmark the DB speed and present the entire workflow. To show him that if we treat the database just like a plugin, then we can inject/replace it at runtime and run all the tests quickly - which prevents more bugs.
Sep
28
comment Convincing my boss that touching the Database is integration testing
I've also noticed that "planting a seed" works better, but it works only partially in that he takes only some parts of the seeds, not everything. So I'll have to bombard him with seeds, not just plant a few. I'm afraid that this way it will take quite a while (one year?) until he understands...
Sep
28
comment Convincing my boss that touching the Database is integration testing
Yes, he is still involved in the development, and there is a team, but the others are juniors.
Sep
28
awarded  Student
Sep
28
comment Convincing my boss that touching the Database is integration testing
The actual problem is a mentality problem - of him. Since he likes the database so much, he also couples all the DB-specific code to the core model of the application. But in order to make it testable, we have to decouple the application domain from the DB. That's why "winning the integration tests argument" is a good first step towards making the code testable.
Sep
28
awarded  Editor
Sep
28
revised Convincing my boss that touching the Database is integration testing
added 135 characters in body