Wednesday, March 16, 2005

Refactoring I'm familiar with. Ken Pugh I'm familiar with. Ken Pugh talking about prefactoring sounded interesting. And it was!


You may not know what prefactoring is. I didn't. Ken defines prefactoring as "developing code that reduces the need to refactor".

Oh, I get it. Ken's talking about good coding principles!

Sure enough, that's exactly what this talk was about. A few that stood out for me:

  • Know the assumptions you're making. When serializing a spreadsheet out to disk is it better to write it out be rows or by columns? The "correct" answer completely depends on your current context. Make your implicit assumptions explicit and then make your decisions based on that full set of information.
  • When in doubt, choose the option that will make it easier to change things in the future. For example, it's easier to combine concepts than to split them apart. Gerry Weinberg (kibitzing from amidst the crowd) generalized this to "It's easier to lose information than to find it". Similarly, pretend there are no primitives and make classes for everything. If Account changes from an int to a string, do you really want to inspect every int in your application to decide whether it needs to be changed?
  • Define every class using a single sentence. When contemplating adding a responsibility to a class, vet it against that sentence to determine whether it really fits in the class. Good names are still important, but a succinct definition of a class's purpose is extremely useful even if it's name is the most perfect name imaginable.
  • Separate concepts into classes based on behavior, not data. Inheritance hierarchies whose lower levels differ only in the data they return are misusing inheritance. Instead, create a single class that is configured with the differing data.
  • Write single purpose functions. Ken takes this further than the common "a method should do exactly one thing and no more" and advises that you separate the policy of a method (what it does) from its implementation (how it does it). For example, don't embed blocks of code in the conditionals and various branches of an if statement but instead call methods that encapsulate that code. This is just one part of a larger practice Ken also espouses: intentional programming. Code that has been programmed intentionally says what it means and means what it says and is more understandable than code that has just been written.
  • Be sure you're using the entire interface when you inherit. If you're just using part of the interface containment is likely a better option. Along the same lines, split a single interface into multiple interfaces if multiple clients need different parts of the interface.

Now if Ken could just show me how to prefactor my way out of maintenance altogether...<g/>

3:39 PM

53 comments:

at 9:20 AM tweedledeetweedledum said...

This blog is awesome! If you get a chance you may want to visit this payroll software site, it's pretty awesome too!

at 9:23 PM Anonymous said...

One good resource for internet software and many more free software alternatives is Software4YourSuccess.com
Yes it is my site and I would love for you to drop by for a second. From there you will have free access to several of my products such as The Marketing Toolbar (which is goldmine of information on how to do things quickly and on the cheap, thus saving you time and money).
Also for webmasters I have created Webmaster Wizards, which will help you with almost every aspect of putting code on your site from things such as legal and privacy disclaimers to popunders. I have so much content and free software there I could fill up this whole blog, so check it out Thanks, Sincerely Rob Rudd

at 2:53 AM Anonymous said...

Now you could find Classes for a multitude of subjects on your area , like autocad classes and they could be found by visiting autocad classes

at 1:04 AM hassan said...

Hi :)

You have a great blog! I'll make sure to bookmark it and visit regularly. Keep up the great work!

Please visit my site if you get some time: Resell Rights eBooks

at 2:23 AM Anonymous said...

Hey, you have a great blog here! I'm definitely going to bookmark you!
I have found free ebooks site/blog. It pretty much covers free ebooks related stuff.
go and get your free ebooks :-)

at 8:30 PM Anonymous said...

the World Wide Web is home to a great number of marketing opportunities that you could avail of,

at 10:44 PM Anonymous said...

This easy to use software will automatically turn articles into complete web pages and help you generate revenues using Google Adsense.instant messaging softwareinstant messaging software

at 5:17 AM Anonymous said...

Add tons of new subscribers to your newsletter automatically using this amazing package of proven software solutions.small business softwaresmall business software

at 4:39 PM A Million Dollar Income said...

website traffic from
http://branchiseinc.com

get targeted traffic, free downloads, free software and ebooks at my bonus area.


http://branchiseinc.com

at 8:47 AM amilliondollarincome said...

Your article is most refreshing, while I cannot agree with this point of view, I can understand your point of view. Here is a fabulous website p2p free downloads
that provides you with free software, free php scripts, free ebooks and a ton of other free stuff.
p2p free downloads
http://mybonusarea.com
p2p free downloads


Thank You

at 6:59 PM BayuFA said...

free banner exchange,

internet business marketing
http://ourbannerexchange.com
internet business marketing


deliver a million or more hits to your website. Get a swarm of Traffic and multiply your sales.

internet business marketing
http://ourbannerexchange.com
internet business marketing

at 9:19 PM hopi said...

ThankYou

From Hopi
http://ourbannerexchange.com
internet marketing solution
internet marketing solution

at 8:41 PM Robert Campanile said...

Hello really enjoyed reading your blog/site about HomeBusiness and found quite a bit of great information and will bookmark your site so I don't miss out on anything in the future. Also if you would like MasterResaleRights to Hundreds of Niche Products worth $3000 for only $29.95 then go here http://www.incomecash.info and check it out! And thanks again for that great blog.

at 3:34 PM P. Bench said...

Cool! Thanks for the info...If you're into Source Code be sure to check out http://sourcecodegoldmine.com/v1/go/154/. It was released today and will blow you away. True!

at 10:22 AM Scott A. Edwards said...

Wow what a cool blog you have here! I am impressed. You really put a lot of time and effort into this. I wish I had your creative writing skills, progressive talent and self- discipline to produce a blog like you did. Your blog really does deserve an honest compliment. If you have some time, stop by my site. It deals with stuff like, click here: mlm and then feel free to e-mail me with your words of wisdom.

P.S. I'll sure put the word out about your site and I would appreciate any business you may send my. way... Later, Scott.

at 12:52 AM Scott A. Edwards said...

Here it is... FREE advertising, FREE download. No cost to you! Get your FREE download NOW! Make money and get FREE advertising! This is a great program for the new year... Check this out now for FREE!

To find out more visit: low cost mlm site. It successfully exposes FREE information covering traffic and low cost mlm related stuff. Don't forget, FREE, FREE, FREE!!!

at 10:35 PM scott edwards said...

NOW, check this out for FREE...

There is a new, fully automated traffic-generation system that can send 1000's of targeted prospects to your website, for FREE! It only takes 5 minutes to set up to set your FREE account!

To find out more visit: make money while you sleep site. It successfully exposes FREE information covering Traffic and make money while you sleep related stuff.

at 4:45 PM scott edwards said...

Congradulations on a well written, interesting and superb blog! Have you heard about the shocking news?

1000's of real people are earning quiet fortunes from home using the most ingenious automated system ever invented.

Are you curious to find out what this is all about?

Why not? You have nothing to lose.

You can sign up for this system absolutely free of charge and check it all out for yourself.

To start off, we have a video presentation for you to watch. Just turn up the speakers if you can, and click on the link below.

Have fun and open your mind.

It is all right here: homebusiness It successfully covers homebusiness related stuff.

Come and check it out now, Scott :-)

at 1:23 PM Scott Edwards said...

New Blog Submission Software Takes Total Domination To A whole New Level, And Allows Complete Control Over Any Market and Any Product You Sell.--Renders All Other Marketing Methods Totally Useless by Comparison"
Click here: FREE DEMO

at 12:12 AM Anonymous said...

Searching blogs for web traffic.
Came here. Interesting blog.
http://www.1st-choice-4-website-traffic.com
web traffic

at 1:53 AM Anonymous said...

Searching blogs for monitor traffic.
Came here. Interesting blog.
http://www.1st-choice-4-website-traffic.com
monitor traffic

at 3:43 PM Scott A. Edwards said...

Hello my dear internet friends! I have some very exiting news. A lot of you know me pretty well now and have helped me a lot. I sincerely appreciate you and I want to do the same for you. Please take a moment to check out this excellent opportunity. I am so very proud to be a part of this business, I just don't have the space I need here to fully express my gratitude and I know you will feel the same way I do. You can even try it out at no charge. Take some time to explore and learn what could be one of the most significant aspects in your life. You will not be wasting your time and I will be honored for you to be my guest. You will love this... Please give me a chance to prove it to you. Click here: turbo-charged It elegantly covers turbo-charged related ideas and FREE information. Sincerely, Scott.

at 11:48 PM Anonymous said...

Hi ##name##. There are many different ways to earn money onlineadvertising. I continue to look for different ways to promote my sites and business without going broke. let me know what you all are seeing out there.advertising

at 10:59 PM Anonymous said...

Choice blog. Thanks. Want more
from you. Will come again. Used
search word auction traffic.
http://www.1st-choice-4-website-traffic.com
auction traffic

at 5:33 PM Scott Arthur Edwards said...

Check this out for FREE...

This opportunity says:

"Your Ad" Will Be Instantly Displayed on Thousands of Websites and Read By Over 10 Million People Per Week For FREE, and It Only Takes 60 Seconds To Get Started!

To find out more visit: affordable site. It successfully exposes FREE information covering Traffic and affordable related stuff.

at 2:16 AM make money at home said...

Hi,
I was searching through Blogger to see if I can find some information on make money at home. I stumbled on your blog, as this was not quite what I was looking for about make money at home. I did however read your blog and found it quite interesting, keep up the good work and hopefully I will visit it again.
Regards,

at 6:50 AM online pharmacy home business said...

Hey Fellow, you have a top-notch blog here!
If you have a moment, please have a look at my online pharmacy home business site.
Good luck!

at 4:25 AM Kate said...

I found this blog when looking for increase site targeted traffic web and I think it is very nice.
Regards, Website Traffic Info

at 9:33 PM make money using the internet said...

Hey, you have a great blog here! I'm definitely going to bookmark you!
I have a make money using the internet site.
Come and check it out if you get time :-)
Greetings.

at 3:04 AM toy dolls said...

I was searching blogs,and I found yours.Please,
accept my congratulations for your excellent work!
If you have a moment, please visit my toy dolls site.
Have a good day!

at 9:15 PM business opportunity said...

You gave me an interesting idea. Thx.

Steve @
business opportunity

at 3:04 PM ebayauctionbusiness said...

Hi, this blog is great for small business related content! I'm gonna bookmark you for business related information. This blog surely rocks!!!

If you don't mind, lemme introduce you to another site related to business opportunity. It pretty much covers starting a business related stuff.

I hope you to check out this site for business plan if you get time :-)

Thanks and Get More Than You Expect With
Bunny S.
Start Your Own Business

at 2:10 PM Scott Arthur Edwards said...

Dear friend, Here is an opportunity for you that is taking over the internet. The compensation plan is second to none. The spill over will blow your mind and the educational products are of the highest quality. Knowledge is power and nobody can ever take that away from you. Join me in this business and see for yourself what you will be getting. Click here: FREE Information

at 8:59 AM Anonymous said...

Your Blog is Awesome. I am glad that I got a chance to come by and check it out. I am always looking for hot information that will help my online business to flourish.http://www.affiliatehomebasedbusiness.com

at 1:41 AM Anonymous said...

BUILD YOUR LIST, WIN THE WEEKLY DRAW, EARN MONEY! Learn more about it here: online money making business site. It pretty much covers online money making business related stuff and it is FREE to join.

at 5:51 PM Scott A. Edwards said...

Dear friends, Now you can help yourself take advantage of the huge frenzy of FREE advertising in your spare time, while in the comfort of your own home. Hook up NOW with this exiting program. Click here: FREE INFORMATION

at 5:08 PM Anonymous said...

Hey Guys if you have been dumped by adsense or given the run around by Yahoo then you need to look at this, Fair Ads Network are only taken 10,000 members then they are closing the doors, I suggest that you take a look Now before its too late : http://fairadsnetwork.com/034704959097

at 4:52 PM Anonymous said...

Hello we're Jer&Sooz of JerSooz Enterprises and noticed your into same niche as us make money online casino well we come across a lot of Great Offers make money online casino so thought would say check us out and maybe can help each other We like making LifeTime Friends and make money online casino so have a Fun One and Best Wishes Thanks Jer&Sooz

at 1:36 PM Anonymous said...

http://www.adquity.com

Classifieds for our community. Buy, sell, trade, date, events... post anything. Adquity Classifieds.

http://www.adquity.com

at 3:46 PM Anonymous said...

Great blog....now...ADVICE TIME!! - If you need more blogging secret site traffic web then congratulations I've come to the right place, try blogging secret site traffic web - this is the best place online to get massive volumes of internet traffic back to your blog for blog publicity purposes. Within a week I had trippled my volume of traffic - Signup is free and before you know it you will flying up the Google search egine - guaranteed!! - Signup is free you have nothing to lose. Best of luck with it and continued success with your blog!!

at 12:49 AM Anonymous said...

Nice blog!! I'm into high traffic web site and to drive traffic to my website I signed up free for this superb traffic gereating tool - I now have loads of hits to my websites and blogs. This can see your affiliate commission shoot through the roof - meaning lots of extra money coming in for you and your family. Sign up now - it's free.. Best of luck, cheers for now, dave.

at 3:19 PM Anonymous said...

loot free ads

at 3:11 PM Kurt A. Tasche said...

Get over 10,000 hits per day to your website for free!! Check out
this traffic exchange downline builder

at 10:54 PM Anonymous said...

post anything

at 6:08 PM Anonymous said...

http://www.adquity.com

Classifieds for our community. Buy, sell, trade, date, events... post anything. Adquity Classifieds.

http://www.adquity.com

at 9:55 PM Anonymous said...

The web has evolved into a complex "organism" which, to some, appears to have a life of its own. As the Internet has evolved, so too have online marketers and publishers. The dot-com balloon is said to have burst but savvy publishers have grabbed the coat tails of the Google search monster and employ Google AdSense on content-rich websites. Google AdSense, a pioneer for providing content-sensitive advertisements, has been a boon to webmasters looking for alternatives to amortize their web trafffic. The Evolution of Google AdSense

at 5:38 PM Anonymous said...

or visit http://mywebcashstore.com/branco0116

at 6:52 AM Anonymous said...

directory marketing

at 9:58 AM Anonymous said...

[url=http://ericbachmann.portmerch.com/stores/schemes/dingbats/color/images/john-mayer.html#1]john mayer[/url]
[url=http://ericbachmann.portmerch.com/stores/schemes/dingbats/color/images/carrie-underwood.html#2]carrie underwood[/url]
[url=http://ericbachmann.portmerch.com/stores/schemes/dingbats/color/images/robin-thicke.html#3]robin thicke[/url]
john mayer
carrie underwood
robin thicke

at 3:25 AM Anonymous said...

[url=http://ericbachmann.portmerch.com/stores/schemes/dingbats/color/images/john-mayer.html#1]john mayer[/url]
[url=http://ericbachmann.portmerch.com/stores/schemes/dingbats/color/images/carrie-underwood.html#2]carrie underwood[/url]
[url=http://ericbachmann.portmerch.com/stores/schemes/dingbats/color/images/robin-thicke.html#3]robin thicke[/url]
john mayer
carrie underwood
robin thicke

at 12:42 PM free jobs said...

companies marketing mineral makeups and also get the best bargains in mineral makeup you can imagine,
find aout how to consolidate your students loans or just how to lower your actual rates.,
looking for breast enlargements? in Rochester,
homeopathy for eczema learn about it.,
Allergies, information about lipitor,
save big with great bargains in mineral makeup,

change edition interviewing motivational people preparing second
,

interviewing motivational people preparing second time
,

interviewing people motivational preparing for a second time
,

black mold exposure
,

black mold exposure symptoms
,

black mold symptoms of exposure
,

free job interview questions
,

free job interview answers
,

interview answers to get a job
,

lookfor hair styles for fine thin hair
,

search hair styles for fine thin hair
,

hair styles for fine thin hair
,

beach resort in the philippines
,

great beach resort in the philippines
,

luxury beach resort in the philippines
,
iron garden gates, here,
iron garden gates,
wrought iron garden gates
, here
,
wrought iron garden gates
,
You: The Owner's Manual: An Insider's Guide to the Body That Will Make You Healthier and Younger
,
eat eating mindless more than think we we why
,


texturizer,
texturizers here,
black hair texturizer,
find aout how care curly hair,
find about how to care curly hair,
care curly hair,
lipitor rash,
lipitor reactions,
new house ventura california,
the house new houston tx,
new house washington dc,
new house pa philadelphia,
san antonio tx house new,
house new pa philadelphia,
new house washington dc,
new house ventura california,
the house new houston tx,
house new san antonio tx,
the house new houston tx, that you are looking for,
new house ventura california, you need to buy,
new house washington dc,
house new pa philadelphia,
new house san antonio tx,

hair surgery transplant
,

air filter allergy
,

refurbished dell laptop computers
,

hair surgery transplant
,

air filter allergy
,

refurbished dell laptop computers
,

hair surgery transplant
,

air filter allergy
,

refurbished dell laptop computers
,

chocolate esophagus heartburn study
,

chocolate esophagus heartburn study
be informed,

digestion healing healthy heartburn natural preventing way
,

digestion healing healthy heartburn natural preventing way
,
sew skirts, 16simple styles you can make!,
sew what skirts 16 simple styles you,
rebates and discounts on sunsetter awnings,
sunsetter awnings discounts and rebates,
discount on sunsetter awnings


truck and bus tires 12r 22.5, get the best price,
tires truck and bus 12r 22.5 best price,
tires truck bus tires12r 22.5 best price,
plush car seat strap covers,
car seat strap covers,plush,
car seat strap, plush covers,
oscoda voip phone systems, the best!,
oscoda voip the phone system,
oscoda voip phone systems,
exterior iron gates,
oriental wrought iron gates,
powder coated iron garden fencing,

at 10:13 PM Manikandan said...

Hi.nice blog.I am fresh jobseeker.please help me that where can i get
links of free job posts sites.
Thank you.....

at 4:44 AM air matress said...

black mold exposure,
black mold symptoms of exposure,

wrought iron garden gates,
your next iron garden gates, here,

hair styles for fine thin hair,
search hair styles for fine thin hair,

night vision binoculars,
buy, night vision binoculars,

lipitor reactions,
lipitor reactions,

luxury beach resort in the philippines,
beach resort in the philippines,

homeopathy for baby eczema.,
homeopathy for baby eczema.,

save big with great mineral makeup bargains,
companies marketing mineral makeups,

prodam iphone praha,
Apple prodam iphone praha,

iphone clone cect manual,
manual for iphone clone cect,

fero 52 binoculars night vision,
fero 52 night vision,

best night vision binoculars,
buy, best night vision binoculars,

computer programs to make photo albums,
computer programs, make photo albums,


craftmatic adjustable air bed
craftmatic adjustable air bed, info here

boyd night air bed
boyd night air bed, low price

air bed in wisconsin
best air beds in wisconsin

cloud air inflatable bed
best cloud air inflatable beds

portable sealy air bed
portables, sealy air beds

aluminum rv luggage racks
aluminum made, rv luggage racks

air bed form raised
best air beds form raised

support equipments aircraft
best support equipments for aircrafts

informercials bed air
best, informercials bed air

mattress sized air beds
best mattress sized air bed

antique doorknob identification
antique doorknob, identification tips

troubleshooting dvd player
troubleshooting with the dvd player

flat panel television lcd versus plasma
flat panel television, lcd versus plasma pic the best

causes of economic recession
what are the causes of economic recession

free printable tax forms
free printable IRS tax forms

bed air foam adjustable
bed air adjustable foam

hoof prints antique and unusual equestrian prints
hoof prints, antique equestrian prints

buy adjustable air bed
buy the best adjustable air beds

air bedscanadian stores
air beds, cheap canadian stores