I was hired 3 weeks ago because of my gained experience in developing webapps. Team members and all of the colleagues are very kind and friendly. During this short period of time they let me implement a couple of features on my own.

So here is the thing: we are working with an unmaintained framework (zend 1). The code is kind of legacy due to "organic growth", there are static function calls all over the system. So I started to implement the features with a basic set of design patterns (DI, Facades), strict comparisons and null avoidance like this:

// customer repository
public function getById(int $id): Customer
    $customer = $this->findOneById($id);

    if ($customer instanceof Customer === false) {
         return new Customer; // or via factory call

    return $customer;

Aside from the object creation, there were discussions about the instanceof check, that a simple !$customer would be enough in 99% of its cases. Furthermore they remove encapsulated code and merge together a factory and sending a mail into one single function. Maybe I've learned it all wrong, but IMHO this is a SOLID violation.

They hired me for my "expertise" but if I can't implement such architecture, how else shall I leave a better codebase than I've found?

  • 2
    I've put what I think is your issue into the title but I think you might want to edit your question to be more friendly to the users who aren't programmers. I don't think a non-programmer is going to understand why this is different from personal preference, like choosing cat for a mascot instead of a dog.
    – BSMP
    May 19, 2020 at 22:41
  • In languages with a focus on polymorphism instanceof is generally not considered a good practice and frowned upon. I will say though, my experience with PHP is minimal. If I had to guess, then my thinking is your code will break for classes deriving from Customer, like ElevatedCustomer with your instanceof check. There is a large variety of paradigms out there, your colleagues might deliver worse code than you do or maybe you don't realize where you are going wrong yourself - hard to tell from what I have read. Is it not possible to communicate with colleagues about paradigms? May 20, 2020 at 19:32

1 Answer 1


Many employers and developers feel that the concept of "best practice" is at odds with what is most productive. I've worked for employers that actively discourage best practice, preferring quick fixes over preventing technical debt; and I've worked for employers that are sticklers to the point of having code commits rejected if you accidentally miss a space between your parenthesis and your opening curly brace in a function declaration.

Generally speaking I've found the best course of action is to hold myself to the highest standard between my own personal standards, and the accepted standards of wherever I happen to be working.

If my standards happen to be lower then it can be annoying; but sometimes I've come to appreciate why it was wanted that way and I feel I've grown as a developer.

If my standards are higher, then for my own personal work nothing changes - I'm at my most efficient when working to my own standards. Sometimes however I've managed to convince other people why duplicating a utility function between two classes instead of abstracting it out is actually a really bad idea.

Source: I've been a developer for the past 10+ years.

  • Thank you for sharing your experience. So to sum it up in my own words: you would just give it a chill and continue with your standards if they are higher?
    – Sauerbrei
    May 19, 2020 at 21:27
  • @corax228 Pretty much.
    – Scoots
    May 19, 2020 at 21:55
  • Yup. Otherwise you may be missing priorities. Maybe there are deadlines you can't hit if you do it properly. Or in my case I rewrote a bunch of code spontaneously only to learn that the app I was assigned to was a mockup, just intended to demo once or twice. It was already functional. Of course, there may be times when the people in charge are but aware of the compromises they're making and you can report on it. But if they're aware and choosing not to, tough cookies, frustrating though it is! May 20, 2020 at 2:55
  • I’d say “is at odds with what is most productive In the short term”.
    – gnasher729
    May 20, 2020 at 9:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .