Research Log of Web Science Students

Computer Science is not simply programming

quick question

with 3 comments

We have 2 XML files, one for add baby and the other for edit baby. Problem is, these 2 files are exactly the same. Is it a waste of space to separate the add and edit baby layouts?

Also, the add and edit baby Java files are almost the same. Their only difference is a single line – one executes an insert statement, and the other executes an update statement. Should we also combine them in a single Java file?

Written by janinaj

September 26, 2009 at 6:44 am

Posted in BabyBook

Tagged with ,

3 Responses

Subscribe to comments with RSS.

  1. Refactor! 😛


    September 27, 2009 at 3:35 am

  2. I have never heard of refactoring an xml file but you can definitely refactor the java file.

    Can you add more details on the java file?

    I am thinking

    1. you should push up the code that’s the same to an abstract class
    2. declare an abstract method that does the sql.
    3. extend the abstract super class and override the abstract method by putting the appropriate sql statement.


    September 28, 2009 at 8:09 pm

  3. […] manager factories and the same dao declarations in my web service application context(talk about refactoring an xml file— I thought I’d never hear it again in my life). Also it is expensive to have two […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: