Tag Info

Hot answers tagged

11

I'll give you some tips, regarding CRUD applications, since I don't have much experience in games or graphically intensive apps: Business logic usually involves rules the owner of the business has learned or decided over years of operation, like for example: "reject any new credit if the client hasn't yet finished paying the last one", or "we don't sell ...


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


6

Command Pattern is generally used to decouple WHAT from WHO, and WHAT from WHEN. This is the benefit of having a simple interface as simple as: public abstract class Command { public abstract void execute(); } Lets imagine that you have a class EngineOnCommand. You can pass this Command to other objects which accept instances of Command. So this means ...


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

I use enums this way all the time. Enums are a great way to write immutable helper objects that you only need exactly one copy of; they help reduce the chance of memory leaks and easily group many related classes together in a clear way. What I would not do is expose the control of which particular BusinessLogic you're using to external classes using a ...


4

It sounds like most of your work may be in the UI layer. Changing the display format for business reasons, does not imply any business logic. The change is a change to the view logic. Being able to change the format implies some business logic possibly involving persistence of the preference. Persisting the format to a cookie, could also be implemented ...


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


3

It may be a good idea to encapsulate behavior into a Java enum (or C++ enum class) when you find yourself writing switch statements like the following, especially when the switch is repeated in different parts of the code. MyEnum x = ...; switch (x) { case A: // Do something break; case B: // Do something break; case C: // Do ...


2

Most of the benefit of commands is that they make it easy to undo an action, redo an action, perform an action in multiple places (over a network connection), or perform it at a later date, and so on. With that in mind: Probably not. It's hard to imagine any situation where "undoing" a dialog box makes sense, and this is the sort of thing I'd rather put ...


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


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

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


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



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