Article Info

Introduction

I am a developer that has been writing, studying and reviewing PL/SQL for 7 years. In this article I am going to relay my opinion on the starting points to writing effective PL/SQL and I will also provide some resources that are beneficial to both beginners and experts.

Your Attitude Towards Writing Code

I really believe how well you code depends on your attitude. If you look at coding as just a job and something you do to make money, pay bills and pass time away, you're probably in the wrong profession or coding is not for you. Some of the best developers I have known are quite opposite from what I described above. How does this apply to me? Well, in my case, I had the desire to become a programmer and one of the best at that. As I came up reviewing PL/SQL from what would be considered senior developers, my head use to spin and I'd think to myself "I'll never write code LIKE THAT". My attitude since then has been that I wanted to be the one writing the code because I really believed I could make a difference and provide patterns and practices for other developers to follow for years to come.

Code Efficiency

A habit of some of the best developers is ensuring their code being written is as efficient as possible. When you think of efficiency, the first thing that comes to mind might be resource constraints on a piece of hardware your program is running on (ie. memory utilization, disk reads/writes, disk space). However, efficiency can also mean writing less code; not in the sense of trying to condense a bunch of code to fit onto the screen at once and call it efficient, but in the sense of encapsulating code and removing unnecessary/unused code.

Reviewing Your Code

Yes, there are concepts such as peer review or even a more formal code review where you are put on the spot to present your code to a group of people. You can take away the anxiety from any type of review as long as you go a long way to review your own code. Some of my best code comes from self-review because I critique my code just as much the code I review for another developer. It's not fair for me to push high standards onto others and yet not expect myself to meet those same high standards. Even if your organization does not have a code review process, when writing code, think to yourself, "would I be happy with this code if it was not mine"?

Are We Still Talking About Code Here?

Yes, this article is still focused on writing good PL/SQL. Although as I have described, writing good code is first a matter of having the right mindset to do so.

Most code reviews end in failure because of the few things I listed above regarding code reviews. Sure, an organization will dictate standards for you to follow, but I would think most of the time very few of these have anything to do with efficiency. Therefore, you need to apply the non-format related standards to your code because nobody else may do that for you.

Where To Begin

If you have been writing PL/SQL for 1+ years and you have not yet heard of Tom Kyte or Steven Feuerstein, then it's a good thing you are reading this article. Tom and Steven are the most well-known/trusted Oracle resources alive. Tom is most infamous for his website, http://asktom.oracle.com, in which he responds to just about every single Oracle related question posted to his site, free of charge. Next is my favorite, Steven Feuerstein. Steven is known for his books related to PL/SQL patterns and practices; his books are where a lot of my own standards come from.

Another very helpful resource for coming closer to the Oracle community and learning about upcoming Oracle enhancements is known to me as NEOOUG (North East Ohio Oracle Users Group). This I'm sure will differ by state/city, but the presentations are most likely similar and very beneficial. These events provide you an opportunity to learn from the best first-hand and even ask them questions. Events like these are also good for networking with (former) co-workers. A flavor of this group is known as IOUG (International Oracle Users Group) whom every year choose a city in which to host a huge convention of presentations and etc. If you ever have the opportunity to attend one of these events, I highly recommend it. Also, your company will most likely even pay for you to go depending on the organization.

Additionally, Google is another method that can be used to look up others approaches to tough problems. I have had multiple times in my career where I wondered if there was an easier way to write some code or a more efficient way to write a query and when I end up stuck, I end up asking those around me for advice or head to Google.

To Be Continued

Refer to the article, Writing Expert Oracle PL/SQL - Part 2, where I will go into more detail regarding my opinions on writing expert Oracle PL/SQL.

Reviews

You must be logged in to submit a review.