Posterous theme by Cory Watilo

Clean Code Episode III - Contents and Release Notes.

Clean Code Episode III - Functions, is now available for viewing at http://cleancoders.com. Here's what's in it. 

The episode is broken into four parts, one video and three screencasts.  The video is the primary resource.  The three screencasts are optional material for those who might enjoy further study. 

Contents:

Clean Coders Video
Episode III: Functions

Segment I: Overview

Functions.  They’re what we do!  The vast majority of the code we write is inside functions.  Nearly all the code we write that actually does something is inside a function.  Functions are the first tier of program organization -- the first container that we put lines of code into.  So we’d better know how to write them well!

How big should a function be?  20 lines?  30 lines?  Do you know?  It turns out that there’s a simple rule that always works.  I’m going to teach it to you.  If you follow that rule your functions will always be the right size.  

Have you ever wondered if you’ve found all the classes in your design?  Do you worry that some classes might be hiding undiscovered somewhere?  It turns out that hidden classes, and function size are deeply connected.  I’m going to show you how to find those missing classes as part of getting your functions to be the right size.

You’ve heard the rule that a function should do “One Thing”.  We all have.  Sometimes it’s said like this:  “A function should do one thing.  It should do it well.  It should do it only.”  But what does “One Thing” mean?  I’m going to tell you in no uncertain terms.

Segment II - What makes the Sun Shine?

Our astronomy lesson -- a brief history of the discoveries leading to our understanding of how the sun shines.

Segment III - The First Rule of Functions.

Functions should be small -- very very small.  In this segment we explore just how small functions should be.  We also look at a high-speed summary of the first screencast (testableHtml) in order to show the process by which long functions are broken down into many smaller well-named functions.

Segment IV -- Are You Out of Your Mind?

Many developers have legitimate concerns about the consequences of applications composed of many small functions.  They may fear getting lost in a sea of little functions, or they may fear function call overhead.  Some will fear that writing many small functions takes longer than writing a few larger functions.  This segment explains the basis for those concerns and addresses when and and why they are unfounded.

Segment V: Where the Classes go to Hide.

In this segment we explore the fact that every large function is actually one or more classes in hiding.  After discussing the theory, we explore a high-speed summary of the second screencast, PrimeGenerator in which a large function is broken down into two different classes one step at a time.

Segment VI -- One Thing.

We've all heard the rule that functions should do "one thing".  But just what does "one thing" mean?  In this segment we break it down into a simple unambiguous criterion.  You will never again wonder whether your functions do one thing because you will learn the simple and unambiguous test. 

Segment VII -- Extract Till You Drop

The climax of the video.  In this segment we explore the practice of breaking down functions into smaller and smaller pieces, until you reach the limit.  This segment concludes with a high speed summary of the hour-long VideoStore screencast, in which we take Martin Fowler's example from the Refactoring book, and break it down until it can't be broken any more. 

Segment VIII -- Conclusion

As usual, we conclude with a quick review of all the major points. 

Optional Material

The three screencasts that are summarized in the video are available for seperate download.

Optional Screencast 1: testableHtml

Optional Screencast 2: PrimeGenerator

Optional Screencast 3: Video Store

| Viewed
times | Favorited 0 times