business-logic

Business logic on multiple objects - where to put the loop?

...and how best to handle success/failure feedback to a view layer. Assuming that the business objects will be iterated over in the business logic method if the loop is put there (i.e. not a bulk update operation), code options in the view logic are: doBusinessLogic( Set businessObjects ) or for (businessObject : businessObjects) { ...

Handling errors and feedback when performing bulk operations in a multi-tiered architecture

Let's say you have a business logic method that can perform some operation across a number of objects. Maybe you want to call a lottery number picking web service, once for each person selected from a list. In Java, the code might look something like this: Set<Person> selectedPeople = ... // fetch list of people for ( Person person : se...

Conditionally display content based on List Item value in aspx?

I have an order form with a dropdown list of 4 membership levels and a dropdown list below it for selecting T-shirt sizes that go along with the memberships. All memberships come with a t-shirt except no. 4. The form validates in the aspx code client side that there is a value for Membership and a value for T-shirt size. But when members...

Anaemic domain models or "where to put logic"

This is one of those scenarios where "Paralysis by Analysis" seems to have taken hold so advice please! The project A fairly simple list of automotive products which include details such as part reference, which vehicles they fit etc. The front end is an asp.net MVC application. The backend is SQL, using Subsonic to project the produ...

What's a good solution for collecting business rule documentation?

I'm running into a situation, common I'm sure, where my business rule documentation is spread across emails, documentation (now out of date) and IMs. This stinks. I can think of 2 alternatives: Sharepoint (hate it, the search feature is terrible) or a wiki. Some things that I'd like to see in the ideal solution: Easily updateable:...

When using facade session beans, why should we still use business session beans as well?

When using the facade design pattern to structure an application's business EJB layer, why should we still use session beans for the actual business logic? Is there a specific reason for not just using plain Java classes (if container managed injection isn't required)? How is the performance of a plain Java class versus a session bean, w...

What are some best practices for Model validation in ASP.NET MVC?

I'm not interested in answers concerning client side validation or model binding. Really, this question could apply to any data access class library outside of MVC, but the issues are similar, I think. I'm using the Repository pattern currently for data access with my entities (models). Currently the repositories handle all of the CRU...

Why is it called 'business logic'? Where did this term come from?

I'm going through all sorts of WPF documentation, and I'm feeling unnecessarily confused. The term 'business logic' is scattered throughout it, as if everyone should know what it is. I can see what business logic is, according to this question here: http://stackoverflow.com/questions/39288/what-exactly-consists-of-business-logic-in-an...

Using the WF rules engine without workflow in production - implementation experiences

I'm designing an application for a type of case management system that has a big requirement for customizable, flexible business rules. I'm planning on using the WF Rules Engine without workflow (see: here, among other examples and such). One of the points my client brought up (justifiably so!) is whether there are extant examples of u...

What is the best way to determine if a timestamp falls within seasonal business hours?

I want a SQL query to check if a given timestamp falls within the open hours of a business. These open hours change depending on the time of year (seasonal hours) and the business is closed for certain holidays. I have a list of these dates, although they are subject to change. What I want is a good structure for storing this informat...

Pros and cons of database events

I am considering rewriting part of an application's data model update methods to include support for registering to events coming from the database. Are there any reasons why this would be a bad idea? Should I limit myself to receiving events fired by CRUD operations, or could I program more of the business logic around event notificatio...

N-layered database application without using an ORM, how does the UI specify what it needs of data to display?

I'm looking for pointers and information here, I'll make this CW since I suspect it has no single one correct answer. This is for C#, hence I'll make some references to Linq below. I also apologize for the long post. Let me summarize the question here, and then the full question follows. Summary: In a UI/BLL/DAL/DB 4-layered application...

Implementing Business Logic in 3 Tier Architecture

I have a web application I am working on and so far I have the data access layer finished. Each table has its own class that creates objects of rows of that table, so each object represents a row of a table. The functions each object has is basically CRUD operations. The question I have is, what is the best way to implement the business...

How to simplify complicated business "IF" logic?

What are the good ways to handle complicated business logic that from the first glance requires many nested if statements? Example: Discount Coupon. could be: 1a) Value discount 1b) Percentage discount 2a) Normal discount 2b) Progressive discount 3a) Requires access coupon 3b) Do not require access coupon 4a) Applied only to the ...

How do I prevent the repetition of business logic?

OK. So here's my simplified scenario. We have a system which handles orders for a number of clients. We want staff users to be able to view all orders and we want client user to only be able to view orders which relate to them. When attempting to view a particular record we make use of the following function in our OrderSecurity class: ...

Getting rid of hard coded values when dealing with lookup tables and related business logic

Example case: We're building a renting service, using SQL Server. Information about items that can be rented is stored in a table. Each item has a state that can be either "Available", "Rented" or "Broken". The different states reside in a lookup table. ItemState table: id name 1 'Available' 2 'Rented' 3 'Broken' Add...

Business Logic in PHP or MySQL ?

On a site with a reasonable amount of traffic , would it matter if the application/business logic is written as stored procedures ,triggers and views , instead of inside the PHP code itself? What would be the best way to go keeping scalability in mind. ...

How do you track where in your code your business rules are implemented?

How do you keep track of the business rules in your application code? Lets say we are designing an order entry system. One of the business rules might be: If the stock level of an item drops below its reorder point, create a purchase order for that item to bring its stock level back up to the minimum. So, in our code, we might ha...

is it good to use check constraints for business rules

Currently we are using check constraints for business rules implementation, but I want to know should we implement business rules in sql or Business logic(c# code) layer. I have searched on the net and finds that check constraints are good to use. please let me know if somebody knows more int detailed abt it. One more thing is that data ...

Users need to create dynamic rules that apply to other users access to the group

Okay so here is "in a nutshell" what I'm trying to accomplish... Users of my application can go and create a new group. They can specify criteria about other users which they will allow/deny to determine who is allowed to join the group. Example: Age: 12 - 16 yrs old Height: 5 - 6 feet The data table that stores the rules would be li...