Tag Info

Hot answers tagged

11

Not technically impossible, but... Scheduling resources, with the goal of finding the ideal schedule that maximizes the use of time slots. I was on a project once, in my earlier computing days, that had this requirement. I worked on it awhile before I realized that it was NP-hard. Other examples of problems that are not technically impossible, but are ...


8

That sounds like an eminently sensible decision to me. MVC is a presentation pattern, therefore business logic and persistence operations have no place in the UI layer of the application. Ideally an MVC model is just the data you are presenting to be rendered by the view. This is not at all necessarily the same as an equivalent domain entity - for instance, ...


7

Your primary difficulties I feel are that you have a mismatch between a very linear and custom workflow in an older application that do not coincide with the user interaction workflows that are common on the web. Web applications that interact with a server application that contain the business logic communicate in a Request/Response messaging style. The ...


5

Quoting Martin Fowler's famous article: In MVC, the domain element is referred to as the model. Model objects are completely ignorant of the UI. So the answer is, the "Business Logic" clasically belongs in the model layer. (Which, itself can consist of arbitrarily more stuff, definitely not just anemic domain objects). You putting your domain objects ...


4

Others have commented on this, but I will try to write out an answer giving my point of view. I like Robert Harvey answer, and the comments to his answer, and I would like to expand on those. I think you have to present these undecidable problems (like termination) in a mundane way: for example, an IDE tool that "checks if this function always returns a ...


4

I'm not sure why euphoric didn't post his comment as an answer but he's correct. The same data might show up in many use cases and that will impact your rules. You should design your business classes for each use case based in the expected behavior. Then you can look at what data you have and figure out how to store it. For example you might be able to ...


4

I would suggest that you build a well defined API with clearly defined set of error results for each exposed method for the following concerns: an API should not be designed around the consumer. It should define clear behavior and clear failure codes. Your caller could be a UI, a service or another API. The caller should decide what to do about the ...


3

I think you got Fowler wrong, he is advocating 3, not 1 (see http://www.martinfowler.com/bliki/AnemicDomainModel.html). Note that he is not talking about "business logic inside entity classes", he is talking about "business logic inside domain classes". And Service objects are domain objects. In your example above: if you need to calculate the orders total, ...


3

If your data access layer doesn't provide the methods to access data that you need, why would you have it at all? The point of a DAL is not just to provide generic methods for accessing whatever data the caller wants. The database driver already provides those, and if you want to be independent of the particular database, you want a wrapper or adapter, but ...


2

If by model you mean domain model, then that is the place where business logic should reside. If you strip it from any business logic you get what's commonly referred to as a "anaemic domain model" (see www.martinfowler.com/bliki/AnemicDomainModel.html) The gist is: your company has its own perception of a particular business domain. It has certain terms ...


2

I would say that's perfectly acceptable - even desirable. The DAL should only be Data Access - that's why it's the Data Access Layer. The BL, on the other hand, should never interact directly with the database, but should take the data retrieved from the DAL and put it in a more consumer- or developer-friendly format to be leveraged in your code. By ...


2

Assuming we may set aside moral questions aside for the moment: Business A has contracted to you for a way to communicate between satellite offices A1 and A2 without anyone besides the authorized people in A1 and A2 being able to understand the communication. Business B has contracted to you for a way to intelligently eavesdrop on all communications ...


2

For me there is no question to be answered here, you should always strive to separate out your components as much as possible. At a bare minimum, for every new project I create I do the exact following steps: 1) Create a blank visual studio solution 2) Add an MVC project to it 3) Add a class library to it called the Business layer 4) Add a class library to ...


2

I refrain from including validation in my data model objects. I make them very simple POJOs that don't have any knowledge about the content of the values, business logic that drives them, and the state of the application. I've create verification classes that are separate from both the controller and the data model. These are used during the import of ...


2

The PersonDetail class is part of the data access. The service that updates PersonDetail is business logic. Note that, if you don't actually need this separation (i.e. you won't need to transplant the service layer to some other program, independently of the data access), it may not matter (you're coupled to the data layer anyway, due to the presence of ...


2

The data table has a number of columns in it; one of the columns holds a type. A data_type table is keyed from the type and adds a name. An operation table is keyed by the name column of the data_type table and adds an action column. 1) I don't see the point of the data_type table. Mapping a type to a name doesn't really add value to this scenario. ...


1

This http://www.unigui.com/ seems relevant. This seems also close https://forums.embarcadero.com/thread.jspa?messageID=510208&tstart=0. I guess your old "business layer" code is written with Borland tools, either C++ or Delphi? Some decade ago I was porting lots of legacy code from 16bit DOS (Turbo Pascal) to 16bit DPMI (Borland Pascal) and to 32bit ...


1

Read up on asynchronous programming It sounds like your original desktop app was tightly coupled with the GUI with functions not continuing until user chooses decisions from popups. The web, and many GUI frameworks, just don't work like this - all operations that may require user input have to provide a delegate/callback so that processing can continue. ...


1

I would like to know at invoicing time which class(es) would be responsible for generating the invoice item for the service and for each vehicle? It seems pretty obvious that would be the responsibility of your InvoiceItemsGenerator class. Your problem is with your implementation of InvoiceItemsGenerator, which you say contains bundled within it ...


1

Is it something particular or is it something more general? Typically, business rules are of the form "if(condition) then action", while business logic tends to describe a larger set or a sequence of both business rules and other logic. So "business logic" is more general any code that implements logic specific to your problem domain, where "business ...


1

I have taken a class recently on Business Process Model and Notation (BPMN). There it can easy be seen that workflows with many too splits, joins and loops become quickly impractical (though not necessarily impossible, AFAIK) to understand and control, (when you use too many OR-splits instead of XOR-splits). For the software industry, I think the same holds ...


1

There is no need to abstract getting data from one layer to another unless 1 or more transformations are going to occur to put it in a format the consumer expects. Mapping of data tables to collections of objects before returning from the 'data access' is more prudent than having a separate class / function to do so unless you have consumers expecting ...


1

If your Model is a plain retrieve and save to the DB, you don't need a separate Model class. It will be a overhead.. In case you are manipulating over your data and forming custom representation of your class to show on the View, It makes perfect sense to go with your approach. Additionally if in future you expect your Model to be filled from different ...


1

For my own purposes I considered https://github.com/bobthecow/Ruler - a production rules engine. It is applicable to your needs: Give Customer X, a 10% a discount for Product Y if he bundles it with Product Z. I'll try to write some sort of a pseudo-code: Context: your shopping cart items Rules: cart contains ProductY and ProductZ Execute: ...



Only top voted, non community-wiki answers of a minimum length are eligible