88

I am a good programmer, or so I thought before. I always love to program. And I want to learn many things about programming to make me a better programmer. I studied programming for 1 year and now I am working as a programmer for almost 2 years. So in short, I have almost 3 years programming experience.

Our team is composed of 5 programmers, and 4 of us are new, 1 has more than 3 year experience. We've been working for a program for almost a year now and nobody ever review my code and I was given a page to work with. We never had a code review and we are all new so we don't know what is a clean code looks like. I think programmers learn by themselves?

We deployed our program to the program without thorough testing. Now it is tight and we need an approval and code review first before we make changes with the code. For the first time, someone reviews my code and he says it is a mess.

I feel so sad and hurt. I really love programming and making them say something like that really hurts me. I really want to improve myself. But it seems like I'm not a genius programmer like in the movies. Can you give me advise on how to be better? Have you ever experience something criticizing your code and you feel really hurt? What do you do on those events.

29
  • 51
    "But it seems like I'm not a genius programmer like in the movies". Your mistake is believing what you see in the movies about software developers, hackers, and just about everything else to do with real-world technology.
    – Stephen C
    Commented Nov 17, 2012 at 1:38
  • 163
    Congratulations! As of today, you're officially a real programmer! Being told you're terrible is one of the ever important stepping stones in this profession. I cannot understate this: Every single professional programmer has been told something they wrote was awful at one point or another, and it kind of stings when you're new to it, but it's true and you will hear it many more times in the course of your career! Buck up, you just joined the profession. Good programmers take those jabs and learn not to make the same mistakes (instead, they make different ones every time!) Commented Nov 17, 2012 at 1:55
  • 15
    @newbie when you're new and you've built a bit of ego and not screwed up enough to realize you're bad, I'm bad, we're all bad at this because it's really hard. If you have any ego left it'll go by the way side after you make more mistakes. Seriously, raise your hand if you're a professional engineer and have accidentally blown away a database before raises hand Commented Nov 17, 2012 at 2:06
  • 14
    Disappointed? Why the hell would you be disappointed? My former CTO called me out in an article he wrote (he didn't name me specifically, but everyone in our team knew who he was talking about), and the first chance I got I quoted the article in one of my answers here. Also, I'm the evil developer described in this question. I encouraged the OP to post the question, and I even answered it ;)
    – yannis
    Commented Nov 17, 2012 at 2:26
  • 20
    Remember folks, just because someone said the code was bad does not make it true. After hearing "your code is a mess" the OP deserves "and here's why." Then, analysis can begin.
    – Tony Ennis
    Commented Nov 17, 2012 at 16:23

21 Answers 21

175

The truth is that probably in 2 years when you will see your current code you will agree that it was a mess. Learning programming is a never ending process and there will always be someone who is better at it than you.

So if person who said that your code is a mess is not just mean and it is not another case of "I would do it better" disease common among programmers you should ask him/her what exactly is wrong with your code and how can you improve it.

10
  • 29
    You're right! I laugh at my code 2 years ago. So i guess I will also laugh at my code two years from now. I just became a little bit emotional about it. Anyhow, I'll try to become a better one.
    – newbie
    Commented Nov 17, 2012 at 2:07
  • 6
    @newbie: There you go. That's what you really need to know. My motto has been "I'm never as good as I'll be two years from now," for over ten years now. And I've not been wrong yet. I didn't learn that til a lot further into my career than you have. Your colleague has done you a big favour.
    – pdr
    Commented Nov 17, 2012 at 2:16
  • 28
    I think that six months should be plenty of time to hate your code. I am worried that some day I might find code that I've written six months prior and not find something I hate about it. It'd be a sign that I haven't been growing as a programmer.
    – zzzzBov
    Commented Nov 17, 2012 at 3:10
  • 39
    2 years! I can laugh in the afternoon at code I wrote in the morning. Commented Nov 17, 2012 at 16:24
  • 9
    I would also say that code reviews are incredibly helpful processes. As this answer states, if you're a good programmer at all, in time you too will think this is terrible code - it's natural. I'd also say though that your code reviewer is not approaching the review process properly. It's supposed to be a constructive criticism process where knowledge is transferred, not a negative penal process where the programmer being reviewed is made to feel insignificant. This negates a lot of the good that can come from a review.
    – Mattygabe
    Commented Nov 17, 2012 at 17:34
69

Don't take pride in how well you code. Take pride in how well you learn. Then learning that your code needs improvement provides you with an opportunity to demonstrate how good you are at learning, instead of coming across as criticism of how bad a programmer you are.

Read http://www.perlmonks.org/?node_id=270083 if you have no idea what I'm talking about.

6
  • nice article. :) so i'm just dealing with my ego.
    – newbie
    Commented Nov 17, 2012 at 2:13
  • 2
    @newbie Exactly. When you receive criticism of your code, it can only upset you if your ego is tied up in the quality of that code. Divorce your ego from the code, and the problem goes away.
    – btilly
    Commented Nov 17, 2012 at 2:42
  • 5
    I agree in taking pride in how well you learn, but you should also take pride in how you code. If you aren't proud of how you code you won't be driven to become better. Commented Nov 17, 2012 at 16:45
  • 1
    And you should also be careful about taking pride in learning as this can lead to the same problems if you're actually not that good at learning.
    – Nico Burns
    Commented Nov 18, 2012 at 22:45
  • I thought that pride was one of the 7 deadly sins? What is up with everyone recommending it these days? How about just feeling content that you did a good job.
    – user251748
    Commented May 24, 2017 at 14:53
40

After 20+ years I know that some of my own code is still a mess. What it comes down to is making a decision between writing the best possible code versus writing what's required to get the job done. Getting the job done within an agreed timeframe trumps the never-ending quest for technical perfection any day.

The trick is to learn to accept it. Learn to accept that you could do better. Learn to live with the flaws. Learn to accept that you're not going to get it perfect this time, and probably the next time too, and that it's a deliberate choice because the alternative is not delivering. And that's worse.

Disclaimer: none of this should be read as "bad code is OK".

7
  • 3
    Striving for "getting the job done" is striving for mediocre. You are correct, it works and can be effective -- just look at Chinese products. But striving to make things great is what makes 20 years of programming worth while friend. Look back on 20 years, what does it reveal -- getting the job done or getting the job done with pride?
    – kingdango
    Commented Nov 17, 2012 at 19:02
  • 9
    It's always about "getting the job done" unless you're writing some sort of weird code-based art project. Writing "good code" vs. "mediocre code" is a trade-off between completing the immediate task and making the code more maintainable to get the job done in the future. Ignoring this leads to perfectionism, which leads to not getting anything done. Mediocre code written quickly is better than good code written slowly for a one-off script.
    – user53141
    Commented Nov 17, 2012 at 20:46
  • 8
    Like monetary debts, technical debt soon mounts up and learning how to manage technical debt is one of the primary skills of a programmer in the real world. Anyone who has enough time to do a perfect job every time is either unbelievably good, seriously under worked, or deluding themselves.
    – Mark Booth
    Commented Nov 17, 2012 at 23:10
  • 1
    Striking the right balance can be hard, especially since the effects of going ahead with a mediocre design are often much more visible than those of spending too much time refining a design when a mediocre one would have been proved perfectly adequate throughout its useful lifetime.
    – supercat
    Commented Nov 17, 2012 at 23:37
  • 2
    This really saddens me as "getting the job done" and "technical perfection" don't need to be the worlds apart that you portray. Personally, I don't take a great deal of satisfaction for a piece of code of mine that has been released that is entirely shonky and is in that way because of time constraints and, as you put it, to "get the job done".
    – crmpicco
    Commented Nov 21, 2012 at 15:13
40

Everybody's code is a mess and there are no good programmers.

There are:

  • programmers that ship fast,
  • programmers that always ship semantically correct code,
  • programmers that always come up with the optimal solution, and the fastest algorithm,
  • programmers whose code is easy on the eye.

They hardly, if ever, end up being the same person.

And there are butthurt programmers that need to grow up and:

  • ask what's wrong,
  • take no comment personally, as a measure of their worth as a human being;
  • realize there are syntax guidelines in teams, and they gotta be followed, and they are arbitrary, so they're not meant to be discussed ad nauseam, as there is no optimal solution, nor final word;
  • get better at commenting their code;
  • get better at commenting their code; (sic)
  • find easier to debug, less clever, solutions to simple, mundane, tasks;
  • take a class in SQL
    (I'd send half of this world's population to take a class in SQL, just to be on the safe side)

It's not art, it's a craft.
We give for granted you're clever: you're programming computers, goddamit.
Still AMD64 and x86 are not compelled by the power of your prose. Keep things simple.

3
  • 3
    Literally laughing out loud. so good. roflcopters
    – kingdango
    Commented Nov 17, 2012 at 19:11
  • 1
    AMD64 and x86 are not compelled by the power of your prose. - totally awesome.
    – Sam Brinck
    Commented Nov 19, 2012 at 18:56
  • +1 for take a class in SQL
    – HLGEM
    Commented Nov 19, 2012 at 20:19
28

Well, a person saying your code is a mess is not constructive, even if they're right. Did they give you reasons why it's a mess? Like, methods are too long, responsibilities mixed together, too much branching, etc. Honestly, any code I wrote a year ago I would say is complete crap because I've learned a ton since then. So don't feel bad about it. I would be more worried if you still liked reading the code you wrote that long ago.

The cleaner your code-base is, the less time you spend on fighting the code-base to solve a given problem. A year is a great point to be at because you can feel the pains of any design decisions you made earlier in the project.

On my current project, we've refactored several times as we got more comfortable with our technology stack. This should be encouraged and you should make note of tasks that take longer than they should because of present code-base.

Have you gone over some of the older parts of the code you wrote? You can probably see things you'd want to do differently now or refactor.

Also when you mention a lack of testing, this is always something to look at. On our project we had no automated testing and as a result a lot of highly coupled code. Even if you don't write unit/integration/whatever tests regularly, doing it for a little while will get you in the habit of making your code more modular (and consequently, less of a mess).

26

I feel so sad and hurt. I really love programming and making them say something like that really hurts me. I really want to improve myself.

That is good. That is a lot better than having a reaction like "my reviewer has no idea what he is talking about", "my reviewer is too picky" or just "my reviewer doesn't like me" and ignoring them. This attitude is a good thing.

But it seems like I'm not a genius programmer like in the movies.

Not sure what kind of movies you watch, but 90% of the programmers in the movies are so fake I have tears by the end of the sequence.

Can you give me advise on how to be better?

Read and practise. Check out books like Code Complete or The Pragmatic Programmer. Look on Amazon for similar books.

Have you ever experience something criticizing your code and you feel really hurt? What do you do on those events..

Why do you feel hurt? I feel disappointed in myself for being such a moron in the first place. I use that motivation to clean up my code and make sure I don't make the same mistake again. The last thing I want to do it not learn from it. You have been put down once, don't let it happen again for the same reason.

No programmer is born perfect, or even close. The more code your write, the more reviews you get and reviews you provide, will make you an all-round better programmer.

3
  • 2
    +1 for piecing it together and for reviews you provide because being critical of others can be important practice in getting better at being critical of your own code to turn out better quality. Commented Nov 17, 2012 at 2:14
  • 2
    "90% of the programmers in the movies are so fake I have tears by the end of the sequence." 90%? What movies do you watch? :P I haven't seen one movie that accurately depicts what it is we do. And then there were "Swordfish" and "Independence Day"... Commented Nov 17, 2012 at 5:26
  • Well put and succinctly so!
    – kingdango
    Commented Nov 17, 2012 at 19:03
16

One of the best things to me about being a developer is that every day is a learning process. There will always be someone out there who doesn't know something which you do, and there will always be someone who knows something which you don't. I certainly wouldn't consider myself to be anywhere but at an entry/junior level, but I appreciate any criticism I can get as long as it is both justified and given with respect.

An analogy that might be fitting relates to a time period in which I was a writing tutor at a university, as well as when I took part in creative writing courses. Writing code, for all intents and purposes, is much like writing a poem, essay, short story, or novel. Each individual has their own way of going about doing it, but at the same time, even the best writers (or, in this case, developers) make mistakes or let things slip through the cracks. We can often fail to notice these things because we become so used to our own voice (or again, in this case, style of code).

Much like in any field, there are those who are considered to be experts. If those people didn't exist, we wouldn't have anyone to learn from. Assuming this individual in question is truly an expert, I would listen to what he says and ask what he would suggest you do to improve upon your code. Never forget, though, that he is not the only one who can give his assistance; we have the good fortune that a plethora of resources such as SE/SO exist.

3
  • 9
    "There will always be someone out there who doesn't know something which you do, and there will always be someone who knows something which you don't" - awesome; +1. Commented Nov 17, 2012 at 1:48
  • Yeah, and i want to learn everything I can
    – newbie
    Commented Nov 17, 2012 at 2:08
  • @mh: I would add that a wise person will generally learn much more from being wrong than from being right. That's not to say that one should try to be wrong about things, but rather than one should not be discouraged about it provided one takes advantage of the chance to learn.
    – supercat
    Commented Nov 17, 2012 at 23:39
10

Mess is rather subjective. The best thing you can do is to actually ask that person (or the review report): why is it messy? (from their point of view, that is)

They're bound to answer you and you'll be able to either:

  • Argument against it (if you have a good reason to do so, of course)
  • Feel very happy, because you just learned something new and your future code is bound to be more awesome since you now know how to make it less messy thanks to their advice.
10
  • He did not comment :( But here's my code -> codereview.stackexchange.com/questions/18719/…
    – newbie
    Commented Nov 17, 2012 at 1:48
  • why do you think it is messy?
    – newbie
    Commented Nov 17, 2012 at 1:49
  • 7
    @newbie: Then that reviewer isn't very good. How is a coder supposed to improve something without knowing what the problem is (not even a clue!)?
    – Saturn
    Commented Nov 17, 2012 at 1:51
  • 1
    Okay thank you... I'm not a jquery programmer either. I'm a java programmer....
    – newbie
    Commented Nov 17, 2012 at 1:56
  • 1
    Only my code is available to him that time. Anyway, you're right, i'll ask for more details about it. Thank you :)
    – newbie
    Commented Nov 17, 2012 at 2:14
8

The fact that you're concerned is a good sign. Let's start with that. You mention you love to program, but do you love being a professional programmer? There's a big difference between an enthusiast and a professional. As a professional you will be under constant scrutiny for your work product.

Our team is composed of 5 programmers, and 4 of us are new

The fact that you've worked two years without any confrontation tells me that you're working in a very laid-back job which, is not so good if you're actually wanting to move forward as a professional. Mind you, some of the best programmers in the world work for the Linux foundation and be rest assured they do not get treated kindly when they make marginal mistakes ... much less 'messy code'.

For a quick review of some fairly standard coding guidelines, the Linux Community Contributors Standards should give you an idea of the level of responsibility to aspire towards for your product. Refer to GETTING THE CODE RIGHT.

To further that assertion you should learn to embrace review as most good software is thoroughly reviewed. This supports Linus' Law stating ...

"If there are enough reviewers, all problems are easy to solve."

Personally, I've seen highly skilled, responsible and dependable developers get the axe for something as simple as forgetting to leave comments ... so if someone tells you your codes a mess then it probably is ... Get over it ... Refactoring. It's part of the gig.

I feel so sad and hurt. 

Go make a sadness application to gauge how upset you get when you don't apply yourself.

You answered your problem ... You Don't Test!

After seeing a comment you made stating that your a java developer, I almost got upset. So if I understand you correctly your saying that you and your development team are working in a java shop and don't have a test framework for your applications ...

Therein Lies The Rub

"We deployed our program to the program without thorough testing."

Cribbing UML Creator Grady Booch ...

The amateur software engineer is always in search of magic, some sensational method or tool whose application promises to render software development trivial. It is the mark of the professional software engineer to know that no such panacea exists.

Alistair Cockburn provides a wealth of information on his site on using agile methodologies to increase performance and quality for you and your team.

One of the most important aspects of programming {and life} is knowing your strengths and weaknesses. If you don't work on your weaknesses you will not have a well-rounded skill-set.

Outro ... Your doing fine - Just don't whine. Move forward in developing your craft and let your passion for programming keep you going. Good Luck :-)

5

Don't let your emotions get in the way of improving your code. The goal of a code review is to find problems, so you shouldn't be too surprised if there are some. That said, they aren't supposed to be a coder-bashing session either.

They also shouldn't be just saying 'Ewwww' and leaving it at that. There is always a reason why something is wrong in programming. For instance, it's wrong to leave lots of commented-out code all over the place, but it's wrong because it clutters up the code and makes it harder to read, not because somebody said so in a book.

Your code is not you. Remember that.

4

I'm going to be the dick here and advise on the basis of.. well, the obvious. Obviously, your code IS a mess or the question you'd be asking is "WHY is somebody saying my code is a mess?" But you're not challenging the supposition. You're just acting hurt and quite frankly there might be crying but there's no feeling when it comes down to justifying programming.

But really, why are you asking? You know your code sucks or you'd be asking a different question. If somebody told me my back-end web code stank, I'd laugh and say "okay what's wrong with it?" If they told me my JavaScript stank, I'd give them the social programmer equivalent of a fat lip and I'd never ask for advice on how to react because the little bitches are clearly !@#$ing wrong.

Own what you're good at. And I really mean take responsibility for it. because it only takes one goof for some twit to second-guess you. Don't ask permission to be good. Just know your stuff. The end.

2
  • Amen. And knowing your stuff takes... well... effort to ensure you know your stuff. But be sure to also pop your collar, that's what all the elite kids are doing these days. :/
    – kingdango
    Commented Nov 17, 2012 at 19:10
  • Yeah, I think I just gave advice elsewhere on the more experienced devs being the first to admit they're wrong. I can haz multiple personalities. Commented Sep 4, 2013 at 15:44
4

Remember this: The worst code you will ever see is your own!

Jeff Atwood of codinghorror.com wrote alot about the topic, you might want to start here: http://www.codinghorror.com/blog/2009/07/nobody-hates-software-more-than-software-developers.html

If you want to improve, start to read stuff about coding style, patterns, workflows, basically everything you can get your fingers on. Also learn more programming languages, see how they do stuff. If you are doing OOP, read this: http://en.wikipedia.org/wiki/Design_Patterns

Also talk to other programmers and do pair programming or watch others code.

Making mistakes is unavoidable, repeating them is.

1
  • Its a good sentiment (mine favourite is related in that I always start by assuming that the issue with an application is my fault) but regretably it turns out that no, the worst code you'll ever see may well not be your own... not if you're smart enough to be here and to ask about it in the first place...
    – Murph
    Commented Nov 19, 2012 at 18:47
4

Most of the time you should say "Thank You" to the person that told you this.

Chances are that they care about their profession, they care about their work, they care about their team and they care about you.

It can be hard to take criticism. Don't get mad about it. Think about what they are trying to tell you and don't let your emotions get the better of you.

I've been programming for a long time (30 years) and my style and code is improving all the time (I hope). The only way that I know its improving is when other people tell me or if I go back and review my code.

Try looking at code you wrote at the start of your career. What does it look like to you now? Does it look as good as you thought it did when you wrote it ;)

4

First off someone saying your code is a mess is very vague and subjective. It can mean different things to different people. Here's why; there are two different things that have to be considered.

Structure

The structure of your code is governed by the language, industry standards, and company standards to name a few. Obviously there are other factors as well.

These are the types of mistakes that lint, test tools, and similar products are designed to identify. They are well defined and you or your tools can make objective decisions as to their validity/correctness.

Style

Despite standardized structure/rules for code, every developer has a certain style in the way they write and approach a problem or task. Do code maintenance in any team environment and over time you'll be able to take an educated guess as to who wrote the code based on the style. You'll also develop your own style and it will change as you gain experience and learn your craft.

So any time that someone says your code is a mess you need to understand if they are talking about the structure or the style. They are two very different things; structure is objective while style is absolutely subjective.

That being said, any constructive feedback from other programmers can be very valuable to you. It's all up to you and how you take the criticism. Over time you'll learn who's opinion to take to heart versus who's to take with a grain of salt.

As you progress in your career you'll look back at your own code and see things that you could do differently, better, cleaner, and faster. It's all part of the learning process and seeing your own past mistakes is a true indication that you are honing and improving your craft.

Don't let a bit of criticism dampen your spirits. Take what you can from it and if it's meaningful and valuable add it to your store of knowledge.

3

First of all, you must understand that programming is an iterative process, much like writing an article or a book. First you write a "rough draft" of your program, just to get it to work. At this stage, your code will be a mess. So you refactor to make the code clean. Then you profile and see what you need to optimize to make it fast. The trick is to refactor continuously, otherwise the mess will grow. You have to clean your code regularly, just like you have to clean your house.

Code reviews are absolutely essential. You must have your code looked at by at least one other pair of eyes. When you spend countless hours looking at your code, you get used to it, and you can easily miss a bug or a code smell that your coworker might notice instantly.

Also, the act of explaining your code to someone else is a great way to see if you have missed anything. This is like reading a paper you are writing out loud. Your brain processes audio and visual information in different ways, and you can find flaws in your reasoning by switching modality. Also, if you explain your code to a coworker, and something does not make sense to her, that is a good indication that you should refactor your code.

When doing a code review it is very important for both the author and the reviewer to check their egos at the door. The goal is to make the code better. So the reviewer must be respectful, and the author must keep an open mind. Remember, your co-workers are the ones who will have to maintain your code, so it must be clear to them. If the reviewer does not understand what a variable does, rename it. If the reviewer can't understand what a block of code does, refactor it into a function with a descriptive name. Irrespective of what you may think, if your co-workers cannot understand your code, it is not good.

Speaking of refactoring, you absolutely must have a unit test framework, because without it, you cannot refactor.

Finally, I highly recommend reading "Clean Code" by Robert C. Martin. It will tell you why your code is a mess, and what you can do to clean it up.

3

Can you give me advise on how to be better?

Jay's answer which recommends books is a good one, however it sounds like you're at a turning point at work already.

Past:

Our team is composed of 5 programmers, and 4 of us are new, 1 has more than 3 year experience. We've been working for a program for almost a year now and nobody ever review my code and I was given a page to work with.

Present:

Now it is tight and we need an approval and code review first before we make changes with the code.

It sounds like your company/team/department is learning as whole, in terms of project and team management as well as programming. Starting to review code is an excellent opportunity to improve in pretty much all areas if it's given proper attention.

Use this as an opportunity; assuming you're doing peer reviews (with the other developers on your team) suggest to them that this process is important and that everyone can learn from it.

At the base line it will be a quick review with the outcome being "yeah looks ok". With a little more focused effort you can bounce ideas off of each other, "yeah that works, but you could have approached it in this way, which would have made your goal clearer...". Take notes for future even if the code is deemed ok to deploy.

If this is going to be successful, you need to get your team and manager on side, which often means explaining the benefits to them. To the other developers this is an opportunity to learn. To your manager this is the opportunity to up-skill the team at little cost, therefore creating outputs a) with more value or b) faster c) with less maintenance cost (usually a big issue!).

This is a culture change, which you can't force through by yourself, but you can help to nudge things in the right direction!

Don't forget, this is kind of culture change can be hugely beneficial to organisations; good managers will recognise that you're working to make the whole team better, something worth rewarding.

3

Can you give me advise on how to be better? Have you ever experience something criticizing your code and you feel really hurt? What do you do on those events.

The answer to this can be found in the new generation companies. I have been to companies like Google and FaceBook and I see that if you follow Agile/Scrum process religiously, then you can write better code and improve it every sprint.

How to be better? 

The answer is continuous refactoring. The modern development tools like visual studio has lot of tools that helps you in this process. If you follow Scrum software development process, then say for ex, you wrote bad code in sprint cycle 1 and someone pointed out during review it's bad, then in sprint 2, you have the opportunity to refactor the code.

These issues are occurring in the first place because of lack of good process. So the solution is to come up with a good software development process for your team and practice continuous refactoring.

3

I would thank them for the feedback, and then ask them to explain what makes it bad and how it should be improved.

If you agree the person giving the feedback is making sense, consider making changes in the future. But remember, just because someone says it doesn't mean it is true.

Can you give specific examples of what has been called "a mess" ?

1
  • Feelings can sometimes be difficult, but this is certainly how I hope I would react. Commented Nov 19, 2012 at 6:37
3

While it is important to recognize when your own code is a mess (very typical feeling among programmers, especially as they become more experienced and their earlier code ages) it is even more important to listen when other people tell you so.

There are only so many issues you can recognize in your own code, since it was produced in constraints of your current programming knowledge.

Code review is essential learning opportunity because it likely exposes you to new knowledge that you didn't have while working on the code (otherwise you would use it and there would be no mess).

I think there are two parts to processing negative feedback.

1. Determine nature of raised issue(s) and what you should learn from it

When I review or have my code reviewed I sort information about code issues in roughly such buckets:

  • violates hard technological requirements
    • plain wrong (does not function or perform to requirements)
    • will fail in other circumstances (environment/configuration change)
    • uses deprecated functionality and will break in foreseeable future
  • violates industry best practice, lacking in things such as
    • using proven approach to specific problem
    • performance
    • backwards compatibility
    • ease of maintenance
    • coding style
    • documentation
  • violates workplace best practice
    • same as industry, but more specific to company/colleagues and can differ from industry in details
  • not in line with personal expertise
    • can be improved in some way, in opinion of person reviewing

Note that this ranges from very objective things ("this will break when deployed to our production server") to very subjective things ("I don't like how you named variables").

2. Determine which (if any) changes to the code will be made as outcome of review

After information is processed there comes decision if it is actionable and if code should be changed. This is not necessarily your decision, your opinion might or might not matter depending on parties involved and specifics of your situation (seniority, etc). But possible outcomes roughly are:

  • address issue in full
    • fix broken
    • format to required coding style
    • and so on
  • come to compromise if issue should be addressed at all or partially, since there might be
    • no resources (such as time or budget)
    • no need (will only achieve insignificant improvement, compromise stability, etc)
  • come to understanding that raised issue is invalid
    • feedback (especially from subjective opinion category) can very well be outright harmful and should not be acted on blindly

You've learned that it feels painful to get negative feedback and it very well might be painful every time in the future. However you have left learn how it is important learning opportunity and how the process helps you to improve professionally and your workplace to achieve better code base.

1

Well don't feel broken. Eventually you will learn from the mistakes. Once you are done with the issue you can talk to guy so it makes him feel that you want to improve. Try to listen more and argue less.

I have been through this situation and I can understand.

0

TL;DR

How would you react if someone told you your code is a mess?


My straightforward, "too long didn't read (all the answers - apologies, I will hopefully find time to later and edit/amend this if necessary)" answer/tip:

  • Good old Peer Review. Ask different crews with different collective mentalities, expertise levels and/or levels of aggressiveness to review your code.
  • Just to elaborate a bit on what I mean by "different" peer groups: the StackExchange diaspora is probably the most clued up, professional and esteemed group because of the relative difficulty in becoming part of it compared to, say, Reddit. Reddit tends to be very aggressive in the more popular sub-reddits - but strangely enough the programming subreddits are quite friendly (from what I have experienced).

A good, perhaps the best, example of the aggressive, gangsta type of clique mentality are the XDK Forums crowd, and the worst of the worst trophy I hand to the CyanogenMod for Android forums/IRC channel populace.

That was a bit longer than I intended; my point was supposed to be - get varied reviews, but focus on getting honest critique from the people that know their trade, and know what constructive criticism is. Oh, and be able to take any form of criticism without letting it get you down. Rule of thumb: if you start to hear similar commentary pertaining to a thing that can be mutual to the comments, then do some more thorough introspection.

Not the answer you're looking for? Browse other questions tagged or ask your own question.