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

People use the terms "business rule" and "business logic" to refer to the portion of your application that is specific to your application and represents the core behavior of how things are supposed to work as opposed to generic functionality that could be useful in software written for a different client/business/customer base or code that exists to support ...


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 ...


6

It is perfectly acceptable to put security/permissions logic in the controller method. The purpose of the controller method is to coordinate service calls to the service layer or business logic layer or repository. Technically, security is an orthogonal, but very important concern to the business logic methods. It is orthogonal because it essentially ...


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

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 ...


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, ...


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

Atwood's advice from 2004 rings true still today, only we now have the benefit of ORM as well. http://blog.codinghorror.com/who-needs-stored-procedures-anyways/ Stored Procedures should be considered database assembly language: for use in only the most performance critical situations. There are plenty of ways to design a solid, high performing data ...


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. ...


2

Heres an excerpt from wikipedia It is a rule that defines or constrains some aspect of business and always resolves to either true or false. Business rules are intended to assert business structure or to control or influence the behavior of the business Business rules describe the operations, definitions and constraints that apply to an ...


1

It is helpful to distinguish two types of access control: Vertical - functions that some users can access and some users cannot. For example, anyone can view the home page, but only admin can ban a user. Horizonal - functions that multiple users can access, but the data is segregated. For example, everyone can access "inbox" - but they see only their own ...


1

absolutely awesome practice. also try having some sort of base controller that have all other of your controller extended to it to avoid repetitive access control check. let's say i want to limit people from visiting the profile controller, i can have a parent controller called user and right in the constructor i would do a check to see if user has access ...


1

I am having a bit of an issue with some of these things being called "pattern", but clearly, monads, guards and validators are different beasts one may consider patterns. Particularly interesting about monads is of course, that their available operations mean you can apply other functions transparently within the monad (read: map). Therefore, monads are ...


1

I have done a lot of searching but I am still not able to figure out where exactly should I place this Python file containing all the logic. There are a number of options, depending on what your requirements are: Add the logic to e.g. the Image model. This is a useful option if you need to store per-image meta data in the database, and each model ...


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

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