Entries Tagged as 'OO'

Testability Explorer: Measuring Testability

October 21st, 2008 · 1 Comment

Testability Explorer: Using Byte-Code Analysis to Engineer Lasting Social Changes in an Organization’s Software Development Process. (Or How to Get Developers to Write Testable Code)
Presented at 2008 OOPSLA by Miško Hevery a Best Practices Coach @ Google
Abstract
Testability Explorer is an open-source tool that identifies hard-to-test Java code. Testability Explorer provides a repeatable objective metric of [...]

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • E-mail this story to a friend!
  • Reddit
  • Slashdot
  • StumbleUpon
  • Blogosphere News
  • description
  • TwitThis

Tags: Advice · OO · Testability · Testability Explorer

Dependency Injection Myth: Reference Passing

October 21st, 2008 · 9 Comments

by Miško Hevery
After reading the article on Singletons (the design anti-pattern) and how they are really global variables and dependency injection suggestion to simply pass in the reference to the singleton in a constructor (instead of looking them up in global state), many people incorrectly concluded that now they will have to pass the singleton [...]

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • E-mail this story to a friend!
  • Reddit
  • Slashdot
  • StumbleUpon
  • Blogosphere News
  • description
  • TwitThis

Tags: Advice · OO · Testability

Where Have all the “new” Operators Gone?

September 10th, 2008 · 4 Comments

(the other title: Your Application has a Wiring Problem)
In My main() Method Is Better Than Yours we looked into what a main() method should look like. There we introduced a clear separation between (1) the responsibility of constructing the object graph and (2) the responsibility of running the application. The reason that this separation is [...]

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • E-mail this story to a friend!
  • Reddit
  • Slashdot
  • StumbleUpon
  • Blogosphere News
  • description
  • TwitThis

Tags: Advice · OO · Testability

Where Have All the Singletons Gone?

August 21st, 2008 · 10 Comments

by Miško Hevery
In Singletons are Pathological Liars we discussed the problems of having singletons in your code. Let’s build on that and answer the question “If I don’t have singletons how do I ensure there is only one instance of X and how do I get X to all of the places it is needed?”
An [...]

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • E-mail this story to a friend!
  • Reddit
  • Slashdot
  • StumbleUpon
  • Blogosphere News
  • description
  • TwitThis

Tags: Advice · OO · Rant · Testability

Singletons are Pathological Liars

August 17th, 2008 · 32 Comments

by Miško Hevery
So you join a new project, which has an extensive mature code base. Your new lead asks you to implement a new feature, and, as a good developer, you start by writing a test. But since you are new to the project, you do a lot of exploratory “What happens if I execute [...]

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • E-mail this story to a friend!
  • Reddit
  • Slashdot
  • StumbleUpon
  • Blogosphere News
  • description
  • TwitThis

Tags: Advice · OO · Rant · Testability

Procedural Language Eliminated GOTOs; OO Eliminated IFs

August 14th, 2008 · 3 Comments

by Miško Hevery
Procedural languages allowed us to remove GOTOs in our code. I would like to think that OO languages allow us to remove IFs (conditionals). I know you can’t remove of all the IFs, but it is interesting just how many IFs you can remove in an application.
You can’t remove these IFs:

Comparing relative sizes [...]

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • E-mail this story to a friend!
  • Reddit
  • Slashdot
  • StumbleUpon
  • Blogosphere News
  • description
  • TwitThis

Tags: Advice · OO · Testability · Uncategorized

Circular Dependency in constructors and Dependency Injection

August 1st, 2008 · 1 Comment

by Miško Hevery
So you discovered dependency injection and GUICE and you are happily refactoring and writing new tests for you code until you come across this circular reference.
class A {
final B b;
A(B b){
this.b = b;
}
}

class B {
final A a;
B(){
[...]

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • De.lirio.us
  • E-mail this story to a friend!
  • Reddit
  • Slashdot
  • StumbleUpon
  • Blogosphere News
  • description
  • TwitThis

Tags: Advice · OO · Testability