288 reputation
1210
bio website mnapoli.fr
location
age
visits member for 4 years, 1 month
seen Oct 14 at 1:55

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
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?
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)
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
8
comment Alternative to “Passing/Broken build” indicator?
Simply tracking the number of failing tests is insufficient that's not the only possible metric. For example: Branch-A improves it to 40 tests (80% passing) with no regression. No regression means previously passing tests always pass. In short, a test would be allowed to fail as long as it has never passed. It seems to me that we are missing on good things by constraining to forbid failing tests in main branches. (of course it would require tools working differently: unit tests, CI, ...)
Feb
8
comment Alternative to “Passing/Broken build” indicator?
@MadKeithV Exactly
Feb
8
comment Alternative to “Passing/Broken build” indicator?
the build would always have failing tests precisely! But is that such a bad thing? Our only metric is "the build is broken or not", but your code could be full of known bugs, so that doesn't really mean anything except there is no regression. In a perfect world, every tracker issue would have a test (reproducing is easier than fixing). So the upside would be to see that 35 tests/70% of all the tests are passing, that Branch-A improves it to 40 tests (80%) with no regression, and that Branch-B has regressions. Today you could only say Master and Branch-A are OK and Branch-B is broken.
Feb
8
comment Alternative to “Passing/Broken build” indicator?
Indeed you make a point with topic branches. But I'm never talking about commiting broken code, just failing tests. For example I could help an open source project by creating tests for incoming tickets even if I don't know how to fix them. That saves a some time for the maintainers.
Feb
8
comment Alternative to “Passing/Broken build” indicator?
@JoachimSauer Yes but is such metric standardized/used in any major project? I'm trying to understand why most of the projects (and CI tools) work that way.
Dec
24
comment Presentation VS Application layer in DDD
Thank you, indeed you made me realize that for my case separating Application and Presentation is useless. Simplicity first!