Tag Info

Hot answers tagged

9

Suppose I have a server-side variable containing JSON, called strJSON that my own code created. Was it created entirely by your code? Are you certain that at no point does it add in a piece of user input? Are you also certain that at no point in the future will it ever be modified to add in data that comes from user input? If you can be 100% sure of ...


4

I think the business object/entities you are describing aren't actually domain objects in the DDD-sense, if you are applying DDD your business logic would be contained in the Domain Objects themselves; the entities you are describing (having business logic in a separate layer) seem to be Anemic. If you want to know whether to use DDD you would have to ...


2

Sticking to option 1 will allow you to change the least amount of things when you switch from one database to another, thus the change should have the least impact on your application since only the files concerned with the database will need to be changed. The business layer and any other layer which does not deal with the database should not care, nor ...


2

If the JSON string is encoded entirely under your control, it is exploitable to the extent that your encoding method is broken. That said, you should be safe if you're performing a straightforward serialization using a trusted serializer, like so: var js = new JavaScriptSerializer(); var thingy123 = ThingyRepo.Get(123); var json = js.Serialize(thingy123); ...


1

No, there is nothing wrong with evaluating your own code, if you know for certain it's safe. Too many get caught up in blindly following rules. Evaluation of code in a string seems to really bring out strong opinions for some reason. Evaluation of code in a string is a tool. Learn what it does, how it works, and why it can be unsafe. When you really ...


1

You use a controller when you have a need to access a resource externally. So if you're building an interface to modify employee information, then you have a need for a controller there. Just because you have a resource, though, doesn't mean you need a controller for it. Suppose you have a location class/model that refers to addresses. Maybe an employee has ...


1

@JDT's answer is correct. Imp#2 is the better option. The dependency inversion principle (DIP) as described by Robert C. Martin implicitly demands that if you have two modules A and Band an interface IB which is implemented by B and injected into A the definition of IB should be within the context of A. Actually it's the second clause of the DIP that ...


1

The main reason you would have the interfaces for your repositories in your BLL is to avoid having hard references to the separate DAL but instead have your changing DAL reference the stable BLL. To be able to swap out implementations without changing the stable BLL On the internet this might not be the main reason in general, but this would be a ...


1

I would make it this way: Encapsulate this UI piece into a component, that is responsible only for UI part of the job. Upon construction this component needs data about both contractor and payments to be provided to it (via constructor, some setter methods - whatever. Depends on your design) Encapsulate database-related logic into two services ...



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