Monday 11 June 2012

[Enhance Productivity] - Challenge 2

I didn't get any comments from you about your experiences. I assume you didn't dare trying it, or just gave up early. If you want to stretch your skills and get even better at what you do, don't avoid hard work and exercises!


Stop being satisfied with your skills, and take them to a new level!

So here's my challenge for this week:

Keep method lengths below 9 lines.

It is very hard at first, because all those conditions and loops which make our methods long are in the way. But do they really have to be there? Can't they have a separate method in which they can run in isolation? Try and name concepts in your methods and get familiar with the "extract method" refactoring tool in your IDE (if it has one).
I don't say that you should go and modify every existing method there is in your codebase. I'm daring you to not to write methods longer than 9 lines for a week. Just one week! You can do it!

What good does this do?

Well first of all, you'll learn how to represent a feature, method in concepts.
You'll end up with small methods which are easy to understand and easy to test.
You'll find yourself re-using concepts rather than copy-pasting code snippets.

Oh, and don't forget to learn keyboard shortcuts for the IDE functions you use!

Here's what I dare you to do.

  1. Do the challenge
  2. Record your observations
  3. Blog about your experiences, and link it to this post
  4. Share your post in the comment section of this post.

No comments :

Post a Comment

Note: only a member of this blog may post a comment.