It depends on how they force you.
In my experience,there are two possibilities:
You feel forced by a tight schedule, legacy code, etc.
In this case, as most of the other answers already say, it's up to you to 'optimize for coolness'. You may not have the time to rewrite the codebase to MVC, but as first step, for example, you can stop glueing your SQL by hand and instead write a nice execute_sql($query, $params)
, that lays the foundation for abstractions like fetch_customer($filter_params)
, etc. Remember, all the best practices are ultimately there that your boss gets a product earlier, so there is only a conflict in how much time to invest in the future vs in the now.
When you set the right context ('within 6 month, without getting extra time, i refactored the monolithic code to MVC') you should leave your name on the code, and try to be proud like a therapist, that teaches a stroke victim to say single words again.
You are explicitly ordered to implement it a way you deem unfit
The try to separate view from model does not survive the review, because 'it is too complicated, why dont you just do plain sql queries?'. Your execute_sql
gets canned because 'a coder with discipline does not need that'.
This case sucks bad. In my experience, it usually comes with micromanagement and teamleaders who got promoted there for political reasons, not for their successes. The real problem is, that you are put in charge of something (the code) that you can't control (you have to do it their way).
The best solution would be to solve the root cause (i.e, that you are treated as a grunt). The second best (and in my experience, the usual) solution is to quit.
The upside is, that in this scenario, your name isnt likely to get published anyway, because the team leader takes the credit for all success.