5
lorentz
24d

We need a list of functions with an associated string, keyed by a sequential int. Neither can change between program versions. In fact, any changes align perfectly to program versions.

The datastructure: a list of string and func with statically known parameters

The solution my PO insists on: a class with static methods that have an attribute for specifying the number, and a database table of number to string. Whenever you need to pass around the list, you pass around a Type object of the class.

Comments
  • 3
    I managed to talk him out of the database table. 8 redundant source files eliminated.
  • 0
    What does this look like in what language?

    I was thinking of std::bind or something (in C++). Call function from list of functions.
  • 1
    @Demolishun It's C#, so first a reference to the static class is obtained (probably through typeof) then the methods are called through runtime reflection methods such as Type.GetMethods(), MemberInfo.GetCustomAttributes(Type) and MethodInfo.Invoke(object, object[])
  • 0
    The custom attribute is at least a class so the names and types of attribute metadata are the only thing in this system that's checked at compile time.
  • 1
    @Demolishun This is the garbage code I have to write now. All error conditions checked partly to highlight just how much the language could check for us if we just let it.

    I didn't even add the logic for caching those goddamn XML files yet, that'll be tomorrow's struggle.
  • 0
    I didn't mention the integer in the rant for the sake of simplicity.
Add Comment