Your SlideShare is downloading. ×
J90 X
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

J90 X

349
views

Published on

The finer points of having really clean code.

The finer points of having really clean code.

Published in: Technology, Education

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
349
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide
  • Line length … really follow the rule of 6. If you have more than 6 things for a programmer to remember, their brain is going to blow up.
  • As Java developers, we all have an innate, burning desire to write the cleanest code possible. If given the opportunity, each and every one else would write code so clean you could read it to your kids as a bed time story. That’s just the thing, “If given the opportunity”. Developers don’t write bad code; bad situations write bad code. At some point in our coding careers we’ve all had the sneaky feeling that we’ve compromised our clean code instinct. Perhaps the code you were working on was poor condition. Perhaps there was a deadline and it just needed to get done. Whatever the case, at some point we’ve probably set our convictions aside because there looked like there was just no hope. Men like Martin Fowler, Robert “Uncle Bob” Martin, Ward Cunningham, and Kent Beck have been in those situations and they have found the answers. They have solved the problems that cursed programmers as recently as 8 – 10 years ago. They have given us a tremendous gift. And with that let’s look at some code.. That feeling is really what started me on a quest to discover what it means to write clean code. It was a desire to know and have the confidence that my code was the absolute cleanest it could possibly be.
  • Let’s talk about how not to get there…“Uncle Bob” talks about the grand redesign in the sky.Someday, your code base is going to get the golden seal of being rewritten. What a glorious that will be! We shall pool the most talented programmers “Tiger Team” into one project and dream of the ultimate design.ANNNNNNNNNNNNNNNNNNNThis point is talked about in Refactoring as well. Creating clean code is like eating an elephant, one bit at a time. Taking the big rewrite jump could land you with some of the same predicaments as beforeThe most important tool in creating clean code is having worthwhile unit tests backing your base.
  • The best tool get your code cleanIt’s so much fun thinking of the perfect design for code and making UML documents etc.Test driven development drives the perfect design out of your codebase. It makes writing dirty code painful!The cleanliness of your tests is has a direct correlation with your design. One assert per test!!
  • Transcript

    • 1. J90X
      Java Flab into Fab
    • 2. What -> Clean Code?
    • 3. Source: Clean Codepage 77
    • 4. “”I could list all of the qualities that I notice in clean code, but there is one overarching quality that leads to all of them. Clean code always looks like it was written by someone who cares.””
      -Michael Feathers
      author of “Working Effectively with Legacy Code”
    • 5. How -> Clean Code
    • 6. Test Driven Development -> Clean
    • 7. Clean Code -> …
      Temporary Variables
      Method Parameters
      Zero!
      One … okay
      Two … some situations
      Three … rare
      Four
      Clean now. Optimize Later
      Reads like a newspaper
    • 8. Really Clean Code -> “AND”
    • 9. Really Clean Code -> Impl
    • 10. Really Clean Code ->Hides Generics
    • 11. Really Clean Code ->Maps
    • 12. Really Clean Code ->
      Doesn’t Ask, it Tells
    • 13. Clean Code -> References
      Example Source Code
      http://code.google.com/p/flabby-raffle/
      Martin, Robert C. Clean Code: a Handbook of Agile Software Craftsmanship. Upper Saddle River, NJ: Prentice Hall, 2009. Print.
      Fields, Jay, Shane Harvie, and Martin Fowler. Refactoring. Upper Saddle River, NJ: Addison-Wesley, 2010. Print.
      Freeman, Steve, and Nat Pryce. Growing Object-oriented Software, Guided by Tests. Upper Saddle River, NJ: Addison Wesley, 2010. Print.
    • 14. Mike Menne
      @
      Twitter: mpmenne
      LinkedIn: http://www.linkedin.com/in/mmenne
      Likes: