business-logic

Separating UI and logic in C#

Does anyone have any advice on keeping logic out of my GUI classes? I try to use good class design and keep as much separated as possible, but my Form classes usually ends up with more non-UI stuff mixed in than I'd like, and it tends to make maintenance a real pain. (Visual Studio 2008 Professional, C#, Windows apps). Many thanks. ...

Best approach to programming highly complex business/math rules.

I have to take a piece of data, and apply a large number of possible variables to it. I really don't like the idea of using a gigantic set of if statements, so i'm looking for help in an approach to simplify, and make it easier to maintain. As an example: if (isSoccer) val = soccerBaseVal; else if (isFootball) val = footballBa...

Where to throw an exception in layered architecture?

I've an application that offers its Business Layer through a Service Layer developed with WCF. What I'm thinking about is: this service layer offers operational method like Create, Update and so on. These operation then reroute these calls to the Business Layer. The question is: suppose that one of these call doesn't accept a null input ...

oo program vs business rules changes

I am maintaining a custom built and highly OO e-commerce application. The original designer made a few assumptions like: - there will never be more than 3 types of sales tax (state, national & hamonized) - each type of sales tax can have only one rate. - each state will be assigned one of the three tax types. He should have known b...

Business Layer/Code-Behind Performance Question

I was wondering if anyone knew if there was a performance boost of any kind in C#/ASP.NET due to moving database calls from the code-behind to the underlying business logic class library. My understanding is that the class library is compiled, whereas the code-behind is interpreted. ...

Generated asynchronous method calls in C# - AOP?

Hello, I am working on an WPF application that uses a BusinessLogic layer (currently a single dll) in which I created my BL methods that will be called directly from the UI. Each BL manager is resolved with Unity (thinking on switching to MEF though...). BL classes implements a specific interface that have of course apropriate methods. ...

Business logic in Enums?

Is it considered good practice to put any type of business logic in Enums? Not really intense logic, but more of like convenience utility methods. For example: public enum OrderStatus { OPEN, OPEN_WITH_RESTRICTIONS, OPEN_TEMPORARY, CLOSED; public static boolean isOpenStatus(OrderStatus sts) { return sts == OPEN || sts == OP...

How to model and track requirements towards a goal in PHP

I'm building a webapp using the Zend Framework, and I need to model logic or keep track of some logic that has to do with tracking progress towards a goal. Let me illustrate with a sample goal. USER Needs to Complete All Three of the following: A) Activity One B) Activity Two C) Activity Three USER Needs to Complete One ...

Business Logic in SQL Server 2008

If there are any DBAs out there, I'm making a fairly large piece of software and one of the biggest issues presently is where to put the business logic. While Stored Procedures would be easier to fix on the fly, the processing requirements would probably slow the DB down tremendously. I also don't want to have all of the business logic h...

Any design patterns/coding methods for complex logic?

I had to clean up code for an online college application. There's nothing particularly wrong with it, but it was complicated. Different degree programs had different prequisites, fees, required documentation, and questions. On top of that, students coming from the military get different fees, and previous students pay no fees and skip...

Where to store values, for transport to the business layer?

Imagine a hypothetical object with a number of attributes: pseudocode: class Student { Name: String; Birthdate: DateTime; Height: int; //inches GPA: float; //"Grade Point Average" Citizenship: string; } Now the user enters in values, and the object gets them: Name: Shelby Lake Birthdate: 6/19/1991 Height: 63 GPA: 5.6 ...

Lookup Tables - Where to put in n-Tier Architecture

I have a few lookup tables that I am in the process of plumbing through my app. These are tables that drive dropdowns on the website. They have no business logic, but they need to get from the database to the UI while following the architecture of the app. The current architecture has a Data Layer, Business Layer, and Presentation Lay...

Will decoupling be beneficial in a redesign of a legacy application?

I am working on a company running several internet shops. We are about completely rewrite the whole code: site content and products management, order processing, partner relations, accounting, customer base and other. Currently we have a system, where all the stuff (all internal management sites, business-logic and internet store web sit...

Business Logic Layerin Servlet and JSP

Hi, Recently I started to move from a .NET platform to J2EE. I'm Eclipse to build JSP and Servlet applications which should use Business Logic layer. The approach in .NET is very simple I'm building web Application Project inside the solution, then Creating Class Library project and refers its output in Web Application References. Ho...

LightSwitch: How do I place my business logic into a separate assembly?

I have no idea how to do this simple task. LightSwitch's Solution Explorer is different in the sense that it doesn't allow to add other projects such as Class Library. Even if I could add a Class Library I would still need to reference the data model from it. As the data model is inside the LightSwitch project I would have a circular ref...

Business Layer structure, how do you build yours?

I am a big fan of NTiers for my development choices, of course it doesnt fit every scenario. I am currently working on a new project and I am trying to have a play with the way I normally work, and trying to see if I can clean it up. As I have been a very bad boy and have been putting too much code in the presentation layer. My normal ...

NHibernate unable to load assemblies (NHibernate.ByteCode.Castle and BusinessLogic) from GAC

I was lookin all over the internet for this particular problem of mine. I found some suggested solutions but they don't work. Here is the setup: I am using ActiveRecord/NHibernate. I created an assembly wrapping ActiveRecord called the BusinessLogic. The idea is that all my projects should use the BusinessLogic instead of referencing A...

How to send a secure request to a data tier over a firewall

I've been asked to populate a flash file with some data from a database. I said, "Great, I will write some PHP that talks to the database and outputs xml. The swf can call that file." My boss then told me that that solution wouldn't make the cut with IS, and I would have to find a more secure way of doing it. Ugh! My proposed solution ...

separation of logic and UI in titanium (javascript)

Hi folks, i'm new to appcelerators titanium and javascript and i'm interested in coding an iphone app. i recognized that there is a need of "many" code for creating the UI. that's no problem so far, but i tend to separate that code from my application logic wisely. what are the best practices? ...

How to organize business logic (domain model)

Let's say you have good separation of concerns for a given application such that you have all of your business logic in a single project (let's call it MyApp.Core) and that project has no explicit dependencies on other projects. The repository implementations are in MyApp.Infrastructure and the presentation is in MyApp.UI. Unit tests a...