Hot answers tagged

10

Ignoring the philosophical question of "to violate or not" (that sounds bad...), you omitted the sentence immediately prior to your quote: The intuitive idea of a subtype is one whose objects provide all the behavior of objects of another type (the supertype) plus something extra. This gives context to why the axiom you quoted was written. Reading ...


8

In the MVC design pattern, the Controller part is responsible for translating user actions into modifications of the various Model classes that are involved in a piece of functionality. There is no one-to-one relation between Controllers, Views and Models. In particular, if a user action requires changes to multiple Model classes, then it is the ...


3

Adding unit testing to a project in retrospective is usually more pain than it is worth. There is a reason why the red/green/refactor workflow mandates to write the tests first and the code which passes them afterwards. In order to be properly testable, the whole code architecture must be designed with unit-testing in mind. You need to follow patterns like ...


3

TDD isn't about debugging, it is about proving the code functions as expected. Strictly speaking, the tests should have been written before the code but you are where you are. Unit tests benefit future developers since failing tests should raise a red flag that they've inadvertently broken something and should attend to it. That isn't to say there is no ...


3

Yes, this separation of layers is always a good thing, even if its not going to be written for a distributed system. Many systems work by making UI or DB components as isolated as possible to allow for easier maintenance or replacement in the future. Other system write the main program as a command line app and then write a GUI to drive that. That allows it ...


2

ViewModel If its responsibility is to hold model data in a format convenient for the view, then I would call it a ViewModel.


2

Meh. Use whatever term you and your team are comfortable with, as long as you're consistent. For what it's worth, when I was reading the question as soon as I saw OTHER "MODEL" OBJECT I thought "Data transfer object".


2

However, is it reasonable to also create applications using the Component-Entity-System architecture common in game engines? To me, absolutely. I work in visual FX and studied a wide variety of systems in this field, their architectures (including CAD/CAM), hungry for SDKs and any papers that would give me a sense of the pros and cons of the ...


1

This is the preferred method of extending the EF data classes. You can add almost anything. I had a situation where I needed to use different annotations (replacements for the validation, as the defaults weren't sufficient for my needs). Microsoft provides plenty of examples to do this.


1

By introducing new public methods, which the extended Controller classes public interface has no idea about, the frameworks break the LSP: I don't think that new methods break the Liskov substitution principle. If you replace the parent with the child a new method won't change the behabiour if treated as a parent class. It just be a ignored method that ...


1

I would argue that, in the case of AngularJS, utilizing callbacks is a code smell. I say this for the pure simple fact that AngularJS includes the notion of promises that you can leverage for the same use-case, and in fact look extremely similar in practice to the code you have already developed. Consider your test method: var testMethod = function() { ...


1

A few pitfalls you need to be aware of: Authentication. Unless you want anyone in the world to operate your machine, you need to make sure only authorized people connect to your hardware controller. A good way to do this might be to use TLS with client- and server certificate. As a bonus this also gives you encryption to protect from eavesdroppers and ...


1

I my application, when I create a new person, I use an HTML Now how do I do this with PUT? Where does this go? You don't. If you are using html as your representation of application state, then the links you provide in your hypertext use GET or POST. Yes, you can try to fake PUT/DELETE via post, but the client isn't going to recognize those actions ...


1

Your question might be too broad and is quite abstract (not enough implementation details are given: which operating system? which hardware: an Arduino like embedded processor is not the same as an ARM motherboard running some real-time variant of Linux; what machinery ? : a sewing machine is not the same as a nuclear power plant). Also, what kind of users? ...


1

Although I don't have experience with Laravel, but I do have solid Symfony2 background and I don't know how much the framework matters in this question I would say that the proper OOP solution is to create a class that implements the logic needed. Putting this code in controller seems to you as a bad idea, because the controller is an integration layer so ...


1

You're right, if you've written a Windows-only console you need to port the code in it to Linux or Mac. How hard that is depends a lot on what you wrote it in, and how you wrote it. Note that it is possible to run the console on Windows and connect to it via a network connection (if you wrote it to have this capability). As for ASP.NET, this is a ...


1

As far as I know, ASP.NET MVC applications can run only on IIS, which is only available on Windows. This will change with the latest ASP.NET 5, which will run in the DNX (.NET Execution Environment). DNX supports running cross-platform console applications, so consider looking here: http://docs.asp.net/en/latest/dnx/console.html



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