Life at a Japanese PHP Shop



  • Sorry guys, I need to vent. I work at a PHP shop in Tokyo. It's kind of a large company (800 people). All of my coworkers are Japanese save one other foreigner. To give you an idea how fucked up it is, the following is "good" code according to the project leader:

    1. $marble_ids = escaping_sql(implode(',', $marble_ids));
    2.  
    3. $sql = <<<EOF
    4. select
    5.     marble.*,
    6.     translated.name as translated_name,
    7.     translated.category as translated_category
    8. from
    9.     master_marble marble
    10. left join
    11.     master_translation_marble translated ON
    12.         marble.marble_id = translated.marble_id
    13. where
    14.     find_in_set(cast(marble.marble_id as char), :marble_ids)
    15. EOF;

    When I told the PL about the use of IN (...) and PDO, I was strongly reminded that as just a programmer and the youngest in my team, I am to shut up and produce code.

    The colon might make you think we're already using PDO, but it's actually a home-grown abstraction layer written by the PL. "escaping_sql" is a homegrown escape function for MySQL.

    What else is forbidden?
    • Writing base classes and extending classes, because the PL would "have to open too many files." Instead, we are to use Traits for everything, because that is "better and more object-oriented."
    • Describing methods using PHPDoc because to the PL, "English is difficult to read and the code should be self-documenting"
    • Writing test cases, because "if you write code correctly, there is no need to test it more than once in a scrap file."
    • Having a local copy of the database (contains product IDs, etc.; no customer info), because the data is proprietary company information and employees might steal it.
    • Having a central test database. We are to work against the live database
      in read-only mode. Testing write queries is done by asking the DBA to
      run them for us and having him report the results in an Excel file.
    • Using any of the framework (FuelPHP) functions, because they might be
      insecure. Instead, we should re-implement the functions we need. The
      framework essentially became a bloated request router. The reason we use
      FuelPHP is because the PL read about it in a Japanese blog and thought
      it was cool.

     

    Did I mention the PL majored in English Literature? He picked up PHP on the side.

    Sadly I am not making this stuff up.

    Yesterday the PL threw a huge tantrum because the way we western people write code is so different from Japanese code. He essentially insulted us foreigners in front of our coworkers and then praised a Japanese coworker's 2800 line spaghetti code mess (all one file) that provides a key-value store using XML files.

    Earlier this month, when I showed the PL how easy it was to circumvent their homegrown content protection system using Fiddler, I almost got fired. In fact, just by writing the previous sentence, I have now violated a non-disclosure agreement they forced me to sign.

    Are there any sane companies in Japan? Are they hiring?  sigh



  • @fish said:

    I was strongly reminded that as just a programmer and the youngest in my team, I am to shut up and produce code.

    Quite right too. You are not there to turn out high-quality code; you are there to turn out code that conforms to the company's expectations. You have no responsibility for the resulting mess.

    If we all adopted your attitude, maintenance programmers would be out of a job.



  • @fish said:

    to the PL, "English is difficult to read[...]"
     @fish said:
    the PL majored in English Literature

    What.



  • @Medinoc said:

    @fish said:

    to the PL, "English is difficult to read[...]"
     @fish said:
    the PL majored in English Literature

    What.

    I'd guess "Project Lead".

     



  • @Fjp said:

    @fish said:
    I was strongly reminded that as just a programmer and the youngest in my team, I am to shut up and produce code.

    Quite right too. You are not there to turn out high-quality code; you are there to turn out code that conforms to the company's expectations. You have no responsibility for the resulting mess.

    If we all adopted your attitude, maintenance programmers would be out of a job.

     

    Ah, but you're making assumptions. You're assuming this is an established codebase, but it's actually a new project. We started in June and everything so far was written specifically for this project. Even our team consists solely of new-hires who each have 3+ years experience.

    Once the project is coded (waterfall style), it's expected that we will become the maintenance programmers.

     

    Has the profession really turned so bad that people no longer have pride in their code and just write stuff to get their monthly paycheck?

     

     


  • Discourse touched me in a no-no place

    @DaveK said:

    @Medinoc said:

    @fish said:

    to the PL, "English is difficult to read[...]"
     @fish said:
    the PL majored in English Literature

    What.

    I'd guess "Project Lead".

     

    I think Medinoc was querying the dissonance between the two sentences, rather than asking what PL stood for...



  • @fish said:

    Are there any sane companies in Japan?

    You, Sir, is an insensitive log of wood that assumes your way of defining sane is the universal one. In Japan, what you are describing IS THE SANE thing to do. If you don't like it, live with it. If you can't live with it, find another country to work and live in.

    Mit freundliche Gruße,
        Dr. Wolfenstein



  •  Bascially thats Japan and more general Asia. Do what you are told and don't think yourself....just do. The problem is that when no one is in charge nothing will happen. This is an problem in emergency situations and that's pretty much why we got Fukushima accident.



  • @Dr. Wolfenstein said:

    @fish said:

    Are there any sane companies in Japan?

    You, Sir, is an insensitive log of wood that assumes your way of defining sane is the universal one. In Japan, what you are describing IS THE SANE thing to do. If you don't like it, live with it. If you can't live with it, find another country to work and live in.

    Mit freundliche Gruße,
        Dr. Wolfenstein

     

    Best Erstpost ever.

    Except for the grammatical errors: Mit freundlichen Grüßen

    alles Gute zum Neujahr,
        st. Nicholas.

     



  •  Thank you.



  • @fish said:

    @Fjp said:

    @fish said:
    ...just a programmer...

    If we all adopted your attitude, maintenance programmers would be out of a job.

    Has the profession really turned so bad that people no longer have pride in their code and just write stuff to get their monthly paycheck?

    Maybe not the profession. The economy has turned so bad that people are afraid to lose their jobs. That's why people anonymously post these stories. The attempt at a connection is an attempt to evolve the human race, while some greedy turds attempt to stunt it's progress for power and profit.

    It's not about pride. It's about survival. In Fjp's case it's also about sarcasm, but whatever.



  • @fish said:

    Has the profession really turned so bad that people no longer have pride in their code and just write stuff to get their monthly paycheck?
     

    Don't hold up your skull just yet, Hamlet. This has always been the case for most jobs.



  • Well you'd need to major in English Lit to know that English was difficult, right?



  • In their defence, it's hard to stay sane when Godzilla destroys the city every few weeks.



  • @fish said:

    Sorry guys, I need to vent. I work at a PHP shop in Tokyo. It's kind of a large company (800 people). All of my coworkers are Japanese save one other foreigner. To give you an idea how fucked up it is, the following is "good" code according to the project leader:

    1. $marble_ids = escaping_sql(implode(',', $marble_ids));
    2.  
    3. $sql = <<<EOF
    4. select
    5.     marble.*,
    6.     translated.name as translated_name,
    7.     translated.category as translated_category
    8. from
    9.     master_marble marble
    10. left join
    11.     master_translation_marble translated ON
    12.         marble.marble_id = translated.marble_id
    13. where
    14.     find_in_set(cast(marble.marble_id as char), :marble_ids)
    15. EOF;

    When I told the PL about the use of IN (...) and PDO, I was strongly reminded that as just a programmer and the youngest in my team, I am to shut up and produce code.

    The colon might make you think we're already using PDO, but it's actually a home-grown abstraction layer written by the PL. "escaping_sql" is a homegrown escape function for MySQL.

    What else is forbidden?
    • Writing base classes and extending classes, because the PL would "have to open too many files." Instead, we are to use Traits for everything, because that is "better and more object-oriented."
    • Describing methods using PHPDoc because to the PL, "English is difficult to read and the code should be self-documenting"
    • Writing test cases, because "if you write code correctly, there is no need to test it more than once in a scrap file."
    • Having a local copy of the database (contains product IDs, etc.; no customer info), because the data is proprietary company information and employees might steal it.
    • Having a central test database. We are to work against the live database
      in read-only mode. Testing write queries is done by asking the DBA to
      run them for us and having him report the results in an Excel file.
    • Using any of the framework (FuelPHP) functions, because they might be
      insecure. Instead, we should re-implement the functions we need. The
      framework essentially became a bloated request router. The reason we use
      FuelPHP is because the PL read about it in a Japanese blog and thought
      it was cool.

     

    Did I mention the PL majored in English Literature? He picked up PHP on the side.

    Sadly I am not making this stuff up.

    Yesterday the PL threw a huge tantrum because the way we western people write code is so different from Japanese code. He essentially insulted us foreigners in front of our coworkers and then praised a Japanese coworker's 2800 line spaghetti code mess (all one file) that provides a key-value store using XML files.

    Earlier this month, when I showed the PL how easy it was to circumvent their homegrown content protection system using Fiddler, I almost got fired. In fact, just by writing the previous sentence, I have now violated a non-disclosure agreement they forced me to sign.

    Are there any sane companies in Japan? Are they hiring?  sigh

    My company also has a policy against production data on workstations. We deal with PHI in the states. So it's a legal thing. If you need real data for testing, we restore a copy of the db for you to a dev server thats all your own. Otherwise its datamasking and data generation tools for the win



  • As an Osaka-based developer I can say that this is basically par for the course. You want to work in Japan? Get used to people less capable than you being right simply because of their seniority.

    As for whether there are any sane companies in Japan, that all depends on two things. Firstly: Are you Japanese? Secondly: Has your spirit been well and truly broken yet?



  •  Welcome in Japan! There is no room for some young unrespectfull guy being a smartass :P.

     Just do your own projects in your own time. Start a company with them and escape the japanese-work-style. Japan has so much great to offer, but the work conditions isn't one of them. 



  • @HAX said:

    but the work conditions isn't one of them. 
     

    Nor living conditions.

     

    Anime, though.



  • That sounds like the stereotype most US developers have of Indian programmers.

    But hey at least you get to work in the most racist and sexist society on Earth that somehow gets a complete pass from the western world for being incredibly racist and sexist! I guess that's a ... perk?



  • Interesting, how did you actually end up there?

    I work for an American company in Japan and they're quite sane. Not hiring right now though.

    The only plus I can see to the Japanese system of seniority is that you can be quite safe in your job as long as you do what you are told. At worst, you'll just have to sit it out until _you_ are the senior. Sadly, as westerner you'll probably always remain a bit of odd guy out, so I'm not certain it'll work that way.

    Lastly, just one thing I wonder about, can't you write PHPDoc comments in Japanese?



  • @fish said:

    What else is forbidden?
    • Having a local copy of the database (contains product IDs, etc.; no customer info), because the data is proprietary company information and employees might steal it.
    Nonsense. Theft is a crime. There is no crime in Japan.

    Earlier this month, when I showed the PL how easy it was to circumvent their homegrown content protection system using Fiddler, I almost got fired. In fact, just by writing the previous sentence, I have now violated a non-disclosure agreement they forced me to sign.

    Are there any sane companies in Japan? Are they hiring?  *sigh*
    There is no hacking in Japan either. That's a crime too. Nobody would be so disrespectful as to try to access something they weren't supposed to. Where is your honour?


  • @fish said:

    Has the profession really turned so bad that people no longer have pride in their code and just write stuff to get their monthly paycheck?

     

     I hate to break it to you, but software development is not a profession.



  • @chooks said:

    @fish said:

    Has the profession really turned so bad that people no longer have pride in their code and just write stuff to get their monthly paycheck?

     

     I hate to break it to you, but software development is not a profession.

    1. a paid occupation

    What?



  • @chooks said:

    I hate to break it to you, but software development is not a profession.

    You're trying to get at something, but what is it? I don't get your point, or how that definition doesn't apply to people who do software engineering in exchange for money.



  • @blakeyrat said:

    @chooks said:
    I hate to break it to you, but software development is not a profession.
    You're trying to get at something, but what is it? I don't get your point, or how that definition doesn't apply to people who do software engineering in exchange for money.

    I assume it's cause he focused on the part of the definition that says "prolonged training and a formal qualification", which being a code monkey doesn't meet.



  • @locallunatic said:

    I assume it's cause he focused on the part of the definition that says "prolonged training and a formal qualification", which being a code monkey doesn't meet.

    I thought that too, but then again I think pretty much every "code money" has prolonged training-- it might not have been official classroom training, but we all have it.

    It sounds like chooks' real problem is the lack of reading comprehension, since the word preceding the portion locallunatic quoted is "especially".



  • @blakeyrat said:

    @locallunatic said:
    I assume it's cause he focused on the part of the definition that says "prolonged training and a formal qualification", which being a code monkey doesn't meet.
    I thought that too, but then again I think pretty much every "code monkey" has prolonged training-- it might not have been official classroom training, but we all have it.

    I was thinking the focus was more on the formal qualification part.  Like an engineer or doctor needs to be licensed.

    @blakeyrat said:

    It sounds like chooks' real problem is the lack of reading comprehension, since the word preceding the portion locallunatic quoted is "especially".

    Well yeah, but I was trying to come up with an explaination as to why he would claim something at odds with the evidence he was attempting to use to support it.



  • @locallunatic said:

    Well yeah, but I was trying to come up with an explaination as to why he would claim something at odds with the evidence he was attempting to use to support it.

    I bet he's leaning back in an easy chair right now, biggest grin in the world on his face, thinking to himself, "oh man I burned those DailyWTF readers so goddamned bad... I'll give it another half hour for it to sink in then come back and bask in their defeat!"

    He's going to be disappointed.



  • @locallunatic said:

    I was thinking the focus was more on the formal qualification part.  Like an engineer or doctor needs to be licensed.

    I would argue that even being licensed, by itself, is meaningless. Take driving for example: pretty much everyone on the road will have received formal training, and is a licensed driver. Does that mean every motorist is a good driver? Because that is not what it looks like where I am from. And the same holds for other professions: if I need surgery and my doctor tells me he just got his medical license yesterday, I will probably ask for another doctor. Having a license may be a prerequisite for being competent, but it most certainly does not guarantee it.



  • @blakeyrat said:

    I bet he's leaning back in an easy chair right now, biggest grin in the world on his face, thinking to himself, "oh man I burned those DailyWTF readers so goddamned bad... I'll give it another half hour for it to sink in then come back and bask in their defeat!"




    or, more probable scenario he is under his bridge reading the replies and enjoying himself immensely.



  • @FragFrog said:

    Having a license may be a prerequisite for being competent, but it most certainly does not guarantee it.
     

    Also important to remember there are countries that license prostitutes...not sure if there is correlation to competency...



  • @TheCPUWizard said:

    Also important to remember there are countries that license prostitutes...not sure if there is correlation to competency...


    Since there is no formal training involved as far as I know, I would guess no. But conversely, firefly fans will recall that licensed companions were assumed to be very competent indeed. Not entirely sure how that relates to software development, though the similarities are uncanny.



  •  The latest WTF. These just keep coming. Please allow me to dump them here, so I can keep my sanity.

    So we use Memcache to store data. The PHP side of things is done with the Memcached extension. One of my first tasks was to write a wrapper class that ensures whatever you throw into it comes out exactly the same. That was an easy one day task whose main purpose was to get used to coding standards, the framework, etc. I put some extra effort into it anyway; e.g. make it use serialize if the data type was an object or array, etc. Just the things you come up with when you think about it longer than 5 minutes.

    One of the decisions: If an error occurs, an exception is thrown, because this makes it easy to separate error conditions from return values. Also, because the FuelPHP framework uses exceptions for all errors, I tried to create the class in the spirit of the framework. (Preemptive comment: FuelPHP has its own Memcache wrapper class of course, but refer to my first post: the PL doesn't trust the framework, so we have to rewrite most of it.)

    This means that if a key is not found, it throws a KeyWasNotFoundException.

    Everyone was happy with this approach for about a month.

    This morning, Mr. PL comes up and suddenly throws another fit.

    Using exceptions is apparently 「ノンセンス」  (nonsense).
    He said that he has never seen this kind of programming used before.
    Instead of exceptions, we should return raw Memcached library error codes.

    When I told him that those error codes are numeric and might collide with actual data, Mr. PL pulled the same old "You are JUST a programmer" card.

    The next suggestion - worded in a very diplomatic tone - was to return an array with a status code and the data. Rejected. Arrays are slow.

    Storing the last error code in a class variable to allow get_last_error() style programming? Refused.

    Logging the error using the logging facility? Refused. Logging is slow.

    After an hour's worth of back and forth between him and most of the team, he gave permission to return false on error (everyone had to agree not to store (bool)false).

     

    We are currently busy going through code and removing the exception handlers.

     

    And people wonder why the number of suicides by train is so high in Tokyo.



  • @fish said:

    Using exceptions is apparently 「ノンセンス」  (nonsense).
    He said that he has never seen this kind of programming used before.
    Instead of exceptions, we should return raw Memcached library error codes.

    Your アブストラクション was too アブストラクト and needs more マジックナンバー.



  • @Ben L. said:

    Your アブストラクション was too アブストラクト and needs more マジックナンバー.
     

    TPTFY



  • @Fjp said:

    @fish said:
    I was strongly reminded that as just a programmer and the youngest in my team, I am to shut up and produce code.

    Quite right too. You are not there to turn out high-quality code; you are there to turn out code that conforms to the company's expectations. You have no responsibility for the resulting mess.

    If we all adopted your attitude, maintenance programmers would be out of a job.

    A self respected professional will NOT comprise competence just because of paychecks.



  • @fish said:

    error codes are numeric and might collide with actual data
     

    Un-knowledgeable idiot simpleton! Are you incapable of even the simplest concepts of programming. You use defined values, not return numbers.


    <?php
    int $MEMCACHE_ERROR_FULL = 2;
    
    int $myData = Memcache.GetData("myData");
    
    if ($myData === $MEMCACHE_ERROR_FULL)
    {
      throw new exception("Memcache: Error Full!");
    }
    else if ($myData === 2)
    {
       echo "Got the number 2, and not the memcache-specific error!
    }
    ?>
    


  • Amidst all of this, I am still to see a "We so solly"...

    But do carry on... that PL should get a caning.



  • @Xing Yang said:

    A self respected professional will NOT comprise competence just because of paychecks.

    That's true. They're usually competent regardless of the paychecks. But if they admire their competence above their hunger or their childrens' hunger, they are TRWTF.



  • Was Stanley Milgram actually Japanese, or are they just big fans of his work?



  • @boomzilla said:

    @Xing Yang said:
    A self respected professional will NOT comprise competence just because of paychecks.

    That's true. They're usually competent regardless of the paychecks. But if they admire their competence above their hunger or their childrens' hunger, they are TRWTF.

    Sorry for my fat fingers.

    Fortunately a competent developer and his/her family will never be hungry. It's much easier to switch jobs as a software developer than many other professions.



  • @Lorne Kates said:

    @fish said:

    error codes are numeric and might collide with actual data
     

    Un-knowledgeable idiot simpleton! Are you incapable of even the simplest concepts of programming. You use defined values, not return numbers.


    <?php
    int $MEMCACHE_ERROR_FULL = 2;
    
    int $myData = Memcache.GetData("myData");
    
    if ($myData === $MEMCACHE_ERROR_FULL)
    {
      throw new exception("Memcache: Error Full!");
    }
    else if ($myData === 2)
    {
       echo "Got the number 2, and not the memcache-specific error!
    }
    ?>
    

    You know that putting $ before variables in a C-family program doesn't make it PHP, right?



  • @fish said:

     The latest WTF. These just keep coming. Please allow me to dump them here, so I can keep my sanity.

    So we use Memcache to store data. The PHP side of things is done with the Memcached extension. One of my first tasks was to write a wrapper class that ensures whatever you throw into it comes out exactly the same. That was an easy one day task whose main purpose was to get used to coding standards, the framework, etc. I put some extra effort into it anyway; e.g. make it use serialize if the data type was an object or array, etc. Just the things you come up with when you think about it longer than 5 minutes.

    One of the decisions: If an error occurs, an exception is thrown, because this makes it easy to separate error conditions from return values. Also, because the FuelPHP framework uses exceptions for all errors, I tried to create the class in the spirit of the framework. (Preemptive comment: FuelPHP has its own Memcache wrapper class of course, but refer to my first post: the PL doesn't trust the framework, so we have to rewrite most of it.)

    This means that if a key is not found, it throws a KeyWasNotFoundException.

    Everyone was happy with this approach for about a month.

    This morning, Mr. PL comes up and suddenly throws another fit.

    Using exceptions is apparently 「ノンセンス」  (nonsense).
    He said that he has never seen this kind of programming used before.
    Instead of exceptions, we should return raw Memcached library error codes.

    When I told him that those error codes are numeric and might collide with actual data, Mr. PL pulled the same old "You are JUST a programmer" card.

    The next suggestion - worded in a very diplomatic tone - was to return an array with a status code and the data. Rejected. Arrays are slow.

    Storing the last error code in a class variable to allow get_last_error() style programming? Refused.

    Logging the error using the logging facility? Refused. Logging is slow.

    After an hour's worth of back and forth between him and most of the team, he gave permission to return false on error (everyone had to agree not to store (bool)false).

     

    We are currently busy going through code and removing the exception handlers.

     

    And people wonder why the number of suicides by train is so high in Tokyo.

     

    Why not just set $GLOBAL_MEMCACHE_ERRNO? It's like your just trying to  make your life hard.

     



  • @Mo6eB said:

    @fish said:

     The latest WTF. These just keep coming. Please allow me to dump them here, so I can keep my sanity.

    So we use Memcache to store data. The PHP side of things is done with the Memcached extension. One of my first tasks was to write a wrapper class that ensures whatever you throw into it comes out exactly the same. That was an easy one day task whose main purpose was to get used to coding standards, the framework, etc. I put some extra effort into it anyway; e.g. make it use serialize if the data type was an object or array, etc. Just the things you come up with when you think about it longer than 5 minutes.

    One of the decisions: If an error occurs, an exception is thrown, because this makes it easy to separate error conditions from return values. Also, because the FuelPHP framework uses exceptions for all errors, I tried to create the class in the spirit of the framework. (Preemptive comment: FuelPHP has its own Memcache wrapper class of course, but refer to my first post: the PL doesn't trust the framework, so we have to rewrite most of it.)

    This means that if a key is not found, it throws a KeyWasNotFoundException.

    Everyone was happy with this approach for about a month.

    This morning, Mr. PL comes up and suddenly throws another fit.

    Using exceptions is apparently 「ノンセンス」  (nonsense).
    He said that he has never seen this kind of programming used before.
    Instead of exceptions, we should return raw Memcached library error codes.

    When I told him that those error codes are numeric and might collide with actual data, Mr. PL pulled the same old "You are JUST a programmer" card.

    The next suggestion - worded in a very diplomatic tone - was to return an array with a status code and the data. Rejected. Arrays are slow.

    Storing the last error code in a class variable to allow get_last_error() style programming? Refused.

    Logging the error using the logging facility? Refused. Logging is slow.

    After an hour's worth of back and forth between him and most of the team, he gave permission to return false on error (everyone had to agree not to store (bool)false).

     

    We are currently busy going through code and removing the exception handlers.

     

    And people wonder why the number of suicides by train is so high in Tokyo.

     

    Why not just set $GLOBAL_MEMCACHE_ERRNO? It's like your just trying to  make your life hard.

     

    Are you using memcache for your quoting pleasure?


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.