buy viagra germany canadian meds

cheapest propecia online

cheap propecia online prescription

buy viagra pills

similar cialis

buy real viagra online without prescription

canadian pharmacy ed

buy cialis professional

100mg viagra

viagra see what it does

buy viagra soft tabs

levitra or viagra

generic viagra

viagra prescriptions

online generic cialis 100 mg

best doses for propecia

cheap online levitra

levitra in uk

best price for propecia

best prices on brand viagra

overnight viagra generic

mexico pharmacy cialis

propecia prescriptions
propecia sales canadian

canada cheap propecia

cheap viagra generic

buy now propecia

pill prescription propecia

bio viagra herbal

canadian pharmacy viagra scam

best price cialis

viagra online shop uk

100mg generic viagra

cialis 20 mg

low cost propecia

viagra online

sale propecia

purchase propecia online

buy propecia in canada

cheap propecia online

online propecia sales

generic propecia for sale

real viagra online without prescription

cialas canada

best deal for propecia

viagra online india

buy generic no online prescription viagra

levitra canadian pharmacy

buy cialis without prescription

order propecia

buy online propecia

get propecia cheap

viagra and canada

levitra online no prescription

order viagra 25mg online canada

levitra professional

buying propecia

non prescription viagra

china viagra

next day delivery cialis

viagra original buy uk

viagra soft

generic propecia uk

viagra pfizer viagra online

the pharmacy shop viagra

viagra label

price cialis canada

buy propecia now

propecia for male baldness

pfizer viagra cheap

how to get cialis no prescription

viagra purchesed on line out of canada

viagra purchase

propecia canada pharmacy

viagra available in india

original viagra

buy propecia in the uk

pfizer soft viagra

viagra discount

search propecia

viagra england

cheapest viagra usa

i need to buy propecia

cheap propecia uk

mail online order propecia

buying real viagra without prescription

cheapest prices on propecia

viagra from canada

25mg viagra online

propecia online pharmacy

viagra overnight mail

canadian pharmacy online cialis

buy viagra 100mg

viagra price germany

canadian generic viagra on line

generic propecia sale

best quality viagra

order levitra online

overnight viagra

buy cialis online canada

one day cialis

buy cialis cannada

canadain viagra india

buy cialis once daily

get viagra fast

online levitra

viagra propecia buy online

buy levitra by mail

order propica

viagra sent from canada

order propecia prescriptions

canadian pharmacy shopcom

cheapest viagra online

viagra tablet

canadian pharmacy scam

levitra tadalafil

internet pharmacy propecia

lowest price propecia costs us

buy propecia

canadian pharmacy with lowest generic viagra

levitra online sales

viagra online in spain

propecia no prescription

buy levitra low price

buy generic propecia online

viagra generic canada

canada pharmacy propecia

buy cheap propecia online

where to buy viagra

buy xenical propecia

herbal propecia

cheap levitra without prescription

generic prescriptions propecia

purchase cialis 5 mg

50mg viagra retail price

brand name cialis

shop viagra

original brand cialis

brand cialis

50mg viagra retail price

buy cialis without a prescription

pill decription of propecia

online pharmacy cost levitra

best price generic propecia

buy cialis canada

viagra dose

what is better viagra or levitra

viagraovernight

canadian pharmacy online

cheapest levitra

shop viagra pfizer

viagra australia

viagra propecia buy online

viagra professional scam

buy generic levitra

levitra 10mg

levitra 20mg

viagra propranodol

lowest propecia 1 mg

viagra from india

generic propecia india

buy levitra lowest prices

tennessee online pharmacy propecia

levitra online order

generic levitra pill

united healthcare viagra

viagra uk delivery fast

how do i get cialis

overnight viagra generic

real viagra without prescription

order viagra 25mg online canada

viagra overnite

viagra discounts

beta blockers and viagra

growth hair propecia

viagra in india

buy pfizer viagra online

generic viagra 100 mg

lowest propecia prices

viagra purchesed on line out of canada

buy propecia and proscar

brand cialis for sale

genuine cialis pills

viaga sales in canida

buy viagra online cheap us

generic propecia online pharmacy

where to find cialis

levitra vs cialis

best price for propecia

levitra tabs

brand viagra

viagra canada purchase

overnight delivery cialis

generic viagra made in india

levitra buy online

mail order propecia

best online cialis

canadian pharmacy viagra legal

levitra 10 mg

cheap cialis

5 mg original brand cialis

100 mg cialis

generic propecia alternative

viagra soft tabs

how much to buy viagra in pounds

buy real cialis

where can i buy propecia

best online cialis

5 mg propecia

buy levitra online us

viagra femele

real viagra without a prescription

propecia online pharmacy no prescription

viagra soft tabs 100 mg

buy cialis in canada

buy propecia online usa

what replaced cialis

buy propecia online

official canadian pharmacy

get levitra

levitra vs viagra

buy propecia where

canadian healthcare viagra sales

online propecia prescription

buy viagra online no prescription

online levitra tablet

brand cialis

viagra online switzerland

buy propecia 5mg online uk

viagra rx in canada

online viagra gel to buy

buy prescription propecia without

what is cialis professional

order viagra uk

viagra buy uk 50mg

brand name cialis

5 mg propecia buy

best propecia prices

viagra prescription

buying cialis online canada

viagra pfizer india

buy viagra online canada

viagra online 50mg

5 mg daily cialis

viagra no doctor

lowest price levitra generic online

lowest price levitra

cialis 50 mg dose

nizagara viagra online

name brand cialis

buy generic propecia online

levitra for sale

viagra 100 mg

canadian viagra

buy propecia generic

purchase cialis overnight delivery

canada meds

buy cialis from canada

order propica

levitra uk

best price for propecia online

online canadian pharmacy levitra

order cheap levitra

viagra for women

cheap viagra 50mg

order cialis from canada

brand viagra canada

propecia fast no prescription

where to buy viagra in scotland

canadas 1 pharmacy

vardenafil levitra

buy viagra online
Simple Design and Testing Conference Wiki : Refactoring Fest Fullscreen

Menu [toggle]

Quick Edit a Wiki Page

Tikiwiki Assistant

Thank you for installing Tikiwiki!

LoginTo begin configuring Tiki, please login as the Admin.

The Tikiwiki CommunityTo learn more, visit: http://www.tikiwiki.org.

Tikiwiki DocumentationFor help, visit http://doc.tikiwiki.org.

Refactoring Fest

What happened at Refactoring Fest?
Backlinks Print
History Add Comment

(hosted by Naresh Jain)

What is Refactoring Fest? (external link) You can also find details about the project we used to refactor and what is the rationale behind this activity.

I guess the only variation from the standard Refactoring Fest, is we had only one computer connected to the projector and we swapped pairs to refactoring code.

We choose VQWiki (external link), a Java based Wiki as our open source project to refactor. VQWiki does not have any unit tests or functional tests. People claim that you need a good suite of tests to refactor. In my experience you need to find an inception point to be able to write unit tests. Sometimes (in my case most of the times) I need to restructure code to be able to write unit tests around it. Also we need to understand the code well enough to be able to do this. And to understand the code, you might have to do some refactoring. This seems like a catch 22 situation where you can't refactor without having tests and you can't write tests without some basic refactoring.

We started the fest, by me (Naresh Jain) showing a suite of Selenium tests, that I created for the wiki. This is fairly easy to start with. Pick a functionality that you are interested in, walk through the UI (web UI in this case) and quickly create (record) Selenium (functional UI) tests. People agreed that this was a good starting point.

We picked the "recent changes" functionality. If you change a page, you should be able to find it under the recent changes link. If there are no changes then the recent changes link should say "No recent changes are found". We ran the test and it was Green. Great starting point. A Green Bar.

Here is the selenium tests:

Matt Scilipoti and I started pairing. We switched pairs as we went along.

We started to look at the RecentChanges? Servlet to understand what was going on.

Whole class at a glance:

The main method for a servlet is the doGet method:

doGet() was again calling the following methods

This is really what the class had when we started.

After series of refactoring we ended up with the following class

The doGet() looks pretty much the same expect is had better names and is far more communicative of what is happening

shouldIgnoreCahce() was called mustReload() It was not very clear what it meant by mustReload(), what are we reloading? All we want is to get the recentChanges? It turns out that this class maintained a cache (instance variable all) to hold the last recent changes. And if the cache was up-to date, then there was no need to fetch all the recent changes again.

You can also notice that earlier we had a method called getDeltaMillisReload() which would getRecentChangesRefreshInterval() from Environment and then do * 1000 * 60. We inlined this method coz it was not carrying its weight and we also introduced another method on Environment called getRecentChangesRefreshIntervalInMillis().

Lets have a look at the other methods:

We renamed the reload() to fetch(). What its really doing is fetching the recentChanges from a flat file. Since it is in the recentChanges servlet class, fetch() is good enough a name.

We would have loved to refactor this further. Esp. pushing the loop into the ChangeLog? and just giving it a date range to fetch changes from. Also we could have got rid of the null check, by making sure getChanges() always returned a collection, even if it was an empty collection.

We were also able to clean up the whole date logic which was getting in the way. We created a method called timeForNDaysAgo(int daysAgo) which return the required date.

This method could have been a little more clearer. Why are we doing -1 * daysAgo is not very clear.

There was also the logic for how many days you need to get the recent changes for. Certainly you don't want everything from the day the wiki was created. This logic was also mixed up in the reload(), we pulled out numberOfDaysToGetRecentChangesFor() method to make it clear. Essentially replace temp with query refactoring.

You'll notice that if the PROPERTY_RECENT_CHANGES_DAYS is not set or is set to 0, we default the value to DEFAULT_NUMBER_OF_DAYS (which is 5). This would also be a great thing to have a method on Environment which takes a default value. This is certainly a duplication that everyone who calls getIntSetting() might be checking for zero and setting a default value.

This is how far we got in 1 hour.

Created by: Naresh Last Modification: Sunday 02 of December, 2007 04:55:51 PST by Naresh


Online users

3 online users

RSS Feeds