O'Reilly logo

Oracle PL/SQL Best Practices, 2nd Edition by Steven Feuerstein

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8. Playing with Blocks (of Code)

One of my greatest joys as a dad with a young child was to play blocks with my son, Eli. I very much enjoyed taking individual pieces of plastic or wood, and combining them together to create all sorts of structures. I think Eli did, too, but it is entirely possible that I was often the more excited of the two of us at making that tall, slim, stable tower (he was delighted more by knocking it down!).

What I have come to realize over the years is that writing software has many parallels to playing with blocks.

Applications are extremely complicated constructions, and this fact should come as no surprise. After all, an application is our attempt to capture a small slice of reality inside our virtual world of cyberspace, and the real world is incredibly complex (and always changing).

Furthermore, our brains can keep track of only so much information at once. And that's why languages like PL/SQL allow us to build named subprograms (procedures and functions), and even group those elements together into packages and object types. Rather than write big blobs of spaghetti code that go on and on for thousands of lines, we can create smaller units of logic, each with its own name. We can then combine these individual units to implement more and more of the application requirements.

This chapter offers advice on how to play most effectively with blocks of PL/SQL code. It is divided into four main sections:

Best Practices for Parameters

Presents best practices ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required