6 ms·
My God. I would've been panned for that in university. Break it up with meaningful comments, rip some of it out into functions where possible, if you're leaving
by Derpdiherp 10y ago
My God. I would've been panned for that in university. Break it up with meaningful comments, rip some of it out into functions where possible, if you're leaving code in source which is commented out - at least leave a comment on why it's commented out.
I suppose this is the result of deadlines and lax code reviews.
- AlexeyBrin 10y ago> I suppose this is the result of deadlines and lax code reviews. This is usually the result of years of changing/updating the code. Any living code base tends to grow and accumulates cruft over time. Just because it doesn't fit the ideal you learned in university doesn't mean it is bad code, this is real life code.
- Derpdiherp 10y agoI've worked in the Games industry with age old engines, I currently work in embedded development with a code base over 10 years old - I'm fully aware of what "real life" code is like. There is no excuse for not writing well commented code - or even code with well named variables and functions that reduce the need for as much commenting. If you suffer from code like this in your workplace, perhaps actively comment it as you reach an understanding of what it does.
- stuxnet79 10y agoThe fact that you are using university requirements as an exemplar is very telling. The moment I graduated and started hacking away in the real world is when I discovered that there was a lawless wild-wild-west of coding conventions out there.
- Derpdiherp 10y agoSeems as you've picked up on the same thing - "I've worked in the Games industry with age old engines, I currently work in embedded development with a code base over 10 years old - I'm fully aware of what "real life" code is like. There is no excuse for not writing well commented code - or even code with well named variables and functions that reduce the need for as much commenting. If you suffer from code like this in your workplace, perhaps actively comment it as you reach an understanding of what it does." Relatively experienced 6 year C++ dev - I mainly mentioned university because things where much stricter - but having an environment with decent code reviews and maintaining a little self discipline goes a long way with the sanity of your co-workers.
- sillysaurus3 10y agoYou're a C++ dev, not a gamedev. They use different coding conventions. You'll find a lack of refcounted pointers, for example, whereas university teaches you to use them. 6 years is significant, but it's not a long time. There's much to learn, particularly about the cultural aspects of various segments of the industry. This is excellent code that was produced on a tight timeline.
- Derpdiherp 10y agoI was a game dev for 3 of my 6 years. I just got sick of the layoffs after project ends - and my university tuition was in fact games development specific. *Edit - Yes though - by no means do I think I'm some big shot know it all. But I do have strong feelings about readability after having had to deal with code which is awful to grok.
- sillysaurus3 10y agoFair enough. It's a valid point of view. Sorry you had to deal with layoffs. It's one of the darker aspects of the industry. To clarify, my objection was that we're criticizing this code for superfluous reasons when it's currently a delicate political climate in most game companies to even release code like this in the first place. It's probably best not to imply their reputation should be harmed by their lack of comments, since this can discourage other game companies from releasing their code in a similar manner. I've seen the argument "it might harm our reputation" be used to block endeavors like this.
- Derpdiherp 10y agoI'd argue that a company should be able to take a little criticism - style based ones like mine will likely be ignored, as you mentioned before it's down to the culture of the company - for every function like the one outlined in the OP I'm sure there's countless examples of good style in the code base, engines are huge. I really hope that companies don't view criticism as a negative thing, it's cause for discussion and change which are most certainly positive - I hope some bugs are found and they start to feel the benefit of the community a little.
- Jeema101 10y agoA mish-mash of coding conventions is understandable, given the fact that coding standards may not exist in the first place, or can change over time, etc. Long functions which have grown over time are also understandable, given the realities of changing requirements and such. Thousands of lines of uncommented code, however, are not understandable... in the sympathetic sense, or literally.
- whatever_dude 10y agoColleges normally stress perfect code against some theoretical metric. Real-world work stresses getting stuff done. And in this case parts of the code can also take a life of their own. Ideally both ideologies meet somewhere in between and you get code that works and is maintainable. But sometimes you can get bad code that is shipped... or an unhealthy obsession with polished code that never ships. One is infuriating, the other makes businesses slowly unfeasible.
- bryondowd 10y agoThis reminded me of my last place of employment. We didn't use any form of version control system. Instead, every time we changed a piece of code, we commented out the existing code and left it there, next to our revised code, along with a START and END comment including the coder's initials, date, and the ticket or project the change related to. Frequently changed parts of the code were a hideous mess of 90% comments to 10% code. And then occasionally we'd just rename an entire file by prepending 'old' to it and starting fresh with a new file. That place was such a learning experience on the concept of technical debt. But at least I got a fun talking point for my resume. "x++, is that a typo?" "No, sir..."