Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#269 closed defect (fixed)

code duplication on clients site

Reported by: olhsha Owned by: g.georgovassilis@mpi.nl
Priority: major Milestone: ComponentRegistry-1.14
Component: ComponentRegistry Version: 1.0
Keywords: refactor Cc:

Description

there are a few code blocks in client-site (flex) that are met in two or more copies in different places. It should be refactored.

Change History (9)

comment:1 Changed 11 years ago by olhsha

fixed but need more testing on the developer's machine

comment:2 Changed 11 years ago by twagoo

Milestone: ComponentRegistry-1.13

comment:3 Changed 11 years ago by twagoo

Milestone: ComponentRegistry-1.13ComponentRegistry-1.14

comment:4 Changed 11 years ago by olhsha

There are different action-script classes that contain methods with "almost the same code".

In particular, this is the case for the classes that perform work over/for Components and the classes that perform work over/for Profiles. Compare, for instance, ComponentInfoService?.as and ProfileInfoService?.as, or ComponentListService?.as and ProfileListService?.as.

Accurate code parsing will give you other examples.

The aim is to get rid (when reasonable) from code repetition, e.g. by using inheritance.

comment:5 Changed 11 years ago by twagoo

Owner: changed from olhsha to g.georgovassilis@mpi.nl
Status: newassigned

comment:6 Changed 11 years ago by olhsha

Also check the following pairs in ComponentEdit?.as, if they can be refactored:

private function addComponentAddButton():void
private function addElementAddButton():void

addComponent(component:CMDComponent)
addElement(element:CMDComponentElement)

private function removeComponent(event:Event)
private function removeElement(event:Event)

comment:7 Changed 11 years ago by g.georgovassilis@mpi.nl

Status: assignedaccepted

comment:8 Changed 11 years ago by g.georgovassilis@mpi.nl

Resolution: fixed
Status: acceptedclosed

Introduced BaseRemoteService? to handle http/xml communication with the backend. Provides URL management, error handling, extracting XML. Also introduced HttpServiceFactory? and to allow for mocking http communication in unit tests (see ComponentInfoServiceTest? for an example).

comment:9 Changed 11 years ago by olhsha

Also, to check for refactoring:


CMDComponentElementBrowser.as and ComponentBrowse?.as

handleElements(elements:ArrayCollection)
handleComponents(components:ArrayCollection)


ComponentBrowse?.as and ElementBrowse?.as.:
addLine, addChild


BrowserColumn?.as

public function getProfileColumns()
public function getComponentColumns()

getInitialSortForProfiles()
getInitialSortForComponents()

---------------------------------


CMDcomponent.as:


removeComponent vs removeElement
moveDownElement vs moveDownElement
moveUpComponent vs moveUpElement


Note: See TracTickets for help on using tickets.