Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Making method calls_simpler

123 views

Published on

Chapter 10.
Diego Alejandro Rios Londoño

Published in: Education
  • Be the first to comment

  • Be the first to like this

Making method calls_simpler

  1. 1. Chapter 10. Diego Alejandro Rios Londoño.
  2. 2.  Objects are all about the interfaces. Coming up with the interfaces that are easy to understand and use is a key in developing good object-oriented software.  Often the simplest and most important thing you can do is to change the name of a method, naming is a key tool in communication.  If you understand what a programm is doing you should not be afraid to use Rename method to pass on that knowledge. You can also rename variables and classes
  3. 3.  Small methods to factor complex processes are very importat, done badly can lead you on a merry dance to find out what all the Little methods do. The key to avoid this merry dance is naming the methods.  The methods must be named in a way that communicates their intention.
  4. 4.  Normally used when you need more information in a method and this information was not sent yet.
  5. 5.  Remove parameter  Normally used when a method is no longer using the information sent by the parameter.
  6. 6.  You can easily add or remove parameter but you have to be careful because it can lead you on troubles,  If you have more than two parameters, you must be careful because you parameter list is getting bigger and it can be forgot.
  7. 7.  “When you have a function that gives you a value and has no observable side effects, you have a very valuable thing. You can call this function as often as you like. You can move the call to other places in the method. In short, you have a lot less to worry about. ”  “It is a good idea to clearly signal the difference between methods with side effects and those without. A good rule to follow is to say that any method that returns a value should not have observable side effects. Some programmers treat this as an absolute rule [Meyer]. I'm not 100 percent pure on this (as on anything), but I try to follow it most of the time, and it has served me well. ”
  8. 8.  Create a parameter for methods that do similar things and replace them with a new method with that parameter.
  9. 9.  When you are using methods that do something in base a parameter. You should create other methods that do what you want, just to avoid the conditional.
  10. 10.  You can send an object as a parameter when you need different information from the same object.
  11. 11.  Remove all methods that only affect one field and that do this just one time.
  12. 12.  A method is not used by any other class.

×