+ All Categories
Home > Documents > CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHost Design patterns John Lin.

Date post: 17-Jan-2016
Category:
Upload: brent-richard
View: 215 times
Download: 0 times
Share this document with a friend
Popular Tags:
11
CreditCardManagementH CreditCardManagementH ost ost Design patterns Design patterns John Lin John Lin
Transcript
Page 1: CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHostCreditCardManagementHostDesign patternsDesign patterns

John LinJohn Lin

Page 2: CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHostCreditCardManagementHost

Java based – run on any Java enabled Java based – run on any Java enabled systemssystems

Standalone application Standalone application Potential to port to the webPotential to port to the web Very flexible and easily extendedVery flexible and easily extended Who is it for? anyone who uses and keep Who is it for? anyone who uses and keep

tracks of their credit cards tracks of their credit cards

Page 3: CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHostCreditCardManagementHost

On average, people carry at least three credit On average, people carry at least three credit cards: Discover, AMEX, Visa/Mastercards: Discover, AMEX, Visa/Master

Credit cards offer various incentives: cash Credit cards offer various incentives: cash rebates, discounts, travel vouchers, 0% APRrebates, discounts, travel vouchers, 0% APR

Credit cards all have different due datesCredit cards all have different due dates In a lifetime, a person may own at least 10 In a lifetime, a person may own at least 10

different cards – how to manage them?different cards – how to manage them? Credit Card Management tool! Credit Card Management tool! Not a redesign, new application from scratch Not a redesign, new application from scratch

with flexibility, reusability, and extensibility in with flexibility, reusability, and extensibility in mind mind

Page 4: CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHostCreditCardManagementHost

Provides easier, more efficient administration and management of Provides easier, more efficient administration and management of one or more credit cards belonging to one personone or more credit cards belonging to one person

Users can keep track of their monthly payments online, and avoid Users can keep track of their monthly payments online, and avoid missed or redundant paymentsmissed or redundant payments

Users can keep track of their 0% balance transfers and the 0% Users can keep track of their 0% balance transfers and the 0% expiration date. After that date, the transferred amount will be expiration date. After that date, the transferred amount will be incurring high interestsincurring high interests

Users can keep track of their rewards, how many points or cash Users can keep track of their rewards, how many points or cash they have accumulated and usedthey have accumulated and used

Statistical credit card usage analysis can also be performedStatistical credit card usage analysis can also be performed Reminders/alerts and notes can be attached anywhereReminders/alerts and notes can be attached anywhere

Page 5: CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHostCreditCardManagementHost

CreditCardMangementHost is a host with a list of services/plug-ins, CreditCardMangementHost is a host with a list of services/plug-ins, like the ones described. This list of services can be extended like the ones described. This list of services can be extended indefinitely, thanks to decoratorsindefinitely, thanks to decorators

Parent may have access to a child’s card, but not vice versa. Parent may have access to a child’s card, but not vice versa. Similarly, people may have different access rights to services. Similarly, people may have different access rights to services. Different proxies to that person for that card solve it all!! No matter Different proxies to that person for that card solve it all!! No matter how many different roles.how many different roles.

Credit cards offers competitive incentives continuously, offering all Credit cards offers competitive incentives continuously, offering all sorts of rewards – how to keep track of all these differences sorts of rewards – how to keep track of all these differences CONTINUOUSLY? Composites of category and subcategory rids allCONTINUOUSLY? Composites of category and subcategory rids all

Any kinds of analysis can be added with only a new command!! Any kinds of analysis can be added with only a new command!! Extensibility or what? Extensibility or what?

Patterns usedPatterns used: composite, state, decorator, façade, bridge, iterator, : composite, state, decorator, façade, bridge, iterator, visitors, command, proxy, observer, mediator, factory, abstract visitors, command, proxy, observer, mediator, factory, abstract factory, singleton, prototype, strategy, builder, template, chains of factory, singleton, prototype, strategy, builder, template, chains of responsibilities, and security patternsresponsibilities, and security patterns

Page 6: CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHostCreditCardManagementHostUtilizing mvc: blue: model, yellow: view, green: controller, violate: java packages

CreditCardManagementHost

CreditCards Registry

Services (plug-ins) registry

paymentsTrak

balanceTransferTrak

Plug-ins …

rewardsTrak

Gui

user

Track Card

Rewards

Pay Credit Card

Track Balance Transfer

MoreServices

Overview: host with extendable services

Page 7: CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHostCreditCardManagementHost

State: there are four states for a credit card when a payment is made. NoPaymentDue, Unpaid, PartiallyPaid, and FullyPaid-in that order. Here, the amount paid and the balance due is passed to a state, then each state will verify itself until the right conditions are met. That will be the payment status!

Command and Visitor combination: a command that takes a visitor as the receiver. When execute is called, the visitor will do its thing by visiting the iteratee and perform needed functions. The strategy of the visitors may vary, depending on the needs; very reusable.The Command is send through an internal iterator. Ifanother action is needed, just send in a new command!

Page 8: CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHostCreditCardManagementHost

[right] Bridge: ContentHolder is a all purpose data holder. Any collection types can be substituted at later time, without changing much of the code! ContentHolder has a createIterator, which is part of the iterator pattern.Iterator: this iterator extends java.util.iterator, which means any of the java collections can be iterated, including any of the collection in ContentHolder.

CompositeIterator: iterator for the composites NullIterator: iterator for the leaf in the composite pattern

BottomLine: Bridge and Iterator combined, one can change any underlying storage schemes and to iterate them without much change!!

Page 9: CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHostCreditCardManagementHosto Abstract factory: cardFactory, which manufactures CredittCardFactory, and potential factories for other cards in the future. o Factory: CreditCardFactory that clones a product: creditCard. Potentially, expanding the product line to other credit cards of other countries.o Singleton: both factory and abstract factories are singletons! Only one instance is needed to be resource efficient.o Prototype: products from factories are not created anew, but cloned!! All products implements Prototype.

o Pros: more product can be added later, all I need to do is ask the one and only factory for it! Resource efficient! If the product is complex to setup, the the factory just create it once and use it everywhere! With cloning!!

Page 10: CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHostCreditCardManagementHost

Decorators: all services decorates core service, a limitless number of services can be provided later on that further decorates. All decorators implements an abstract method: updateAmount, which allows each service to do its servicing recursively!!

Template and Façade Combined:A façade facilitates communication Between the model and controller.The template method in this façademake sure that certain events happen before everything else: likeactivate stored data prior to addingnewer ones

Page 11: CreditCardManagementHost Design patterns John Lin.

CreditCardManagementHostCreditCardManagementHost Experiences with design patternsExperiences with design patterns::

Design phaseDesign phase Much longer to design than without using patternsMuch longer to design than without using patterns Every situation has one best-fit pattern, Every situation has one best-fit pattern,

customizations of patterns may occurcustomizations of patterns may occur Helps to focus on the relationship between entities, Helps to focus on the relationship between entities,

rather than implementation-feasibilityrather than implementation-feasibility Hard to translate patterns into UML, sometimesHard to translate patterns into UML, sometimes

Implementation phaseImplementation phase For some patterns, many more classes are For some patterns, many more classes are

needed; explosion of classesneeded; explosion of classes Can be tedious at times, requires a lot more Can be tedious at times, requires a lot more

visualizationvisualization


Recommended