Tag Info

Hot answers tagged

12

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


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


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


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

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


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


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


3

I think the SA is right. (in that you should have actions in the actions table) But for more concrete reasons than just 'align with business definitions' 1: By adding the exta cols to highlight you have broken the normalisation of that table. 2: you presumably do stuff with actions, now you have to check two places to get them all. breaking the single ...


3

So just going purely on the limited information in your description, the common base class seems like an appropriate place to put common processing logic.


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

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

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


1

First and foremeost, you seriously need to isolate business logic from Views. You don't need to do it all at once, but with new feature requests, you really need to workout a better distribution of roles in your application. Secondly, Strategy Design Pattern is exactly what you need in your application: The idea of the pattern is to eliminate hard ...


1

It still belongs in a model, just not a view model. Since MVC assumes you are working in the UI they omit a "V"... View-Model View Controller, VMVC does not have the same ring to it. If your application is trivial, your view model and business model can be the same thing, and that's okay. But it sounds like you application is past that point. public class ...


1

It seems to me like you're putting the cart a bit before the horse, especially since you have a partial implementation already. Take a step back and ask yourself what "all" means and what purpose it serves. In this case it means "without conditions or filters", and the purpose is to provide a way for the user to tell the system "I don't care what the tags ...


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

The greatest complexity for query builders comes out of trying to handle the scope of ANDs an ORs. If you can handle these elegantly, your model can be simpler. I recommend having two sorts of predicates: Your vanilla predicate: value1 operator value2. Your compound predicated (or what we might call "implied parentheses"). The whole compound is tagged ...



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