Revenue Source

Welcome to the Revenue Source affiliate marketing forums.

You are viewing our internet marketing and SEO forums as a guest which gives you limited access to most of our discussions.  By joining our free community, you will have access to post affiliate marketing topics, communicate privately with other members (PM), exchange SEO strategies, and access many other special features.  Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems, please don't hesitate to contact us.

Go Back   Revenue Source > Site Design & Development > Programming Help
Reload this Page PHP-Coding-Practices.com: Composing Methods: Replace Temp With Query
Tags: , , , ,

Reply
 
LinkBack Thread Tools Search this Thread
Old
  (#1 (permalink))
Affiliate Blogs is Offline
Revenue Source Veteran
Affiliate Blogs has a brilliant future here!
 
Affiliate Blogs's Avatar
 
Join Date: Oct 2005
Posts: 9,223
Jack of All Trades
CyberSpace United States
   
PHP-Coding-Practices.com: Composing Methods: Replace Temp With Query - 06-14-2007

In a new article from PHP-Coding-Practices.com today, Tim Koschuetzki offers a different sort of solution for working with those little temporary variables scattered throughout your code - replacing a temporary variable with a queryable structure.
When you are using a temporary variable to hold the result of an expression, extract the expression into a method. Then replace all references to the temp with the new method. The new method can then be used in other methods.
His suggestion basically replaces the quick temp variable with something slightly more complex but something that can be used anywhere in the class. He uses the example of multiplying an amount times the quantity - first just assigned to a temporary variable inside a method then refactored as the result of another method returning the same thing (but accessible from anywhere).


PHP-Coding-Practices.com: Composing Methods: Replace Temp With Query - Read More...
  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads for: PHP-Coding-Practices.com: Composing Methods: Replace Temp With Query
Thread Thread Starter Forum Replies Last Post
PHP-Coding-Practices.com: Introduction To Security Vulnerabilities In PHP Affiliate Blogs Programming Help 0 06-13-2007 01:58 PM
PHP-Coding-Practices.com: How I Turned A Slow Array Sort Into A Quick One Using Quick Affiliate Blogs Programming Help 0 06-08-2007 04:29 PM
PHP-Coding-Practices.com: How To Generate Monochromatic CSS Stylesheets Within Second Affiliate Blogs Programming Help 0 06-07-2007 02:00 PM
PHP-Coding-Practices.com: Control Your CSS Via PHP - Good Stuff! Affiliate Blogs Programming Help 0 05-24-2007 02:51 PM
PHP-Coding-Practices.com: PHP Code-Beautifier Tool Affiliate Blogs Programming Help 0 05-04-2007 12:55 PM



© 2004-6 RevenueSource.com.  All rights reserved.  Do not duplicate or redistribute in any form.
This website and its logos/design are property of RevenueSource.com.  All rights reserved. vBSEO 3.2.0 RC7


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34