0
Answered

What is my pattern ?

David Lewin il y a 5 ans mis à jour par anonymous il y a 4 ans 8

Hi everyone, 

Just finished this book along the Python examples. Was great. 

However, I'm not sure what pattern is correct for my project: 

  • the goal of this project is to produce different pdf from the same data
  • data for all document is centralized in a DB
  • According to parameters given at start, the data is read

Due to end of session the post is incomplete : 

Hi everyone,

Just finished this book along the Python examples. Was great.

However, I'm not sure what pattern is correct for my project:

  • the goal of this project is to produce different pdf from the same data
  • data for all document is centralized in a DB
  • At first data are provided by a web form to fill in a db
  • According to parameters given as inputs, the end product is a document which type relies on the inputs
  • the types of docs may of course vary to a simple page doc, to multiple pages, fantasy colors doc, sober, etc

Here is a picture of the whole process.

So my question is what is the most appropriate design to implement the db to docs process while I found many of patterns could apply ?

Thanks

David

Under review

Hi David!


But what do you think?

Well there are many possibilities like template, Factory and Bridge

Do you have to apply any patterns at all? Or is it some kind of test that you're taking?

What do you mean ? I'm not sure to understand "do you have" ?

I mean why do you NEED to use a pattern at all? Implement the code without a pattern and then see whether applying a pattern would improve your code. This is the approach I usually take in real-life coding.

I ended up using the Strategy pattern in a similar situation.