mardi 2 mars 2021

Can someone please answer the given scenarios? I've been trying to understand but got completely stuck

Consider each of the scenarios below and identify the design pattern which is most directly addresses the problem described. Briefly explain your reasoning.

You’ve developed a new implementation of the List interface and you’d like to test the behavior of your new data structure. You’ve written an algorithm to perform your speed tests, but the algorithm needs to make a great many instances of your list class. You want to test the performance of your list against the performance of ArrayList and LinkedList, but you don’t want to have to write your algorithm three times in order for it to be able to create the right kind of list to test.

You’ve completed a compiler for a new language! There are many parts to your compilation process: parsing, transformation, assembly code generation, and so forth. You’d like to allow other programmers to use an interface to compile their code without resorting to system calls or other command-line invocations – your compiler can just run in their processes – but you don’t want those users to have to know how to bring all of the steps of compilation together in order to use your compiler.

Aucun commentaire:

Enregistrer un commentaire