Things I always forget in Application Express (Apex) from Oracle v4.0.X

Firstly – How do You Copy a Page?

I always forget that you can copy a page really simply but it’s hidden away in some obscure place:

– Click on the page you want to Copy

– Click on Create -> Page as a new Copy

Oh so simple but you’d be amazed how much time I’ve wasted trying to remember this.

Secondly – Page Templates. You can’t seem to change them once they are set. At this time I can’t even remember how you assign them without doing a Page->Copy (see above).

Thirdly – How to create an Updateable Report? Again another one that’s so well hidden you think they did it deliberately. You can spend as much time clicking as you like but you have to remember this one or look it up every time:

– Create Region

– Form

– Tabular Form

Then you get the option of Update, Insert, Delete et voila you have an Updateable SQL Report.

Bottom line with Apex is this – there’s always a way of doing it but it’s so well hidden that you need to dig dig dig to find it. Also sometimes even the simplest stuff is hard to remember.


Unit Test

Today I’ve been finding out about this automated unit testing/JUnit thing that people do. Does it actually improve quality? Testing as a concept (to me, working in the industry) just seems like this sickness that is crept in for writing code twice or three times when you only want it once. Is the testing trade off worth the effort for non critical systems? I mean even with critical code there is a question of why we’re spending as much on testing as we are on development?

It of course depends on what code you’re writing and who is going to see it or its interfaces. I don’t think I’ve ever written a single interface that some other alien code will use – in that I always see both sides of the coin. If I were writing a public interface (anything web oriented) I’d be sure as dammit it worked to all tests and if it were to be maintained by other people I would put effort into constructing automated unit testing for it. However for most code I write I can see there is no point as it’s probably not going anywhere.

When you look at testing frameworks and dependency injection it is almost like test metadata is driving coding style. I think that an approach where dependencies are specified in constructors is a good way to code but this is after all only a coding approach. We will always find lots more problems passing structures into pre-existing objects rather than constructing them with those objects in the first place c.f. copy constructors being notoriously difficult to get right or say switching documents inside applications. And if you think logically about design then it follows that your objects should always be able to stand on their own with the minimum amount of dependency. Those highly coupled areas are always going to be the ones where problems exist anyway.

Isolating areas for test makes for progress and then refactoring (newish word which of course means redesigning) code to expose bugs and to fit better with the changed conceptual model ensures that things stay fixed and also code is easier to understand. So I’d argue that perhaps unit tests are just lazy ways of saying ‘need more work here’? And it’s all well and good to say ‘refactor’ but we don’t always have the time.

It’s very interesting learning about this – I can absolutely see the drive but again I just wonder why these languages are so complicated that we are forced to use complex frameworks to reverse park ourselves into good coding practices.