i accept the need for individual tests for each important method. Background: IDE is necessity in the team.
Option 0: main method for now, unit test cases later
Option 1: junit
Tests are so frequently run that i don’t like the extra step of opening the test class. Using main method, i don’t have to.
i change my methods often. if i invest effort building the unit tests, the effort can be wasted. Perhaps build those methods after the initial volatile phase.
Too many classes open.
specific Purpose: input validation. Let’s zoom in on this. insert, update. not delete.
My observation: a unique id column is important to any input-validation trigger in sybase.
My reasons: you usually need UPDATE yourtable set …. WHERE yourtable.id=inserted.id. Without the where-clause, you could update pre-existing rows. Perhaps millions of pre-existing rows for every row inserted.
Because sybase doesn’t support before-trigger, you need this trick to update the rows just inserted.
I once interfaced with the FX settlement (clearance) system of a major US bank (let’s call it CB). There are always 2 counterparties to each trade. Each counterparty has a nostro account with an “clearance bank” . The settlement process must transfer one currency from clearance bank acct A to clearance bank acct B, and transfer the other currency from B to A.
For example, JPM could be a counter party, but for one particular FX trade, the HKD clearance bank could be HSBC in Hongkong.
In our case, one of the 2 clearance banks is always CB itself. In fact one of the 2 counter parties is usually a CB-controlled trading account.
The settlement system is also know as “cash manager”.
 For example nostro acct to receive HKD must exist in a HK bank — the nostro bank. Only HK banks can be the clearance bank for HKD. In the special case of Euro, nostro acct can be in any Eurozone country.
A few websites say that “at the time of writing, sybase has no before-trigger”, like Oracle, mysql or DB2.
Solution? you know the new values are already in the table, but u can UPDATE those new values and commit, or make an explicit rollback. This would ensure only valid data get committed.
The /casual/ observer encounters many patterns where Object1.java HAS-A instance of Object1.
if the nested instance is a static instance (static member or a local var in a static block), … i feel there’s no OO principle behind the pattern. The hosting object (a class object) and the nested object are very different — class object vs instance of Object1.
From now on, we exclude static instances.
If a domain object follows this pattern, usually(?) there’s a real-world relationship to explain it. Perhaps a parent HAS-A child, a course has a pre-requisite course, a company has an institutional shareholder …
Q: how to you design your table columns to hold boolean flags such as isOK, isAlive, isActive, which are heavily used in where? The challenge is, no index possible, at least in sybase =} FTS. For now, assume you want to select the minority of the rows. If you want the majority, then FTS may be legitimate.
A: Basically you only care about yes/no. But I would suggest use 0 for the majority of the rows, and 1-255 or 1 ~ FFFF for the minority. Keep this column narrow — 1 or 2 bytes, then build an index.
Even though ms sql and mysql can perhaps create an index on a binary or BIT column, it’s 1) less well-supported than regular indices and 2) questionable. In an enterprise enviroment, politically safer to stick to regular indices.
http://www.sql-server-performance.com/article_print.aspx?id=347&type=art has examples.
http://sqlserver2000.databases.aspfaq.com/can-i-create-an-index-on-a-bit-column.html has examples.