Tag Info

New answers tagged

2

Does Ninject provide a configuration-file based approach (like here)? I think if you did that the type would be dynamically loaded, and voila! - no dependency in your project. The drawback is that now you have potential runtime failures rather than compile-time ones, but I think that's what you would rather have in your situation.


2

For info, I went down the binary serialization path, with a light-weight mapping structure between the domain and the serializer. Initial, unoptimized tests have it at about 40% faster than nHibernate. I'm hoping to get approval to open source it - if I do I'll edit this answer with the details.


1

You should split 'getting information' from 'assessing information' You have (at the moment) two sources of info, the USDOT result and the form. I would recomend you compile these results into a RiskInfo object which you can pass to a CalcRisk engine. CalcRisk should be a purely in memory stateless calculation so you can unit test it extensively. I would ...


1

Unfortunately, exposing public List Items {get;} breaks the whole encapsulation and protection mechanisms. The using code can just do container.Items.Add and put whatever they want. (which is a problem in the other answer as well). More and more I start to prefer composition instead of inheritance, and when some form of inheritance is needed (to avoid ...


2

The direction where you are going is great. I would make a few tweaks to this design like so: public abstract class Container : Item { private float _MaxWeight; private List<Item> _Items; public List<Item> Items { get { return _Items; } } public float MaxWeight { get { return _MaxWeight; } set { _MaxWeight = value; } } ...


4

Microsoft says in it's Guidelines: AVOID throwing an exception from within Dispose(bool) except under critical situations where the containing process has been corrupted (leaks, inconsistent shared state, etc.). Users expect that a call to Dispose will not raise an exception. Microsoft did throw exceptions themselves in at least one place and it's ...


1

There's nothing wrong with the backing state DTO approach, in fact it's recommended by some DDD people. However, populating a domain object from heterogeneous sources is not the main reason for it. It's more about solving the entity encapsulation vs persistability paradox by having an object that is easily accessible and mappable by ORMs. ...


2

Collecting exceptions When collecting exceptions, be careful with two things: What will happen if an exception occurs, and while reporting it, the reporting mechanism throws another exception? The worst case is to start reporting the new exception, which may trigger a new one, resulting in thousands of new exceptions thrown in a loop. You absolutely need ...


0

I have no detailed solution for this but my approach would be to make sub classes of the exceptions you catch and store + analyse and implement some information about the exception type. public enum ExceptionDanger { Low, Middle, SecurityCritical // And so on } Now we add this to the derived exception class: public class ...


1

As you mentioned, your options are protected and private. protected seems like a good default, but don't forget about the case where you don't want your sub classes to invoke a specific constructor. For example: public abstract class AbstractBase { private AbstractBase(int foo, double bar) { this.CalculatedProperty = ...


0

The second. It has less repetition (DRY) and is easier to understand what is going on, that c holds to value of whether or not a and be b are equal. IMHO, even better would be c = a == b Just as I would write 1 + 2 + 3 instead of ((1 + 2) + 3) 5 + 3 * 7 instead of (5 + (3 * 7)) Obviously and trivially unnecessary code is not a virtue. It's cluttered. ...


1

I write this from the perspective of a long-time .NET developer being pulled inexorably into the client-side JavaScript world, so I assume that I probably share some of the same biases as you. I only bring this up because I think a lot of your bullet points are probably biased by your experience and relative comfort with C# and .NET over JavaScript. For ...


0

I think many of your main points are quite misguided; claiming that "yes browsers can do it but Visual Studio is better" is not going to convince your coworkers (who probably are more used to debugging JS than to working with VS). Also: number 3 is not an actual issue; you can write JS that does not rely in the browser version and that means no more ...


3

The Model is meant to represent both the current state of the data and the data access layer that represents the content. So, if you were using a database, you would handle read/write calls there. In that same vein, you should do disk reads and writes in your model (or, at least I would).


1

Short answer is no. The two things you want are mutually exclusive, you cannot continue a code block while waiting for an answer from an asynchronous server and somehow guarantee to get it back before the code block returns (with the exception of async/await [see below]). That being said if you want to use Reactive, there are a couple approaches to try: ...



Top 50 recent answers are included