283 reputation
128
bio website mnapoli.fr
location
age
visits member for 3 years, 10 months
seen Jun 19 at 19:29

I'm a software engineer passionate about coding, web development and applications architecture.

You can read more about me on my own website or on my stackoverflow professional profile.

Here are some projects I'm working on:

@matthieunapoli


Jun
19
accepted What is the name of this design pattern?
Jun
19
comment What is the name of this design pattern?
@JeffO I meant "you are welcome to speak" like "you are welcome to tell me", not in an aggressive way. And I want to have the name so that I can look up if it's not an anti-pattern, or if I'm doing it correctly, or if there's not a better alternative. Imagine I was doing some sort of home-made "Singleton" pattern, it would be interesting to know right (for all the reasons I've listed)?
Jun
18
comment What is the name of this design pattern?
@JeffO I admit it might not show but I've been looking for an answer for at least a year. I have read all the most common design pattern I could find and I still can't find an answer. Now if one of them is obvious to you, you are welcome to speak.
Jun
18
comment What is the name of this design pattern?
Sure I appreciate all that :) I remember being told that "getClass" is bad, but then you eventually make up your own mind on the use case as you said.
Jun
18
comment What is the name of this design pattern?
Yeah I want to leave the possibility open for other implementations, so that users (of the library) can both add new objects and their formatters.
Jun
18
comment What is the name of this design pattern?
Yes I thought about the strategy pattern at first too, but usually in that pattern there is only 1 strategy chosen at runtime, whereas here there are several and a "switch" is made based on the object type.
Jun
18
comment What is the name of this design pattern?
You are right, Dispatch is enough for the code :)
Jun
18
comment What is the name of this design pattern?
Now that you mention it I remember how in Java instanceof and the likes are considered anti-pattern. But honestly I don't see how to do differently. Method overloading would mean putting format() in the objects themselves, which is bad for separation of concern. You said hide the map of type formatters in a Factory class but in the end it's just the same (it's just "hidden" in a factory ;). And to use Decorators, I would also have to use some kind of instanceof or switch o.getClass() somewhere anyway when decorating the objects (based on their classes).
Jun
18
comment What is the name of this design pattern?
That's very interesting. Would Double Dispatch be even closer?
Jun
18
comment What is the name of this design pattern?
OK try to see past the simplistic example. Of course toString() would be better here but it's just an example. And my objects don't implement Formatter (or a format() method) directly because I want separation of concern. In my example, I want formatting the variable to be separate from the variable itself.
Jun
18
comment What is the name of this design pattern?
Close-votes: please explain how it is opinion based? I am asking for the name of this design pattern.
Jun
18
comment What is the name of this design pattern?
@ArnaldoIgnacioGasparVéjar I did a typo in my example, I had the VariableFormatter interface, I changed it to Formatter. Does that answer your question?
Jun
18
revised What is the name of this design pattern?
deleted 8 characters in body
Jun
18
asked What is the name of this design pattern?
Mar
25
comment Is displaying an HTML email a security risk?
Thank you for the answer. I'm surprised it's such a problem, there are so many mail clients how do they all do if that is so complex? And I mean "Safe" like any other webmail (i.e. not necessarily the safest in the world). Phishing/beacons are out of scope (for my question at least), I'm not focusing on privacy or human error-related risks (yet).
Mar
25
comment Is displaying an HTML email a security risk?
@dan1111 Thanks for your comment, but I definitely don't want to go down that path of discussing whether or not I want to do what I want to do :) (I have a bit of experience of stack exchange to know it leads nowhere)
Mar
25
asked Is displaying an HTML email a security risk?
Nov
20
awarded  Famous Question
Feb
11
comment Alternative to “Passing/Broken build” indicator?
@Earlz Exactly! What I'm wondering is "is it done by someone, somewhere? And are there tools that support that (CI and unit testing libraries?" Because if I just categorized those tests with classic CI and unit-tests tools, the build will always fail anyway and I won't see a difference between which tests failed, and so it won't be useful :/
Feb
11
awarded  Nice Question