Maintaining a Personal Style or Adapting to Professional Situation

For those of you who are employed as programmers and have your own side projects I have a question. Having been bounced between three development companies within the last three years I’ve noticed that I tend to adapt my personal development strategies to the rules, conventions and linguistic patterns practiced by the company. For example, at my last position programmers were required to prefix variables with the primitive type such as obj, arr, int, str. So variable and property names would end up looking like $intProducts, $arrProducts, etc. Naturally that has carried through to all my work professional or personal. Another great example of one that some may be familiar with and hate is prefixing the table name for primary keys. So for a table named blogs the surrogate key would be blogs_id. Those are just two but there are several more.

Anyway, having just recently started a new position many of syntactic rules and patterns have either changed or aren’t required such as the one I mentioned above. That in itself is fine. I understand and accept it based on established norms of the company to keep code looking somewhat consistent across all developers. So that isn’t a problem at all.

What is a problem though is I have some personal stuff I’ve been working on that closely follows the conventions and rules at my previous position. So for the sake of keeping these personal projects consistent I think its best to stick to the conventions and rules used in them even though they are not what I will be professional following in my newly acquired job. To me that seems like the best approach but the major disadvantage of that is developing these projects in that form will do nothing to help reinforce the coding conventions I will need to follow now professionally.

So having thought about this issue leads me to the question whether one should change their personal development style to match their professional situation or not? Perhaps I’m going about this in the wrong way and should keep a personal baseline that may/may not deviate from my professional work developed under the company which I’m employed by?

I know a lot of you guys have personal things you have been working on and I would just like some thoughts on the issue from those in a similar situation. Do you tend to adapt your personal code style to your professional situation or maintain two separate styles so that regardless of your employer all your personal code looks the same?

There isn’t a right or wrong answer. This is just something I’ve been wondering about due to being bounced around as many times as I have in such a short and early stage of my career.

Thanks

Well on the Hungarish notation of variables it can lead to very sloppyish naming. If you look at the history of Hungarian notation this prefixing isn’t even done right.

I have to use Hungarian notation at work and it just means people have got sloppy. $intCandidate instead of $candidateId or $candidateCount etc. $arrFiles could mean anything( how is it indexed? is it a map versus a List? is it a list of File objects? $obj inferring an object is also pretty useless, call the wrong method bad things happen. With objects Type hinted method calls are much more useful and make such naming schemes redundant, if it isn’t shut down as the caller has not completed their part of the contract.

Microsoft( the history Hungarian notation lies heavily with them and Charles Simonyi ) recommends it is not used anymore , most companies also do not use it properly anyway as it was more in depth with things like “us” for unsafe string.

So the answer is would I use Hungarian notation/ type prefixing outside of work? Nope :slight_smile: I infer it in plain English the best I can either way.
At work
$iCandidateId
$aFileNameList

At home
$candidateId
$fileNameList ( The type hint on that could be array, ArrayObject, FileNameList etc but the key would always be sequential from 0 as that is what List usually infers ).

The rest of the coding standards are more sensible and based on better practices from books such as Clean Code and comprehendability is favoured over quick to type, IDE’s help with that anyway with completion.