code-review

From a Management POV: How much is a code review worth?

It's obvious to me that code reviews (peer reviews) improve the quality of the generated code. I've worked hand to hand in some code with some of my coworkers and, specially with some of them, code was cleaner and a lot better. Reviewing other people code is not the same thing. You're not familiar with the code, you haven't made the vas...

What IDE lets me view diffs as highlighting on my code?

EDIT: Primarily, talking about code written in C. Someone sends me a diff to review and I know I can take the "before" code, apply the diff (patch) to get proposed "after" code, and open both, pair of files by pair of files, in a difference viewer (e.g. WinMerge, Araxis Merge, etc.) to review the change. On the other hand, if I want to...

Cleaner way to translate index into specified string?

Could I achieve this in a more cleaner way? Would be really appricated. switch($vocation) { case 1: $vocation = "Sorcerer"; break; case 2: $vocation = "Druid"; break; case 3: $vocation = "Paladin"; break; case 4: $vocation = "Knight"; break; case 5: $vocation = "Master Sorcere...

Is this a clear use of goto?

Hi All, Just wondering if this is considered a clear use of goto in C#: IDatabase database = null; LoadDatabase: try { database = databaseLoader.LoadDatabase(); } catch(DatabaseLoaderException e) { var connector = _userInteractor.GetDatabaseConnector(); if(connector == null) throw new ConfigException("Could not load the database ...

Java Code Review: Merge sorted lists into a single sorted list

I want to merge sorted lists into a single list. How is this solution? I believe it runs in O(n) time. Any glaring flaws, inefficiencies, or stylistic issues? I don't really like the idiom of setting a flag for "this is the first iteration" and using it to make sure "lowest" has a default value. Is there a better way around that? publi...

How to find empty catch blocks in Java code

Hi, is there any way to find out all the empty catch blocks inside Java code. I know there are some tools like PMD to do that, but i am using RSA, is there any way we can write a regex to search for empty catch blocks? Update: i am working on a corporate machine where i cant install new softwares :( ...

Where will the result will be stored? after executing PMD

Hi I am using PMD to do code-review for my application. I am able to do the review, but i dont have a clue where the report will be stored. i am using this cmd "C:\PMD test\Source>java -jar pmd-4.2.5/lib/pmd-4.2.5.jar JavaSource\com\ex\app html basic" in command prompt. it is displaying the entire result in the command window, is there...

Class Identifier used inside the class declaration. Is it a good practice?

While reviewing one of our C++ class through coverity, it showed an error message on a particular class. The class is as follows: class InputRecord { /* Construtor */ ... InputRecord::RejectRecord(); ... /* Destructor */ } What is the significance of using an identifier inside the class? Is it a good practice to fo...

Java Code Review: Generate a subgraph

I'm using JGraphT and I want to generate a subgraph, like this: If there's a graph like {stuff -> a -> b -> stuff}, and you ask for the subgraph in direction of {a -> b}, you'll get {a -> b -> stuff}. (stuff = collection of nodes and edges, -> = an edge, a and b are nodes.) My idea is as follows: if the start is A, and the sink is B, r...

Java: Code Review: Binary Search

I wrote this for self education. How does it look? (It passes all my junit tests.) /** * find needle in haystack * @param haystack a sorted list * @param needle * @return i such that <code>haystack[i] == needle</code>, or -1 if it is not found */ public static int find(char[] haystack, char needle) { int minWindow = 0; // lower ...

Code review: Determining whether a folder exists, given the full file path?

With a function being passed a full path to a file, such as C:\someFolder\anotherFolder\someXML.xml, determine whether the folder exists. Is there a smarter/better/more elegant way of doing this? Here is my implementation: Private Function FolderExists(ByVal fullPath As String) As Boolean Dim folders() As String = fullPath.Split("...

How to help a struggling newbie do a better job?

I have been the only developer and the de-facto "senior developer" on my company's flagship product for a while (a .NET WinForms app, but that is not related). Just recently, they brought in a "newbie" developer with a fresh computer science degree. No experience with source control, unit testing, software maintenance, etc. I recently ...

Code review please: a Java program that displays an XML file with 30000+ terms in a JTree.

I am hunting for a job and one of the companies that I interviewed with asked me to write a little test program so that they could test my programming abilities. I am a biologist by training, and most of my programming knowledge I gain by autodidactic means. I am also more comfortable writing Python then Java. This is the brief I was g...

How to get free impartial code reviews / advice?

Hello, I haven't been able to find this question here so here goes. Is there any website / service that offers free (or at least cheap) code reviews? There must be lots of people that write applications in their free time, to learn new skills and also as a recreational activity, how can these people ever know if they are doing somethi...

Is this a proper use of the asynchronous cababilities of the Socket class?

/// <summary></summary> private Byte[] _ReceiveBytes(Int32 size) { MemoryStream memory = null; SocketAsyncEventArgs args = null; EventHandler<SocketAsyncEventArgs> completed = null; Exception exception = null; Int32 last_update = Environment.TickCount; Boolean finished = false; Int32 count = 0; Int32 rec...

"Live" Changelogging for CVS-Comments?

Hello, My problem is that i often forgot what i have changed in my software, when i do a cvs-check in. So i have to lookup my code for changes. If this could be automated, it would be great. So can anyone tell me if there is a tool or something which can lookup my code (i'm using c#) for specific comments, that i add if i change someth...

Things to remember while doing code review of Stored Procedures in SQL Server

What do you guys look for when you are doing a code review from performance prospective. When i do it I look for the following things 1) Use NOLOCK when doing select so that table is not locked. 2) Prefix dbo. before a table name. 3) Use table variables instead of temp tables when dealing with less data 4) Avoid cursors, use while lo...

Code review tool for Aptana and Tortoise?

Hi, I've seen some links on this topic, but none with our situation: http://stackoverflow.com/questions/49906/best-tools-for-code-reviews We use Aptana for coding and deployment, and Tortoise to put things back into SVN hosted by Unfuddle. I'd like a simple way to do remote, asynchronous code-review -- basically going through checked ...

Comparing Doubles in Visual Studio - a standard way to catch this?

Folks, Even experienced programmers write C# code like this sometimes: double x = 2.5; double y = 3; if (x + 0.5 == 3) { // this will never be executed } Basically, it's common knowledge that two doubles (or floats) can never be precisely equal to each other, because of the way the computer handles floating point arithmetic. ...

Developers checking in non-conforming code

Consider a situation where a group of developers work independently(more or less) on projects. The dept. has a published standard to ensure code quality on issues like: no inline/embedded/dynamic SQL statements (hand coded by the developer) naming conventions more Question How would you set about enforcing the code quality rules? Ar...