The Artima Developer Community
Sponsored Link

Agile Buzz Forum
Objects for "Newbies"

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Steven E. Newton

Posts: 137
Nickname: cm
Registered: Apr, 2003

Steven E. Newton is an independent consultant in Portland, Oregon.
Objects for "Newbies" Posted: Aug 29, 2004 10:49 AM
Reply to this message Reply

This post originated from an RSS feed registered with Agile Buzz by Steven E. Newton.
Original Post: Objects for "Newbies"
Feed Title: Crater Moon Buzz
Feed URL: http://www.cmdev.com/buzz/blosxom.cgi?flav=rss
Feed Description: Views and experiences from the software world.
Latest Agile Buzz Posts
Latest Agile Buzz Posts by Steven E. Newton
Latest Posts From Crater Moon Buzz

Advertisement

Simple coding tips for junior to intermediate programmers new to objects.

  • It's not a big deal to create a new class or method -- especially not a new method.
  • Control structures don't appear as often in good OO code as in good procedural good.
  • A method can be thought of as a function that retains state across invocations and can be called over and over again without having to re-initialize and pass in every parameter.
  • Whenever a chunk of code becomes a good candidate for moving into a function in procedural terms, consider creating a class instead. This is especially true if it appears that the function would take many parameters and be called from many places.
  • Whenever it appears that code might benefit from adding a comment, add a new method instead, and move the code that the comment would have applied to into the new method. Name the method something that summarizes the intent of the comment.
  • If code is calling a method on another class and then calling a method on the returned value, consider creating a method on the other class that does the work.

Consider this exercise -- take a substantial piece of good procedural code and turn every function into a class. Not necessarily with the goal to produce an ideal implementation, but to explore the nature of objects.

Read: Objects for "Newbies"

Topic: Conference todos Previous Topic   Next Topic Topic: Is Google all it's cracked up to be?

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use