Decorator And Strategy Patterns Case Study

Superior Essays
Aritra Chatterjee
Assignment #9 – Design patterns
Date: Nov. 11, 2017 Compare and contrast the use of Decorator and
Strategy patterns in two practical scenarios
Introduction
Decorator pattern – “Attach additional responsibilities to an object dynamically. Decorators provide a flexible alternative to subclassing for extending functionality” [1]. Decorators are transparent to the component they are decorating, that is, they allow augmenting the existing functionality of a component at runtime, without necessarily letting the component know of its decorators. Decorators must conform to the interface of the component that they intend to decorate. Strategy pattern – “Define a family of algorithms, encapsulate each one, and make them
…show more content…
There are no restrictions on the interface of a strategy.
In this paper, two practical scenarios will be discussed, with each focusing on the strengths and weaknesses of the design patterns above.

Scenario – Analytics on streaming data
Problem Statement
An application needs to perform risk analysis on streaming credit card data. Some of the analyses are implemented in-house, while others are implemented at the client site based on specific client needs. In-house analytics include vendor patented outlier detection and anomaly detection algorithms. Client site implementations involve a large set of compliance rules. The in-house analytics is obfuscated and packaged into archives, with only abstract classes available for extensions. The client implementation team can use these abstract classes to provide extensions, but they are not allowed to modify the packaged archives in any way. On running a single credit card transaction through these various analytic components, a unified risk score is generated for

1

Aritra Chatterjee
Assignment #9 – Design patterns
Date: Nov. 11, 2017 that transaction. Also, a break-up of the scores contributed by individual components needs to
…show more content…
11, 2017 Scenario – PDF parsers
An application needs to be developed for parsing PDFs, and potentially performing optical character recognition (OCR) in case of non-searchable PDFs. For searchable PDFs, an open source tool called Apache PDFBox is available, while for non-searchable PDFs, depending on quality requirements, OCR needs to be performed by going to a paid Google Vision API or using open-source tools like Tesseract. A strategy pattern based solution

Figure 3 - Strategy pattern based parser
The application provides a PdfProcessor class that decides at runtime about the necessary characteristics of the PDF document, and accordingly allows for choosing a strategy implementation. At a time, only one parser strategy can be used. The policy for choosing a parser does not overlap in terms of functionality with one another. For example, if a PDF contains searchable content, PDFBox is used, which is open-source and comes at no cost to the client. If the PDF source is reliable, and comes from a high-quality image provider, Tesseract is used, as it’s again open-source, and provides pretty good results with good quality images. Only for

5

Aritra Chatterjee
Assignment #9 – Design

Related Documents

  • Improved Essays

    Blood Stained Tee Shirt Collection of item: I would wear disposable latex gloves to packaged the blood stained tee shirt into a plastic or airtight container. I would store it in a cool location until it was delivered to the laboratory. Processing of item: 2. Handprint on car Collection of item: I would apply powder to the location of the handprint and then I would lift it with a broad piece of adhesive tape.…

    • 746 Words
    • 3 Pages
    Improved Essays
  • Decent Essays

    We implemented the proposed algorithm in HM15.0 [4] of H.265/HEVC reference software and compared it with TZ Search in terms of computations (search speed measured by total encoding time and ME time) and performance (PSNR and bit rate). Average Speedup is defined as the ratio of the time of TZ search algorithm to the proposed algorithm. Test conditions [8] for simulation are as follows: 1. Four different quantization parameters (QP=22, 27, 32, 37) to test the algorithm at different bit rates. 2.…

    • 279 Words
    • 2 Pages
    Decent Essays
  • Decent Essays

    Nt1310 Unit 6

    • 910 Words
    • 4 Pages

    2.2.2 Empathy Summary Canvas It consists of five key parts: 1. First part is for user. In this section, we need to specify about the main user of the utility. The main user of this utility is the Administrator only. 2.…

    • 910 Words
    • 4 Pages
    Decent Essays
  • Decent Essays

    At Wiltshire + Swain the staff rely heavily on a range of computers with specific software to produce their innovative designs shown below in figure 4. Currently record keeping could be improved with the use of modern software systems at Wiltshire + Swain. With the improvement of mobile technology, client and staff management has become easier as they can be in contact at all times. Drawings and designs can be emailed electronically to clients (potentially interstate clients) via the Internet. Efforts are being made by Wiltshire + Swain to reduce printed documents of drawings and records by holding them electronically on the server.…

    • 235 Words
    • 1 Pages
    Decent Essays
  • Decent Essays

    Pt1420 Unit 1

    • 568 Words
    • 3 Pages

    Database Unit 1 was quite fair I have a few friends who are doing database. So they have been asking me if I have started doing database as yet since my first course. I only started studying for Databases two days before the start of the Term. I am normally a week ahead but this time when I finished Term 1 I was exhausted and burnt out so I took a break and only started preparing two days before the start of the Term.…

    • 568 Words
    • 3 Pages
    Decent Essays
  • Improved Essays

    3 Week Diet Review Essay

    • 578 Words
    • 3 Pages

    5. Five useful and powerful methods used by the 3 Week Diet to burn the obstinate fat The 3 Week Diet created by the personal trainer and nutritionist, Brian Flat is considered a revolutionary and multipurpose weight loss weight loss program, as it assists people in attaining their weight loss goals as well as within a short time of 21 days. In his creation, the author asserts that users may get several health benefits, including:  Reduced cellulite.  Quicker metabolism.…

    • 578 Words
    • 3 Pages
    Improved Essays
  • Improved Essays

    Name: Prior to Monday, 9/21/2015, students should read the “Study Guide to Effectively Using Integrating Concepts in Biology (ICB)”, an introductory resource for this year’s electronic textbook, and answer the following discussion questions. Responses should be uploaded to Canvas by 11:59PM on 9/20/15. A PDF version of this guide is posted to Canvas, and can also be found in the e-text. 1.…

    • 886 Words
    • 4 Pages
    Improved Essays
  • Great Essays

    This suite incorporates an extensive variety of standard reports that let individuals examine exchanges each day, week, or month and contrast the outcomes with various parts of the nation, different parts of the world, or predefined gatherings of comparable banks. Discussion Points a. MasterCard administrators are propelled to expand (1) the quantity of people who have and utilize a MasterCard charge card, (2) the quantity of banks and different customers who issue these Cards to clients and additionally workers, and (3) the quantity of areas that acknowledge MasterCard installments. Examine how MasterCard could utilize its information stockroom to enable it to extend each of these client bases. b. MasterCard makes its examination tools accessible to the majority of its associated banks and different backers. It realizes that getting its customers to utilize these instruments can be basic to keeping them as steadfast clients.…

    • 933 Words
    • 4 Pages
    Great Essays
  • Decent Essays

    | | | | |Analyze the organizational management, administration, and operational aspects of policing. | | | | |Examine perspectives of the policing function from the local, state, and federal | | | | |organizational levels. | |…

    • 2597 Words
    • 11 Pages
    Decent Essays
  • Great Essays

    Data-centric and process-centric integration are both parts of the integrated structure that Carrier has defined. He defined in 1999 that data-centric is the automation and integration of data, and those data can be exchanged between the information system. Process-centric, on the other hand, is more of involving data and applications together at all levels. Linthicum, Morgenthal and La Forge believes that process-centric integration is the highest level of integration for the business. They are two different integration and organizations can choose what kind of integration structure to use based on what the goal of the organization is since there are pros and cons to both of the integration.…

    • 1110 Words
    • 5 Pages
    Great Essays
  • Improved Essays

    • Unity and Variety: I. Unity refers to the idea of working together. II. Variety refers to a difference in everything. There isn’t one thing alike. D. STRUCTURAL SYSTEMS IN ARCHITECTURE I.…

    • 928 Words
    • 4 Pages
    Improved Essays
  • Improved Essays

    With ________ as a target market strategy, the firm concentrates on serving many needs of a particular customer group. • single-segment concentration • product specialization • market specialization • selective specialization 12. Company X's principal strength is its inbound and outbound logistics system; its relative weakness, however, is after-sales service. Its competitor, Company Y, however is often plagued with lagging shipments and an inflexible distribution setup. Company Y remains successful because it maintains a fully staffed service department and, as a result, the company is known for its dependable service.…

    • 1398 Words
    • 6 Pages
    Improved Essays
  • Improved Essays

    In Steven Pinker’s Language Instinct chapter 7 “Talking Heads”, he explains the difference between human language acquisition and the ability for computers to perform the same. In the past, many people feared that computers would end up conquering humans due to the development of “artificial intelligence” in the 1950s. Research has debunked this myth with the simple fact that for computers “the hard problems are easy and the easy problems are hard” (191). For example, a simple question like “Do zebras wear underwear?” can confuse the computer.…

    • 668 Words
    • 3 Pages
    Improved Essays
  • Improved Essays

    The following are the 8 code of ethics for interpreters: - 1- Accuracy and Fidelity: The core aim of this ethical principle is to preserve the meaning of all messages while performing an interpreting session. The interpreters have to deliver all messages in the target language with taking in consideration not to add, distort, and omit the meaning of the delivered messages.…

    • 1127 Words
    • 5 Pages
    Improved Essays
  • Great Essays

    Trans-Shipment Container Management in the Port of Piraeus Theodoros Koromilas ABSTRACT As a mainly trans-shipment container port, the container terminal of the port of Piraeus has as a primary goal to provide equipment and facilities to deliver efficient and professional service. The commercial port of Piraeus consists of three (3) container terminals, of which one (1), Terminal I, is being operated Piraeus Port Authority S.A. (P.P.A) and two (2), Terminal II and III by the Piraeus Container Terminal S.A. (P.C.T.), which is a subsidiary of COSCO Pacific. Head offices are located behind their terminals for each organization.…

    • 1356 Words
    • 6 Pages
    Great Essays