SQL constructs translated to OOP

Posted by python dude on Stack Overflow See other posts from Stack Overflow or by python dude
Published on 2010-03-20T10:49:41Z Indexed on 2010/03/20 10:51 UTC
Read the original article Hit count: 387

Filed under:
|

As someone who comes from the world of Object Orientation, I find it rather difficult to wrap my head around SQL. Recently, however, I realized that the classical SQL construct

select X from Y where Z

is basically equivalent to the following OOP construct:

List<SomeType> results = db.query(new Matcher<SomeType> () {
  public boolean match(SomeType candidate) {
    return ...; // checks condition Z on candidate, returns true for match
  }
};

So my question is: What are the OOP equivalents for other SQL constructs, such as joins?

© Stack Overflow or respective owner

Related posts about sql

Related posts about oop