Working in the Middle: enums -- d.t.o.d.
I've been coding and talking recently about strict logical layers with tight UI code that always passes through the business layer on its way to the data layer. I'm doing this (as I mention in an earlier post) in preparation of moving from webforms to winforms. Along these lines I have been employing web controls much more and see an interesting pattern emerging.
I use public data classes in the business layer which serve to pass data from the UI to the data layer, or vica versa. These are readily available to all pages, controls and components. This is cool but hardly new or interesting. But while coding with this "middle pass-through" mentality I have discovered the efficiency of enums; that is, enums which are also declared as public and at the namespace level. It is very simple to set an easily-identifiable action switch across the layers using enums declared as public in the business class.