Everyone needs a code review

I’ve been writing code for a long time and now that I’m an Architect at my company, people look at me funny when I ask them to review my code. Many folks think that I don’t need code reviews.

My feeling on the matter is that everyone needs a code review. Code reviews don’t have to be long formal meetings with code printouts and red pens to mark all the issues. A simple peer review before checking your changes into the Source Control System may be all that is needed in many cases.

Here’s a recent example of a quick change I made to code and pushed through to production. It was such a small change that I didn’t think to get it reviewed. Now, I wish I had as we’re having to make an off-cycle release of the code to fix the bug that I introduced. Continue reading Everyone needs a code review

Enable Remote Debugging in OC4J

I found a simple way to enable Remote Debugging in OC4J stand-alone version 10.1.3. I assume it will work on other versions.

I was looking at the startup script (oc4j.cmd on Windows) that is found in the bin directory of your OC4J install. I was looking for where exactly to add the necessary startup options in the script to enable remote debugging.

I found that the script reads from an environment variable OC4J_JVM_ARGS to look for additional startup parameters.

Rather than muck about with the canned startup script, I simply created an environment variable OC4J_JVM_ARGS which contains the following value:

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4000

This was picked up by OC4J and the container launched with remote debugging enabled on port 4000.

Now, I want to be able to easily turn remote debugging on and off, but I don’t want to have to remember the pesky parameters every time, so I took another step.

I created a second Environment Variable OC4J_DEBUG with the value set to

-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=4000

I then changed the OC4J_JVM_ARGS parameter to contain a value of %OC4J_DEBUG%

Now to turn debugging on and off, I simply modify the value of OC4J_JVM_ARGS and add or remove my %OC4J_DEBUG% variable. It’s less typing and easier to remember.