business-logic

Business rules - where do they go in OOP?

I have a class : Schedule. public class Schedule { private int locationNum; private int cost; private String costReason; private Date weekOfChange; private Date dayOfChange; private String changeReason; // and all those getters and setters public Schedule(int locationNum, int cost, String costReason, Date weekOfChange, Date dayOfCh...

What is the benefit of using attribute groups over attributes in defining an XSD?

What is the benefit of using attribute groups over attributes in defining an XSD Schema? Ok... so I can declare them elsewhere and reference them... What else? ...

Avoiding N+1 selects using business rules in NHibernate

I know the basic ways to avoid the N+1 selects problem in Hibernate/NHibernate, but have run into a variant of the problem that I can't find a good solution to. I have the following three entities mapped: Item, Category and Customer. An item is associated many-to-many to Category, and a Category is mapped many-to-one to Customer. So far...

Sharing my repository (repository pattern) with other projects(.NET)?

Hi there, i am trying to tidy up my code, i have a number of projects that have References to my Service Layer i.e the DLL. What this means is that when i distribute a new service layer i have to upload a number of service layers which are generally the same.. Of course using the ADD Reference is very fast as its one assembly talking t...

Execute a method without blocking the client

Hi, I am using Java in order to create web application. The application has to load a form which is sent it's data to a jsp that call a long business logic. I need that the jsp will return a message like "thank you for using my service, an email will sent to you when the proccess is done." The problem is that if I will write something l...

Can 'moving business logic to application layer' increase performance?

In my current project, the business logic is implemented in stored procedures (a 1000+ of them) and now they want to scale it up as the business is growing. Architects have decided to move the business logic to application layer (.net) to boost performance and scalability. But they are not redesigning/rewriting anything. In short the sam...

Re-use business logic from MVC Application (DLL) in Reporting Services

I have a business object that compiles into a DLL that handles all calculations for my system for concepts such as eligibility, etc. The object also handles the connectivity to the DB via some wrappers around it. Is there anyway to take this .NET DLL and use it as a datasource for a reporting services report (SSRS)? We don't want to...

Why should I do UnitTest for my SQL, DAL and BLL if my App will only call BLL metods?

I've put up some tests using VisualStudio integrated test enviroment, they simultate what my web application would do by calling BLL methods (they only ones the UI layer should know and interact with)... So if their behaviour is correct - I get my tests passed - why should I write tests for lower layers such as DAL/Stored Procedures as ...

Validation Design and Documentation

In a perfect world you have the validation (verification) of inputs in the business logic layer, not in the presentation or persistence layer. In reality you can (or want) to place it anywhere. Lets make a simple sample (web-application using a framework like JSF or ZK): A certain input field accepts 4 digits between 0001 and 0500. Yo...

Making business code readable, database enums

Lets say i got a enum table like this: id name desc 0 Normal Normal shipping 1 Fragile Fragile, handle with care and i got some business rule on an order double ShippingPrice(Product p) { if (p.ShippingType == 1) // Fragile return GetFragileShippingPrice(p); else return GetNormalShippingPrice(p); } Maybe not ...

How to split a data layer and business object layer, what are the appropriate duties of each?

If there was a line of business application layered like this, would this be an appropriate division of labor : Data Access Invokes only stored procedures, maps properties of DTOs to a hash tablse which are used to populate ADO.NET command's parameter collections. Only assembly with reference to SqlDataClient. Significant logic dealin...

Learn JD Edwards tools as BA

It would be great if someone have help me. My I am a BA/BPM. I have business knowledge but no coding experience in general programming languages. For my benefit and ease, I normally get the basic of the technology the company uses, like DB2, Oracle etc. My company is planning something with JD Edwards for which I am not working but inter...

What is the most elegant way to implement a business rule relating to a child collection in LINQ?

I have two tables in my database: Wiki WikiId ... WikiUser WikiUserId (PK) WikiId UserId IsOwner ... These tables have a one (Wiki) to Many (WikiUser) relationship. How would I implement the following business rule in my LINQ entity classes: "A Wiki must have exactly one owner?" I've tried updating ...

Should the ID in the business object be read-only or not?

In my mind the ID field of a business object should be read-only (public get and private set) as by definition the ID will never change (as it uniquely identifies a record in the database). This creates a problem when you create a new object (ID not set yet), save it in the database through a stored procedure for example which returns t...

How can I extend the Model in ASP.NET MVC and Entity Framework?

In my first ASP.NET MVC applications, the model was a simple O/R mapping between a table and the classes, managed by the Entity Framework. Now I would like to add some meat to this skeleton, and introduce business methods for the generated classes. What is the recommended approch to this in ASP.NET MVC (with Entity Framework)? My favori...

SMS - How to avoid Bankruptcy?

I'm coding a new website that will need users to enter their mobile phone number, the problem I'm facing is that I need to make sure that the user is in fact the owner of (or in this case, has access to) the mobile number. The solution I've come up with is, upon number submission I send them a SMS with a token and ask the user to enter ...

Enabling and Disabling Radio Buttons Depending on User Selection

I'm looking to write jQuery to only enable radio buttons depending on which radio buttons are currently selected in accordance with some business logic. Essentially there are 3 groups of 3 radio buttons, which end up looking something like (my apologies for being verbose with this example HTML, but hoping this will show what I mean): <...

Architecture for dynamic business rules

I am creating a payroll application in .NET. One of the requirements is that the attendance and deduction rules should be dynamic and flexible to the most extent. The user should be able to define his own rules, where every employee will be bound to an attendance rule. One solution is to compile C# code on the fly where the code to eve...

Multiple Sources(DataTables) in ONE BindingSource?

This question may reveal my ignorance as a Programmer but I won't know if I don't ask. The BLL/DAL I inherited returns DataTables for everything. Address, Phone, CountyList, StateList, etc... My issue is that on a Given page, say Member, there is multiple DataTables being pulled down but the page gets updated as One. Is there a...

Tax Engine Examples

We create point of sale software for the mac, and are looking to revamp our tax engine. It's pretty simple now, with taxes consisting of a name, code and rate that can be applied to every product individually. While this is good enough for some people, we've had lots of requests to handle more advanced situations. Some examples are US Ci...