12

My boss introduced a new design pattern at work. I couldn't find this design pattern anywhere else, and I don't find it useful at all. I'm the only one using it, but my coworkers seem confused by it as well when they look at my code or have my boss explain the pattern to them. I have serious concerns about this design pattern making our code difficult to maintain. I have a solution to the same problem that I think is much simpler, but I don't know how to start the conversation about it with my boss.

I've completed each task she's assigned me to do with this pattern for about a month, and she has explained the pattern to me several times. I still think there's a significantly better way to do things.

I don't want to work with this design pattern again, so what can I do?

michaelsnowden
  • 321
  • 1
  • 2
  • 9
  • 3
  • What's the pattern? (The fact that you haven't encountered it doesn't mean it's invalid.) 2) Who's the architect for your portion of the code? 3) did the architect select this pattern? If so, ask them why. If not, ask them whether it makes sense in the larger context of the code. If it does, learn to like it, or at least tolerate it. If it doesn't, they're in a better position to recommend alternatives than you are.
  • – keshlam Jul 29 '15 at 02:19
  • @keshlam
    1. The same form has a lot of different access points on our site. We use the page object pattern to test these forms.

    The pattern is called "Bridge", but it is completely different than the Bridge pattern you'll find from a Google search. The pattern is this: have several constructors in the bridge class, which make it easy to reach the form from different access points. The bridge class will create the form page object, and it also gives you access to it.

    – michaelsnowden Jul 29 '15 at 02:31
  • @keshlam 1 continued) The problem is that this causes a lot of middleman code when we want to use the form because we have to rewrite each method from the form in the bridge class. In my opinion, it would be much easier to have a form factory, and then we wouldn't have any middleman code, but we could still reach the form from any access point. 2 and 3) There is no architect--it's just my boss. – michaelsnowden Jul 29 '15 at 02:32
  • 1
    Sounds like a sort of factory pattern - take a look at "abstract factory". Interface your factories and then you can add / remove different factories to create your concrete object(s) in different ways. – James Jul 29 '15 at 11:53
  • 1
    TELL HIM TO CODE IT HIMSELF (or not, if you wanna keep your job) – SE13013 Aug 18 '15 at 18:40
  • Sounds like the version your boss suggests would allow for easier mocking of external dependencies of the page (at the expense of extreme verbosity). – pmf Apr 28 '17 at 10:21