Caps-- Udc-- Mod++ DataMode+ I thought of 'State' but that doesn't really fit?
I agree that this choice is important, we could also have a Mod interface with multiple enums implementing it and using a varargs addColumn(), that keeps the door open for more modifiers... Not sure that this is a good idea though. On Tue, Feb 9, 2010 at 12:09 AM, Rainer Döbele <[email protected]> wrote: > Hi everyone, > > > > I have already raised this question twice but had no satisfactory answer, so > I am hereby trying again: > > > > Generally I think it is a great idea to specify the Nullable, NotNull, > AutoGenerated capabilities of a column with an enum rather than boolean as > before. > > The main advantage is the readability of the data model definition. > > Currently we're using an enumeration called DataMode simply because I could > not think of a better name at the time. > > But I don't think the name is good. There must be something better. > > This is what it looks like at the moment: > > > > // Example for "DataMode" > > DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.AUTOINC, 0, > DataMode.AutoGenerated, "DEP_ID_SEQUENCE"); > > NAME = addColumn("NAME", DataType.TEXT, 80, > DataMode.NotNull); > > HEAD = addColumn("HEAD", DataType.TEXT, 80, > DataMode.Nullable); > > BUSINESS_UNIT = addColumn("BUSINESS_UNIT", DataType.TEXT, 4, > DataMode.NotNull, "ITTK"); > > UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.DATETIME, 0, > DataMode.AutoGenerated); > > > > Since the enum reflect the update capabilities of a column how about UDC > (short for update capabilities): > > // Example for "Udc" > > DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.AUTOINC, 0, > UDC.AutoGenerated, "DEP_ID_SEQUENCE"); > > NAME = addColumn("NAME", DataType.TEXT, 80, > UDC.NotNull); > > HEAD = addColumn("HEAD", DataType.TEXT, 80, > UDC.Nullable); > > BUSINESS_UNIT = addColumn("BUSINESS_UNIT", DataType.TEXT, 4, > UDC.NotNull, "ITTK"); > > UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.DATETIME, 0, > UDC.AutoGenerated); > > > > What about Caps > > // Example for "Caps" > > DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.AUTOINC, 0, > Caps.AutoGenerated, "DEP_ID_SEQUENCE"); > > NAME = addColumn("NAME", DataType.TEXT, 80, > Caps.NotNull); > > HEAD = addColumn("HEAD", DataType.TEXT, 80, > Caps.Nullable); > > BUSINESS_UNIT = addColumn("BUSINESS_UNIT", DataType.TEXT, 4, > Caps.NotNull, "ITTK"); > > UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.DATETIME, 0, > Caps.AutoGenerated); > > > > Or Mod (short for Modifier)? > > // Example for Mod > > DEPARTMENT_ID = addColumn("DEPARTMENT_ID", DataType.AUTOINC, 0, > Mod.AutoGenerated, "DEP_ID_SEQUENCE"); > > NAME = addColumn("NAME", DataType.TEXT, 80, > Mod.NotNull); > > HEAD = addColumn("HEAD", DataType.TEXT, 80, > Mod.Nullable); > > BUSINESS_UNIT = addColumn("BUSINESS_UNIT", DataType.TEXT, 4, > Mod.NotNull, "ITTK"); > > UPDATE_TIMESTAMP= addColumn("UPDATE_TIMESTAMP", DataType.DATETIME, 0, > Mod.AutoGenerated); > > > > Any other ideas are also welcome. > > > > BTW: Finding a good name for a class, function or variable is the most > challenging part of programming (my phrase) > > > > Rainer > > > > > > -- http://www.somatik.be Microsoft gives you windows, Linux gives you the whole house.
