Re: MVC - The right way
From: Fredrik Bertilsson (fredrik_bertilsson_at_passagen.se)
Date: 09/13/04
- Next message: Tony Weston: "Re: MVC - The right way"
- Previous message: Robert C. Martin: "Re: Distributed applications and OOD"
- In reply to: Tony Weston: "Re: MVC - The right way"
- Next in thread: Tony Weston: "Re: MVC - The right way"
- Reply: Tony Weston: "Re: MVC - The right way"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 12 Sep 2004 22:48:55 -0700
aweston@connectfree.co.uk (Tony Weston) wrote in message > I Haven't yet looked in depth at your framework. If you have anything
> at all related to the database (field name, tablename, connection
> string, etc) anywhere in the component class, then I would not
> consider this MVC....
Butler's data-aware components do know about table and column names,
but not connection strings.
> Imagine you have two components, a combobox with a list of countries,
> and a jtable, with also a list of countries. In your framework, to
> build these two components, would you need to duplicate the code that
> makes the JDBC calls in both components?
In Butler, these components are RecordListCombo and RecordListTable.
None of them have code for making JDBC calls. Both components listens
for a RecordList to be assigned to them from other components (like
QueryController).
> What about other components
> that need to access country name... Similar SQL calls?....
Not at all.
> What
> happens if new business requirements mean the database changes so that
> country names are now stored in a different database table?.... Mass
> refactoring of all country name referencing components maybe?
A change like this will most likely mean mass refactoring a lot of the
business logic in any case. The database structure implements a lot of
business logic, and changing it will by definition lead to changes in
the application code. Please give me an example of how a change like
this will look like. You have a table named "country" with a column
"name". To what table would you like to move the column "name", and
what relation do this table has to "country". The only possible change
without changing the business logic, is to move to a table with the
same primary key as "country". If you move to a table with a different
primary key, it might be possible for a country to have multiple
names, and you will have to change a lot in your client anyway.
> A better idea might be to externalize said JDBC calls into a new
> class,
All JDBC calls in Butler is externalized into the class JDBCDriver.
> the 'countriesModel' which would perform the job of retrieving
> the list of countries from the database for what ever class wanted to
> make use of its services ie, both the combobox, and the jtable will,
> instead, create an instance of countriesModel, and call
> getCountryNames() to get a list of countries to populate themselves.
If you have business logic on your application server, will you use
this model objects too, or will you have to create other objects for
handling countries. When I try to imagine your application I see
methods like "getCountryName" in a lot of places. Adding a new
property/attribute to country will force you to change a lot of
classes.
> This way, should the database change (the name of the countries, be
> retrieved from a new file for example)
If you are using a database for storing countries, you are not
retrieving countries from files at all.
/Fredrik
- Next message: Tony Weston: "Re: MVC - The right way"
- Previous message: Robert C. Martin: "Re: Distributed applications and OOD"
- In reply to: Tony Weston: "Re: MVC - The right way"
- Next in thread: Tony Weston: "Re: MVC - The right way"
- Reply: Tony Weston: "Re: MVC - The right way"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|