13.07.2015 Views

Smalltalk Best Practice Patterns Volume 1: Coding - Free

Smalltalk Best Practice Patterns Volume 1: Coding - Free

Smalltalk Best Practice Patterns Volume 1: Coding - Free

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

PrefaceThis preface will explain what this book is about. It will convince you to buy this book, or you willknow why you shouldn’t (more of the former than the latter, I hope).What’s it all about?This book is about the simple things experienced, successful <strong>Smalltalk</strong>ers do that beginners don’t.In a sense it is a style guide. I have tried to penetrate beneath the surface, though, to get at thehuman realities that make the rules work instead of focusing solely on the rules themselves.The topics covered are the daily tactics of programming:How do you choose names for objects, variables, and methods?How do you break logic into methods?How do you communicate most clearly through your code?These are small issues. There are also many bigger technical reasons why projects fail (and manymore non-technical reasons). The attraction of this set of issues is that they are so tractable. Youdon’t have to be a programming wizard to pick good names, you just have to have good advice.The advice is broken into 89 patterns. Each pattern presents:a recurring daily programming problemthe tradeoffs that affect solutions to the problema concrete recipe to create a solution for the problemFor example, here is a summary of a pattern called “Role Suggesting Temporary Variable Name”:Problem: What do you name a temporary variable?Tradeoffs:You want to include lots of information in the nameYou want the name to be short so it is easy to type and doesn’t make formattingdifficultYou don’t want redundant information in the nameYou want to communicate why the variable existsYou want to communicate the type of the variable (i.e. what messages it is sent)Solution: Name the variable after the role it plays. The type can be inferred from context,and so doesn’t need to be part of the name.<strong>Coding</strong> <strong>Patterns</strong> page 5 of 147 9/30/2006

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!