0

I have joined a team working on a large and mature responsive website (using a javascript MVC framework), and one thing I frequently see in the codebase is branching code in controllers or components checking whether we are in Desktop mode or mobile mode before doing some action. In some ways it feels like two separate apps that have been forced together. Is this a real anti-pattern, or am I off-base?

  • It sounds like it could be an anti-pattern, only because I would think things like that should e handled in CSS and not in JS. What is it the app is doing where it needs to check screen size/orientation in JS? Can that not be handled by CSS media queries? – neilsimp1 Oct 31 '18 at 12:10
  • All sorts of random stuff, like dealing with menu states, tooltips, etc. There is a decent amount of functionality that is irrelevant for the mobile state, and sometimes the desktop state. – AlexMA Oct 31 '18 at 12:29
  • The only thing that might be an anti-pattern here is that you're not taking full advantage of the heavy lifting that responsive design software libraries can provide. – Robert Harvey Oct 31 '18 at 20:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.