• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Zomgbie

Adjusting to new guidelines for code structure and software

8 posts in this topic

Hello people!

 

Last year i started my employment at a new company. Things have been going great, or so i thought. At a recent developers meeting i received quite a lot of critique for how i write my code. Now, i can accept that i have to adjust to a new code structure, but somethings just feels so wrong. For example, this is how i'd write an if statement:

if ($variable == "condition")
        doAction();

I was told that this is wrong and wont work, simply because the PHP log picked up an error at this line once. The error was actually caused by a missing quotation mark. So i was instructed to always encase my if statments like so:

if($variable=='condition') {
        $do_action();
}

And i just find it so hard to accept this. Sure, if he could give me a real reason to adjust to his personal coding style, i would. But blaming it on that it's "wrong and won't work" just pisses me off...

 

And then there is the question of coding software. I've always been using an OpenBSD box, with vim as my prefered editor. Sadly i was told that this is wrong too and i have to use Dreamweaver on Windows, because it's faster and "better".

 

How would you deal with this? I actually went to talk with my boss, but he said i have to accept these changes as the lead developer is way more experienced then me. Sadly i've lost a lot of productive code hours only to getting used to Dreamweaver and rewriting my code to follow his examples. What would you do? Am i just being stupid because i don't like the way he codes?

Edited by Zomgbie
0

Share this post


Link to post
Share on other sites

If you're being paid for a job, then you do the professional thing, which is to follow the client's specifications and do what they're paying you for.

 

In this case, the client might be an incompetent lead, and the specifications might be some stupid coding guidelines, but it doesn't matter. They're paying you to code in the way they want you to code.

 

Having everyone follow a common set of coding conventions is extremely useful, even if you don't agree with them. I worked at a games company with 100 other programmers, who constantly argued about stupid rules in our coding conventions... but we all followed them nonetheless, even though we all disagreed with some parts of them. By ensuring that all the code looks the same, it made all our jobs easier in the long run, when working with other people, or with other people's code.

 
If they truly believe that you should follow their conventions because your old style is causing bugs... well then that's a different issue. Keep your resume updated and keep your eyes out for better jobs tongue.png
Also, if that truly is the case, then don't rock the boat by being argumentative, because incompetent leaders tend to use office politics to protect the comfy role they've managed to forge in the company...
 
BTW, in PHP "blah" and 'blah' are different, and each is preferable in different situations. In this case, the single-quote version is more optimal.
Regarding the braces, that's something that's the cause of endless coding-style arguments. If the company has picked a style, then you've just got to suck it up and stick to it for the sake of everyone to keep the code-base from looking schizophrenic.
0

Share this post


Link to post
Share on other sites

In your example what would happen if somebody did a find and replace on doAction(); with //doAction();  It may seem like a stupid thing to do but I have seen developers do this and things that are a lot worse.

 

The code style guidelines are not there to protect just you but every developer in the team.  Every company has guidelines and at every company they vary.  Some companies the guidelines are written by idiots and some they are written for specific reasons.

 

 

Having to use Dreamweaver though sounds a little weird.  I think if I was told which tools to use to do my job I would probably just leave.  Unless of course there was a monaetry reason why they wouldn't buy the tools I need but, they are free so there isn't.

0

Share this post


Link to post
Share on other sites

 

...

 

You are indeed correct. But they are not really clients, they are colleagues. Though you are very correct, i'll have to suck it up. I guess i'm just a little sad that i have to give up my personal style, just because someone else want's theirs. It's not that we are alot of developers, we're only two. Him and me. Which is why it hurts ^^

 

And oh yes, i know the difference between single and double quouted strings. I just tend to stick to double qouted cause of all the years working with C.

 

In your example what would happen if somebody did a find and replace on doAction(); with //doAction();  It may seem like a stupid thing to do but I have seen developers do this and things that are a lot worse.

That's actually something i haven't thought of. In such a case i would just blame a really lazy developer, but it's still a valid point. Thanks!

 

He's reasoning for forcing Dreamweaver on me is that it works faster and can open any type of files... which... yeah... you know what i mean.

0

Share this post


Link to post
Share on other sites

I would second Hodgman’s suggestions, even if it applies only to “coworkers” rather than to “clients”.

Unless you have been specifically placed in charge, you are the new guy and no one will respect your opinion until you prove it is the right one.

Of course, even if you were explicitly placed in charge, no one will respect your opinion until blah blah blah.  Only difference is that they have to deal with it instead of you.

 

 

But from what you have proposed compared to what I would propose in a professional environment, there are reasons why a team leader would prefer everyone to use braces even when not necessarily necessary by the language.

The reason why you should “always encase your ‘if’ statements” will likely come to you at a later time.  For now it’s time to suck it up and take the lower wage and status as the rest of us have and acknowledge that many others have come before you and have put certain restrictions in place for the sake of the team, rather than the individual.

 

 

Usually when someone above you says it is “better” it is just to avoid a drawn-out argument.  Which that person has experienced more times than you have.

If you want to argue such a situation based on your own efficiency (these being the key words) then I would suggest only doing so in a way that is sympathetic to his or her goals, which are to eliminate redundant arguments while providing a framework consistent enough that future workers can easily adapt, while still trying to make your own case that you yourself will work faster because of your previous experience in X software, even though it is unrelated to the people who will in the future be maintaining your code, and will end up slowing them down.

 

 

In other words, give up.  Do what they ask and try to use your expertise not as a way to trump them but to merge with them.  Neither wins by using only the expertise from one or the other.  You only win by sucking up your humility and trying to find out in time how you can help them with your unique knowledge and skills.

 

 

L. Spiro

0

Share this post


Link to post
Share on other sites

As Hodgman said : "the code must be consistent".

About the tools.... well sometimes, we are wrong.. Personally i don't like Vim and Dreamweaver(about DW.. maybe because I'm not a web programmer)). But they may force you to use DW because of some licensing, or already developed tools that you must use, because hmm... thay generate some code for you, or more likely because your coworkers are using some project settings that you cannot maintain for your code just because you're not using it.

 

If you write consistent code everyone will be OK with Vim. They just want you to follow some guidelines...

 

BUT if there is no reason and you dont like the place ... find another job, because the most important thing after all is your tranquility!

0

Share this post


Link to post
Share on other sites

That's actually something i haven't thought of. In such a case i would just blame a really lazy developer


It's not lazy to want automated renaming/refactoring to not break things.

I agree with most of what you said except the braces. Braces are great.
0

Share this post


Link to post
Share on other sites

When you work in a team, abandon all your personal styles.  You have to agree with the coding guidelines of the team.  The worse thing is to read code that has m_inconsistent code_styLing.

 

Regardless of choice of editor, that should never been enforced.  You can complain about  that.  Everyone is entitled to have his/her own personal work environment.  That's kind of like having a boss telling you what to put on your cubicle.  Dreamworks, vim, emacs, that's up to you, unless you have project files can only be opened on certain editors.

Edited by alnite
0

Share this post


Link to post
Share on other sites

Now that a few days have passed, i can safely say that i was just being stubborn. After reading what you folks have written i understand that all i can do is accept this new codingstyle, and that it's for the greater good. I feel a little embaressed to say, but i belive i just thought my standards were better then his. Hence it felt so wrong to adapt to the new guidelines. I learned my lesson, so to speak. Thanks again! :)

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0