Question: what is unclear? 3. (10 points) Critique the following code refactoring, does it represent an application of the principles of abstraction and/or information hiding? Assume

 what is unclear? 3. (10 points) Critique the following code refactoring,

what is unclear?

3. (10 points) Critique the following code refactoring, does it represent an application of the principles of abstraction and/or information hiding? Assume the code is part of a larger project, how could the design be improved further? class Dataloggervi { JDBCDatabaseDriver driver; public Dataloggervi (JDBCDatabaseDriver driver) { this.driver = driver; } class Dataloggerv2 { JDBCDatabaseDriver driver; public DataloggerV2 (JDBCDatabaseDriver driver) { this.driver = driver; } public void storeSample (Sensor sensor) { driver.openTransaction(); double value = sensor.getValue(); Location location = sensor.getLocation(); MeasureType type = sensor.getMeasureType(); driver.execLoggerPreparedstmt(value, location, type); driver.closeTransaction(); } public void storeTemp (Temp Sensor temp Sensor) { driver.open Transaction(); double value = temp Sensor.getValue(); Location location = temp Sensor.getLocation(); MeasureType type = temp Sensor.getMeasureType(); driver.execLoggerPreparedStmt(value, location, type); driver.closeTransaction(); } public void storeHumidity (Humidity Sensor humiditySensor) { driver.openTransaction(); value = humiditySensor.getValue(); location = humiditySensor.getLocation(); type = temp Sensor.getMeasureType(); driver.execLoggerPreparedStmt(value, location, type); driver.closeTransaction(); } } 3. (10 points) Critique the following code refactoring, does it represent an application of the principles of abstraction and/or information hiding? Assume the code is part of a larger project, how could the design be improved further? class Dataloggervi { JDBCDatabaseDriver driver; public Dataloggervi (JDBCDatabaseDriver driver) { this.driver = driver; } class Dataloggerv2 { JDBCDatabaseDriver driver; public DataloggerV2 (JDBCDatabaseDriver driver) { this.driver = driver; } public void storeSample (Sensor sensor) { driver.openTransaction(); double value = sensor.getValue(); Location location = sensor.getLocation(); MeasureType type = sensor.getMeasureType(); driver.execLoggerPreparedstmt(value, location, type); driver.closeTransaction(); } public void storeTemp (Temp Sensor temp Sensor) { driver.open Transaction(); double value = temp Sensor.getValue(); Location location = temp Sensor.getLocation(); MeasureType type = temp Sensor.getMeasureType(); driver.execLoggerPreparedStmt(value, location, type); driver.closeTransaction(); } public void storeHumidity (Humidity Sensor humiditySensor) { driver.openTransaction(); value = humiditySensor.getValue(); location = humiditySensor.getLocation(); type = temp Sensor.getMeasureType(); driver.execLoggerPreparedStmt(value, location, type); driver.closeTransaction(); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!