Practices
  Home arrow Practices arrow Page 3 - Developing an Object Oriented Credit C...
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Mobile Linux 
App Generation ROI 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PRACTICES

Developing an Object Oriented Credit Card Transaction Processor
By: David Fells
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 24
    2004-09-21

    Table of Contents:
  • Developing an Object Oriented Credit Card Transaction Processor
  • Principles
  • Approaching the Problem
  • Digging In
  • Factory Work
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Developing an Object Oriented Credit Card Transaction Processor - Approaching the Problem


    (Page 3 of 6 )

    A key concept that you will see me use again and again is that the client should not know about implementation. What does that mean? For example, let's define the following class:

    public class EFTProcessor {
     CCPaymentService();
     
    public:
     bool Execute();

    private:
     EFT* SendTransaction(EFT*);
     string _paymentMethod;
     string _merchantService;
    }

    What we have defined is a class with one public method: Execute(). It has a private method called SendTransaction that Execute will call. It requires some values, _paymentMethod and _merchantService, that could be passed into the constructor or perhaps they were a component of our EFT datatype (which we have not yet defined). The point to this example is this: no matter what we do with SendTransaction and the EFT data type, the client can always call EFTProcessor::Execute and always get a boolean response indicating success or failure. Do not get too attached to this class, as it is only an example and will not be seen again.

    The concept illustrated in the class example that we just looked at leads us to the next big concept that you will see me use: Design to an Interface, not an Implementation. This is a big one. It says that we should approach our design from the standpoint of how our objects interact, and more importantly, how our client will use them, rather than from the standpoint of how to write a specific routine. Approaching design in this fashion should lead to Loose Coupling of our design and implementation, meaning that the way in which our client interacts with our objects should be able to vary independently of how our objects complete the tasks that the client requests. Those of you who are familiar with Object Oriented Programming techniques understand that one of the purposes of this type of design, from a coding standpoint, is to facilitate polymorphism, meaning it facilitates replacing objects of one type with objects of another type transparently to the other objects that are interacting with it.

    More Practices Articles
    More By David Fells


     

       

    PRACTICES ARTICLES

    - More Techniques for Finding Things
    - Finding Things
    - Finishing the System`s Outlines
    - The System in So Many Words
    - Basic Data Types and Calculations
    - What`s the Address? Pointers
    - Design with ArgoUML
    - Pragmatic Guidelines: Diagrams That Work
    - Five-Step UML: OOAD for Short Attention Span...
    - Five-Step UML: OOAD for Short Attention Span...
    - Introducing UML: Object-Oriented Analysis an...
    - Class and Object Diagrams
    - Class Relationships
    - Classes
    - Basic Ideas

     
    Application Delivery: Everything You Wanted to Know, but Didn`t Know You Needed to Ask
    A comprehensive guide to examining the topics of Wide-area Data Services and app....

     
    Best Practices: Safe and Secure Hardware Asset Recovery
    Companies increasingly must meet EPA and local requirements for the disposal of ....

     
    Managing SSL Security in Multi-Server Environments
    Read this white paper to learn how to simplify management of your organization's....

     
    Open Source Security Myths
    Open Source Software (OSS) is computer software whose source code is available t....

     
    Power and Cooling Capacity Management for Data Centers
    This paper describes the principles for achieving power and cooling capacity man....

     




    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
    Stay green...Green IT