Documente Academic
Documente Profesional
Documente Cultură
Steven Feuerstein
PL/SQL Evangelist Quest Software steven.feuerstein@quest.com
Copyright 2006 Steven Feuerstein - Page 1
Watch, listen, ask questions. Download the training materials and supporting scripts: http://oracleplsqlprogramming.com/resources.html "Demo zip": all the scripts I run in my class available at http://oracleplsqlprogramming.com/downloads/demo.zip
filename_from_demo_zip.sql
Use these materials as an accelerator as you venture into new territory and need to apply new techniques.
Copyright 2006 Steven Feuerstein - Page 4
Coffee helps us focus, improves our productivity, and gives us an excuse to get up from our desks.
And actually talk to other human beings.
Generally, we need to take care of our host body, so that our brain can keep on earning that big fat paycheck!
Stretch, exercise, take frequent breaks, and so on.
Copyright 2006 Steven Feuerstein - Page 9
Oracle documentation
http://tahiti.oracle.com/
Quest Pipelines
http://quest-pipelines.com/
PL/Vision
http://quest-pipelines.com/pipelines/dba/PLVision/plvision.htm
Copyright 2006 Steven Feuerstein - Page 12
Yet another motivation to encapsulate. And if a "guru" is not ready to learn from others or admit that they made a mistake, you are best off ignoring them in the future. show_memory.sp
Copyright 2006 Steven Feuerstein - Page 14 plvtmr.pkg tmr.ot emplu.pkg
l_name employee_rp.fullname_t; BEGIN l_name := employee_rp.fullname ( employee_id_in); ... END; Copyright 2006 Steven Feuerstein - Page 18
or...
EXCEPTION WHEN NO_DATA_FOUND THEN errpkg.record_and_continue (SQLCODE, ' No company for id ' || TO_CHAR (v_id)); WHEN OTHERS THEN errpkg.record_and_stop; END; Quest CodeGen Utility's error management framework www.qcgu.net Copyright 2006 Steven Feuerstein - Page 19
Another variation on this theme. Stay as far away from the "physical" details as possible. A great example of this is the cursor FOR loop.
Write less code, simply describing the action desired ("Fetch every row in this cursor."). And Oracle can then automatically optimize the code!
Oracle Database 10g_optimize_cfl.sql
Copyright 2006 Steven Feuerstein - Page 20
You spent a lot of time learning in depth the requirements. You expended major effort getting everything just right. You're the expert, and you like being the expert. Let your co-workers go find their own area of expertise.
There are no free lunches nor free rides in programming. So there.
Copyright 2006 Steven Feuerstein - Page 21
ALWAYS look at others' code and ask others to look at yours. Code review is a proven method of improving code quality and reducing bugs. If you think you can't learn from others, then you are arrogant, probably quite hard to work with, and eagerly left out of code reviews. Go extreme? XP pair programming... Automate code review.
Toad's CodeXpert Other IDEs do lint checking Oracle PL/SQL built-in compile-time warnings framework
Copyright 2006 Steven Feuerstein - Page 23
But don't build programs that you think maybe someday another person may need.
That just leads to code bloat.
Copyright 2006 Steven Feuerstein - Page 25
Use a standard error mgt package. Add tracing calls to critical, complex parts of your application. Standardize block structure and headers. Build strong regression tests.
Copyright 2006 Steven Feuerstein - Page 26
Yeah, yeah, yeah. Big news. Of course! The question is how to do it.
We need a test repository, automated run and results verification
You need better toolsand the choices are limited but getting very, very exciting!
utPLSQL - http://utplsql.sourceforge.net/ PLUnit - http://www.apollo-pro.com/help/pl_unit.htm Quest Code Tester for Oracle www.ToadWorld.com or http://unittest.inside.quest.com/index.jspa
Copyright 2006 Steven Feuerstein - Page 28
I don't have time to do anything but find a solution and keep on moving. I will leave it to my descendents to sort it all out. Oh, all right.
Unfortunately, there is/was a bug: In Oracle 9iR2, the fexists parameter is always set to TRUE, whether or not the file exists.
WORKAROUND FIX 2174036 When the bug is fixed, remove the IF statement and uncomment this: RETURN fgetattr_rec.fexists; */ END fexists; Copyright 2006 Steven Feuerstein - Page 33
Things will never stay the same. Things will always be changing.
Anything else is a bug in the making!
Copyright 2006 Steven Feuerstein - Page 34
ODTUG Kaleidoscope
June 18 21, 2007 Hilton Daytona Beach Oceanfront Resort Daytona, Florida
Featuring the world's SECOND PL/SQL Test a Thon! The ODTUG Seriously Practical Oracle PL/SQL Programming Conference The Second OPP 2007 of the year will be held in NYC this Fall.
And we will hold a test-a-thon there as well.