Community code review?

Hi all,

I’m two years into using unity and am the lead programmer at a small interactive design company. I’m entirely self taught in programming, and to judge by the work we put out and the skill level of other programmers we’ve hired, I feel I’ve come quite a long way in a short amount of time. In that time I’ve discovered I love writing code, and love learning new tricks and ways of thinking.

However, being self taught, there are limitations on what I know. There are stylistic or idiomatic ways that I code that might not be standard or the most efficient. Unfortunately I do not have any senior programmers around me to review my work.

I am wondering if there is a resource whereby people could share code and get constructive feedback? I’m interested in getting to the boss fight on this level and progressing to the next level :wink:

Are there any resources that already exist? Or is there a place on the forums for this sort of interaction? If it doesn’t exist, would anyone be interested in participating in a review system? Perhaps it could be just informal, replies in threads in the forums, or perhaps there could be a specific page for this? Just some thoughts.

-Jason

Well, there’s http://codereview.stackexchange.com/ but I never used it.

I’m interested in deeper analysis than just “how to best store a list of game objects” or “is this algorithm here efficient”, but rather a broader scope analysis of design patterns, code structure, and overall flow. This is the level of feedback that I don’t have access to that I feel would help me get exponentially better.

ah! cool, I wasn’t aware of it. I’ll take a look. I get the sense that other sites are generally suspicious of Unity programmers, since we have a special subset of challenges. I’ll bet that it’s really useful though. I will investigate. Thanks!

Frankly, I’m more suspicious of Unity programmers because they tend to use shortcuts, poor design, lack of polymorphism, or hard coded values. It’s a small project, right? Who care! On top, since I’m a C# coder, I tend to expect C# writing convention to be followed, which is rarely the case.

That’s what I mean! When unity coders post on StackOverflow or other places, generally people aren’t too excited to help, and understandably so. This is also the reason that I’m interested in people looking at my code. I don’t want to fall into bad habits or poor design. I am very specifically interested in writing code for unity in the best possible way. I’ve taken pains to try to research proper procedure, but because of the state of the web, information is usually only available in snippets and chunks. I’m at a point where I would like a larger, broader analysis of my code.

This is the exact reason why I’m interested in code review. I’m not interested in being a programmer whose design is poor and whose shortcuts are lazy and inefficient.

So, I agree with you. People tend to get lazy, and I don’t want to get caught in that.

I mean, the ideal would be to work at a company where I have other seasoned programmers to work with. That isn’t my current situation, that’s what this post is about :slight_smile:

Tip #1; don’t double post, edit your previous post. :stuck_out_tongue:

The issue with reviewing overall design is that it can span over dozen files and thousand of lines of code. A proper review isn’t as easy as it sounds. Reviewing snippets also isn’t very useful unless there’s some obvious flaws.

As example, the framework I’m currently using is over 30k lines of code - no game, just framework! -, and everything else is built on top of it. Posting some of my code wouldn’t make much sense to read because of the inheritance or the numerous attributes.

Yeah, I definitely have projects that would be too large for this scope. But I have a few that would be digestible, around 10 scripts and maybe 1k lines of code. All in Unity, of course. But, I see what you mean. I assumed (and should explicitly state) that there would be a maximum project size.
For two reasons:

One, I’m sure no one wants to release code to a secret project out into the world for everyone to see
Two, I’d want to focus on specific design patterns, specific functionality, efficiency. I’d prefer focused feedback on minimal projects that illustrate very clear examples of the way that I think about structure.

For example, I recently wrote a Game of Life simulation in Unity3d, and I feel I did a decent job, but I have no idea what someone with far more experience might think when looking at my code. Getting feedback in is crucial for improvement regardless of what skillset we’re talking about. I mean, I’m sure you understand, I’m just talking/typing out loud at this point. :slight_smile:

Anyway, I’ll try my luck over at the link that you posted earlier, and if there are any other resources, I’m definitely interested.

You have to be careful though as this is a very dangerous supposition to make. When you’re talking about different disciplines you have to think about different approaches and methodologies. When doing game development, for example, there are a lot of things that can or need to be done when optimizing performance, but those things would be considered bad practice (and lead to failed code reviews) when done in, say as web application.

You got my curiosity there… Do you have an example of what would be a bad design that would give such an amazing performance improvement?

I’ve seen (and done) my share of performance optimization that would fail code review, but in all case they were done because of last-week-put-it-in-the-box-kind of debugging.

Object pooling for one. It’s completely unnecessary in almost any practical application outside of game development and would be considered an over-optimization and a waste of developer time.

That’s hardly a bad design. It’s a very well known and used pattern! ( Object Pool Pattern | Object Oriented Design / Object Pool Design Pattern )

If well implemented, and done for a reason, I don’t see how that would fail a code review.

Not bad design in general, but only appropriate for very specific use cases and in .NET much of that is handled for you. For example, the link you sent uses database connections as an example but that pooling is already done by IIS and it would be silly (and actually counter-productive) to try to do it on your own. My point was, be careful not to make the statement about bad design sound too much like a blanket statement as the particular discipline is necessary for appropriate context.

Exactly why I’m asking for code review here on the Unity forums, rather than say, StackOverflow
:slight_smile:

There’s some stuff that is bad… By example, hard-coded strings for object name, method name and so on.

Or another example, only inspect fields and not having the option - out of the box - to inspect properties, is a very strange tool/architecture design.