Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQL Antipatterns: MVC and Common Pitfalls in DB application development

 
Sunil Tiwari
Ranch Hand
Posts: 49
Clojure Redhat Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,

Though these are few open ended question, but still would like to ask.

1) How can SQL Antipatterns help in MVC architecture?

and

2) What are the common pitfalls in DB application development, using Java?

Thanks
Sunil
 
Bill Karwin
author
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sunil Tiwari wrote:1) How can SQL Antipatterns help in MVC architecture?

I do have a chapter titled Magic Beans in my book, about the MVC architecture. The MVC antipattern I see most commonly is for application development frameworks such as Ruby on Rails (and its imitators) to simplify MVC by making the Model an instance of the Active Record data access component. Martin Fowler describes Active Record (http://martinfowler.com/eaaCatalog/activeRecord.html), but he also describes several other data access patterns. Unfortunately, frameworks that try to simplify application development push the idea that all you need is Active Record. Of course most applications in the real world are more complex, and you have to encapsulate that complexity somewhere. So users of these frameworks end up putting a lot of their domain logic into their Controller classes, which leads to fat controllers, code duplication, and difficulty in unit testing.

Sunil Tiwari wrote:2) What are the common pitfalls in DB application development, using Java?

I have standard advice for Java developers:
  • 90% of the issues you will face are related to your CLASSPATH.
  • Of the remaining problems that are not due to CLASSPATH, 90% of those are related to your classloader.

  • This is kind of a glib answer, but I think it's not far from being true. In Java, the biggest hurdle that faces every developer (edit: every developer who uses JDBC, that is) is to try to understand how to load a JDBC driver and get a connection to the database. It's probably the first time a Java developer uses the reflection API (perhaps the only time).

    This isn't the most advanced or complex issue, but it's the most common one, because every developer has to learn to connect to the database first, before doing anything further. And let's face it, there's quite a steep learning curve to understanding the steps of connecting to a database.
     
    Sunil Tiwari
    Ranch Hand
    Posts: 49
    Clojure Redhat Spring
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Bill! Looking forward to read more !
     
    Gian Franco
    blacksmith
    Ranch Hand
    Posts: 979
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Bill Karwin wrote:...unfortunately, frameworks that try to simplify application development push the idea that all you need is Active Record. Of course most applications in the real world are more complex, and you have to encapsulate that complexity somewhere. So users of these frameworks end up putting a lot of their domain logic into their Controller classes, which leads to fat controllers, code duplication, and difficulty in unit testing.


    ...this is good to hear from someone else Although these frameworks
    have their advantages the remaining 20% is quite tough sometimes...
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic