Beta
×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

Comments

top

Raspberry Pi Production Delayed By Factory's Assembly Flub

kabz Re:Why the magnetics? (132 comments)

Surely, this is a brilliant post, and should be modded heavenwards. I haven't laughed so much all day.

more than 2 years ago
top

Ask Slashdot: Good, Forgotten Fantasy & Science Fiction Novels?

kabz Re:This is completely NOT a forgotten author but.. (1244 comments)

You know there was a sequel called 'secret of the sixth magic'... I loved that too. Always kinda reminded me of 'A Saturday Life', not sci-fi but fairly obscure I'd think. Anyway, Patrick Rothfuss probably read Master of the Five Magics, I think I can see a little coming through in his books.

more than 2 years ago
top

30 Years of the BBC Micro

kabz Re:A9 load immediate (208 comments)

Hee hee. I thought your sig was ATOM BASIC at first, but alas, Intercal right?

more than 2 years ago
top

Piston-Powered Nuclear Fusion

kabz Interesting... (147 comments)

I wonder if this is related to the suspected fusion that occurs during ultrasound induced cavitation.

more than 5 years ago
top

Internet Killed the Satellite Radio Star

kabz Re:XM (368 comments)

There is a place for commercial community stations. It's viable to support a small local radio station with commercials, and not too bad to listen to, since, at least the content is local.

National commercial radio is rubbish though.

more than 5 years ago
top

Shifting Apps To ARM Chips Could Save Laptop Batteries

kabz Re:Not a problem (326 comments)

What about WinMobile?

It's carrying on the portable tradition. Maybe 'Windows' laptops could start running WinMobile...

more than 5 years ago
top

Appropriate Tech, 300mpg Car Top 2008 Innovators

kabz Re:Design more than 30 years old (155 comments)

Try using the bathroom after a curry, in a tiny Japanese apartment[1] with paper thin walls. Or any flat/apartment constructed in the last 10 years.

more than 5 years ago
top

Vector Graphics Lead Wish List For Future Browsers

kabz Re:"Community" ? (321 comments)

I believe the original driver behind the AJAX features was a web-based Outlook mail client.

Little did they know that they had opened the door to all the cool things we have today like Google Mail, Google Docs, Google News, Google Labs Search, Google Notebook, Google Base, MS Live Mesh ... err ;-)

I think we owe MS a huge debt of gratitude for making the web browser-based clients possible, and for most practical purposes, freeing us from monolithic PC-based software.

more than 6 years ago

Submissions

top

Refactoring: Improving the Design of Existing Code

kabz kabz writes  |  more than 6 years ago

kabz writes "Refactoring: Improving the Design of Existing Code
Martin Fowler with Kent Beck, John Brant, William Opdyke and Don Roberts.
In the Addison-Wesley Object Technology Series.

Refactoring (as I'll refer to the book from here on in) is a heavy and beautifully produced 418 page hardback book. Martin Fowler is a UK-based independent consultant who has worked on many large systems and is the author of several other books including UML-Distilled.

Refactoring is a self-help book in the tradition of Code Complete by Steve McConnell. It defines its audience clearly as working programmers and provides a set of problems, a practical and easily followed set of remedies and a rationale for applying those techniques.

Code refactoring is the process of restructuringing code in a controlled way to improve the structure and clarity of code, whilst maintaining the meaning of the code being restructured. Many maintenance problems stem from poorly written code that has become overly complex, where objects are overly familiar with each other, and where solutions implemented expeditiously contribute to the software being hard to understand and hard to add features to.

Typically refactorings are applied over a testable or local scope, with existing behavior being preserved. Refactoring as defined in this book is not about fixing bad designs, but instead should be applied at lower levels.

Testing a la Extreme Programming is emphasized as a control for ensuring that program meaning is not changed by refactoring. It is not over emphasized, and this is not a book about testing, but it is often mentioned and stays in the background through the book.

The refactorings presented in the book are not intended as a comprehensive solution for all problems, but they do offer a means to regain control of software that has been implemented poorly, or where maintenance has been shown to simply replace old bugs with newer ones.

The book is divided into two main sections, introductory material that introduces and discusses refactorings, and a lengthy taxonomy of refactorings that includes both examples and further discussion. The introductory material consists of a long worked example through simple Java code that implements printing a statement for a video store. Despite the simplicity of the code, Fowler shows in clear detail where improvements can be made, and how those improvements make the code both impressively easy to understand, and easy to maintain and add features.

Several key refactorings are demonstrated in the opening chapter including Extract Method, Move Method and Replace Conditional with Polymorphism. This is a book about programming in the object oriented paradigm, so as you might expect, the first two refactorings refer to extracting and moving object methods either into new methods, or between objects. The third example provides a means to replace special cased behavior in a single object type by deriving a sub type of the object and moving type specific code to the sub types. This is a fundamental technique in object oriented programming, and is discussed here in practical terms.

Now that several actual refactorings have been introduced, Fowler provides a solid and well thought-out discussion of the why's, when's and when not's of refactoring. For example, code can decay as features are added, and programmers special-case, or bodge additional functionality into existing objects. Fowler argues that the bitrot and decay makes software more unreliable, leads to bugs and can accelarate as the problem gets worse. Faced with these problems, refactoring should be used to improve local design and clean up and improve code, leading to better software, that is easier to maintain, easier to debug, and easier to improve with new features as requirements change.

However, there is a caveat, in that since software functionality should remain unchanged during refactoring, the process of refactoring consumes resources, but provides no easily measureable value. Fowler confronts this issue in a section that discusses how to communicate with managers, that you are performing refactoring work. He denies being subversive, but his conclusion is that refactoring should essentially be folded in with normal work as it improves the overall result.

This is a bit like goofing off on the basis that you'll think better after 20 minutes of fooseball. I'd definitely subscribe to that theory, but many others may not.

Kent Beck guests in Chapter Three for a review of the issues in typical software that suggest a refactoring may be needed. This chapter is entitled Bad Smells in Code, and most of the smells presented will be familiar to any reasonably experienced programmer, and they will be a great learning experience for less experienced programmers. I got the same feeling reading this chapter as I did when I first read Code Complete. Here was someone writing down names and describing problems that I had a vague unease about, but was too inexperienced to really articulate or do something about. Typically the refactorings address the same kind of issues that a code review with a skilled experienced programmer would address. Long parameter lists, too long methods, objects delving about in each others private variables, case statements, related code spread across different objects etc. None of these problems are debiliting in themselves, but added up, they lead to software that can be prone to error and difficult to maintain.

Most of the remaining substance of the book, 209 pages, is given over to a taxonomy of refactorings. These 72 refactorings are covered in detail with comprehensive simple examples presented in Java. Each refactorings is given a clear name, a number and a line or two of descriptive text. The motivation for the refactoring is then discussed, often including caveats and cautions. The mechanics of implementing the refactoring are then listed, with 1 or more (and often more) examples of implementing the refactoring. Refactorings range from the very simple to more complex examples such as Convert Procedural Design to Objects.

Due to the difficulties of reproducing large and complex sections of code, Fowler sticks with relatively simple examples. These seem to grate on him more than the reader, and he can come across as somewhat embarrassed when we look at the employee, programmer, manager pay example for the tenth time. I certainly didn't have a problem with it though.

Conclusion

This is a very well written and fun to read book. I personally feel that much of the material is implied by from Code Complete, but Fowler does a fantastic job of expanding and formalizing the idea of applying explicit refactorings. Much like Code Complete gave a motivation for keeping code well commented and laid out, this book presents the case for care and feeding of how to structure software. To fight bitrot and technical debt, poorly structured and unclear code should be targetted and refactored to improve structure and clarity. This gives a very real payback in terms of less required maintenance, and ease in adding features later on down the line.

Despite the fact that all the examples are in Java, the ideas are easily transferable to C++ or any procedural object oriented language.

Highly recommended."
top

kabz kabz writes  |  more than 7 years ago

kabz writes "Whilst researching an upcoming trip to the UK I discovered that the London Science Museum is having an important gaming exhibition called 'Game On'.
The linked article lists the games on show, from Space War on the PDP-1, through the Magnavox, Atari VCS, Vectrex to the arcade capable consoles of today.
This is of interest considering some of the recent threads on Slashdot."
top

kabz kabz writes  |  more than 7 years ago

kabz writes "From the cracks-in-the-dam department:
UK retail giant Tesco are partnering with Formjet Software Plc to sell a range of software including a Microsoft Office compatible office suite called Ability Office. Tesco will market the software, also including anti-virus and photo-editing solution within its stores.
With 1 out of every 8 retail pounds spent in Tesco stores, who's betting against them to take market share from Microsoft in the UK?"

Journals

top

Microsoft to Provide Users with TUX

kabz kabz writes  |  more than 6 years ago

In this ZDNet interview with Scott Charney, head of trustworthy computing at Microsoft, admitted this week that Windows Vista's User Account Control prompts are not intuitive and confuse users.

Interestingly, during the interview, Scott mentions the goal of providing users with TUX, or trusted user experience.

I wonder if they are taking the piss, as we say in the UK. Surely, he can't be unaware that this is the name of the Linux mascot.

top

Setting Up a Version Control System - At Home

kabz kabz writes  |  more than 6 years ago If you work on multiple machines, or if you work on multiple documents that you would like to keep in sync, then setting up a version control system at home may be easier than you might think. This blog article runs through setting up, and basic usage of Subversion.

top

Bad News for Nerds: Diet Soda makes You Fat.

kabz kabz writes  |  more than 6 years ago

This article in the New York Times finds a strong link between drinking diet soda and being fat.

I'll certainly be laying off the Diet Dr Pepper.

top

The 10 Worst PC Keyboards of All Time

kabz kabz writes  |  more than 6 years ago

This article on PC World lists the 10 Worst PC Keyboards of all time.

I'll try not to spoil it but, the ZX-81 and Mattel Aquarius are represented. For those of us with long memories, where is the Sord M5?

top

OLPC Unboxing Pictures

kabz kabz writes  |  more than 6 years ago

My OLPC finally arrived!! I've been checking the FedEx website, checking my GMail, and browsing OLPC News.

The unboxing pictures.

In common with many other people, I finally received the little box, containing the cute little Linux lapto, that is the most obvious deliverable of Nicholas Negroponte's OLPC Foundation.

The other cool aspects are that the machine can form an adhoc mesh network, has good battery life, runs a unique Python-based windowing system called Sugar, and can be purchased for less than $200.

top

First Day OLPC Donors in Line for Delivery

kabz kabz writes  |  more than 6 years ago It looks like the first OLPCs will soon be on their way to happy recipients!!

Your XO laptop is on the way.

Your donated XO laptop will soon be delivered into the hands of a child in Afghanistan, Cambodia, Haiti, Mongolia or Rwanda. In one of our recipient children's own words, "I want to thank you people because you had given us the laptop and I love it so much." Your generosity will make a world of difference in these children's lives, and in the future of their respective countries.

Thanks to your early action, your XO laptop is scheduled to be delivered between December 14 and December 24. Our "first day" donors are our highest priority and we are making every effort to deliver your XO laptop(s) as soon as possible. We will send you an update upon shipment.

top

kabz kabz writes  |  more than 8 years ago Finally got around to updating my personal web-site. It's been moved to its own domain on www.jonathanwatmough.com and given a standardized CSS stylesheet which might get jollied up a bit later since it's clean, but a bit sparce at the moment.

top

First Week on OSX

kabz kabz writes  |  about 9 years ago

Just switched in the last week to a Powerbook G4 12" as my web and general 'stuff' machine. I really like it so far, and haven't found too many problems.

The first 'difficulty' was getting access to my companies windows shares though. Here's how I managed to get around some of the samba hitches ... Connect to network. I connect to a wireless usually, and make sure you can see the internet. Create a VPN using PPTP if you are connecting to a Microsoft VPN server. At this point you may be able to see shares on the windows network. I couldn't sadly. OK TURN OFF IPV6. I have no idea why this is on, but turn it off and try the VPN again. Now try doing the 'Connect to server' option in Finder. If you can connect to a windows share name, try the windows share name with the appropriate domain added to it. NT seems to be pretty smart about adding mycompany.com to windows names, allowing DNS resolution if something gets funky with the CIFS stuff.

Anyway, now I can connect great to my desktop machine and pull files off it.

Remote Desktop Connection

Google for this, and download for OSX from the Microsoft site. Works excellent.

Slashdot Login

Need an Account?

Forgot your password?

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>