tags:

views:

129

answers:

3

I understand that I should keep my business logic and UI separate, but I don't know if what I'm doing now violates that rule.

I'm designing my financial program's table structure. I've had a little trouble visualizing some parts, so I mocked up some screens to help me sort out what all will be needed and how things fit together. I really think it's helped, and I believe my schema is solid, but I started wondering if maybe I've fooled myself into thinking that using the mock-up screens to help is ok when it's really hurting me.

Have I automatically gone wrong by using the mock-up screens?

Or could someone explain the potential pitfalls so I can make sure I'm not going down the wrong path?

Thanks.

+2  A: 

Those are orthogonal issues: mock-ups help the design phase (amongst other things) whilst the Business-Logic/UI separation is an architectural principle.

jldupont
+1  A: 

Mock ups in and out of themselves do not hurt or help with UI/business logic separation. The way you implemented them might - to be more specific, if your business logic incorporates any code to directly display the mock-ups, you may be on shaky ground.

The best test of whether your UI is separate from business logic completely is try to envision that you need to re-write your code to support completely different display model (e.g. print text on a terminal instead of GUI, or do a native GUI vs. a web front end. Would such a change necessitate a major change in your business logic code? If so, you may want to separate more.

DVK
+1  A: 

Those are two different things. If you're using mockups to get a better understanding of what's going on with the application, or to design the table structure, that's fine. You're just planning how the application is going to work.

If, however, you take the mockups and start putting code in them that does any more than displaying data... for example, adding a SQL statement to retrieve information, or adding any number of statements to alter the data, then you are mixing logic with views or UI. That makes your overall code hard to maintain, among other things.

If you're interested in a more detailed technical explanation, please read the following paper: http://www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf

Eddie Welker