Call for code review



When I started this blog, I had one idea in mind: create some sort of repository of programming principles and practices so that I myself and other people would have an easier time navigating around them. That’s a nice goal to aim for but I noticed that when it comes to the actual process of writing code, having such a repository is often not enough.

Call for code review

It’s one thing to be aware of principles and practices, and it’s another to apply them in real-world projects. Although I always try to provide code samples when describing a topic, those code samples are often too simplified and short. Which is understandable because otherwise, they’d become too hard to follow. Still, the result is that there’s rarely a sample which connects many practices together and gives a perspective on how they play in combination.

And that is an important thing. Principles tend to conflict with each other (see OCP vs YAGNI for example). Their application highly depends on the context they are used in, and that context itself lies in multiple dimensions. A technique that is perfectly fine to adhere in a business-line application, could be unacceptable when applied to a publicly distributable library. There are practices that you absolutely need to employ in large teams and can neglect when there’s just 1 or 2 programmers on the project. And so on and so forth. There are quite a few such parameters that need to be taken into account.

Besides, I’m a firm believer in learning from examples. Our brains are wired to look for patterns and so the more examples you see, the better you become at doing similar work in the future. Well annotated code samples often provide much deeper insight than studying principles and practices in isolation from each other.

So what I thought I would do is try another format. Flip the discussion so that instead of focusing on principles with code samples illustrating them, we take a real-world code and review it providing references to relevant design techniques.

Here’s a good analogy. I want to go from this:

Programming Topic 1 -> * Code Sample

to this:

Code Sample 1 -> * Programming Topic

In other words, make the code a first-class citizen.

Where do I get those code samples? That’s where I need your help. If you have some piece of code and would like me to review it, send over this code to me. I’ll give my perspective on what’s good and what can be improved, thoroughly annotated and explained. I’ll provide references to separate articles from this blog or other resources where you can learn more about a particular practice or technique. When applicable, I will also refactor the code.

What kind of code do I look for? Unfortunately, I don’t have the capacity to review a full-scale project. I see the ideal code sample as one or a handful of classes. They don’t have to compile, and they don’t have to represent a cohesive piece of functionality, just something you want to get my perspective on. The code itself can be part of a domain model, an application service, or both. It surely can be a part of some library as well.

Another option is if you have a domain modeling question. DDD is something I consider one of my strong sides, and also something I enjoy a lot. When my DDD in Practice course came out, there were lots of great questions related to how to build a proper domain model. So if you have one, feel free to ask it. And if you have some thoughts on how to implement it, make sure to include them too, it’s always good to have more than one perspective on such questions.

My main programming language is C#, so code samples written in it would be ideal. But I think I will also be able to review Java code as long as it doesn’t use too much of framework specifics. POJO classes would be best here.

All questions and code samples will be anonymous by default. I won’t reveal your identity unless you explicitly ask me to. You can post a code sample on GitHub Gist and email me a link or you can just attach it to the email. I’ll look at ways to simplify this process and maybe create a form dedicated to code review requests right on this blog.

I don’t know how many such requests I will get (if any at all) but let’s see if this idea takes off. Looking at other programmers’ code and reviewing architectures is something I enjoy doing. So why not do it in public?

And if you wonder about articles in the “traditional” format – I’ll still be posting them, nothing will change in that regard.

EDIT

You can now send the code via the form on the right (entitled “Request a Code Review”).

EDIT 2

You can also use a submit form here: Request a Code Review

Share