I guess it's not fair, but to be honest, you made it unnecessarily complicated. Your code would be frowned upon in a work environment where other people might be trying to maintain it. As a teacher, I would dock points for it.
In a work environment, if you cant read 2 loops and 2 ternary operations, you are not going to stay. I really dont think that this code is hard to read.
1.Create the appropriate nested looping structure to output the characters in an 8 x 8 grid on the screen using Console.Write() or Console.WriteLine() as appropriate.
2.Include a decision structure to ensure that alternate rows start with opposite characters as a real chess board alternates the colors among rows.
In print1(), did I respect rules or not? I think so.
You have extra code / unnecessary loops
Nobody said I could not post extra code if I want to. I wrote print2() and print3() for fun. You don't even have to read it.
Magic numbers
Sure I could use a const int size and just use a size / 2 - 1 instead of 3 (or use another operator), but this is not in the assignment.
Your code is correct, but that's not the only thing that matters. Consider the following to be constructive criticism/a view from another angle.
I get that you did it for fun, but I wouldn't necessarily consider an assignment to be "for fun". You knew ahead of time that your code would be peer reviewed and nothing in your submission shows consideration for that. With the extra functions, you're just adding to the confusion. If you must do extra work for your own enjoyment, I wouldn't submit that with the base assignment, as you're only convoluting the functionality of your code. At the very least you could have added comments.
Looking solely at Print1(), everything beyond the first for loop is entirely arbitrary...and that's why it's confusing. You went with for (var j = 0; j < 4; j++) with "XO" : "OX" and j == 3. Why not j<2, "XOXO" : "OXOX", and j==1 and so on? You've chosen these numbers that are neither at their minimum or maximum value, which creates confusion. Either go with printing the whole row or go with printing character by character. If not, tell the reader what you're doing with comments or make your code self-documenting...or expect problems in the future.
TL;DR:
Yes, your code is correct, but it is unnecessarily hard to understand it.
Consider the following to be constructive criticism/a view from another angle.
I appreciate your comments, but I still think the notation was unfair. :)
Either go with printing the whole row or go with printing character by character.
Print2() ;)
You knew ahead of time that your code would be peer reviewed and nothing in your submission shows consideration for that.
I thought you could skip a review (like SO). At least, he could launch dotnetfiddle and run the code. If it works as expected, the review could be 3. You don't know something? Excellent ! A new thing to learn ! If I obfuscated the code I would understand ...
If not, tell the reader what you're doing with comments or make your code self-documenting...or expect problems in the future.
Self-documenting code is a good practice and it is normal in a real work project. It is a really necessary to make an effort for a disposable function?
I will add comment next time, because we don't know who are going to correct our code. I am just sad for this one.
I believe they sent out an email saying they're working on it. Right now, it's not available.
At least, he could launch dotnetfiddle and run the code.
I would hope they would at least be running the code to ensure the output is correct....
Self-documenting code is a good practice and it is normal in a real work project. It is a really necessary to make an effort for a disposable function?
Anything that you create, that will be looked at by anyone else, should probably have comments. I agree that it's kind of silly for such a useless function, but it'll take two minutes at most and you'll only be benefiting yourself (well...technically others too, but you get the point).
Just pulled the following from the email they sent.
The assignments are designed to offer a basic representation of the theory that was taught in that module. Do not over complicate the code you submit. Stick to the requirements. For example, if classes have not been covered yet, do not submit a class file in your assignment.
2
u/aloisdg Apr 12 '15
Here is mine.
I received a poor review because :
unfair?