Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

6

Inheritance is not bad per se. It depends on how you use it. Avoiding a technique just because someone says it is bad is not a good way to make decisions. While I see where Josh Bloch is coming from, the alternative he proposes is not quite the same thing. The Template pattern aims to enforce a particular design; it takes advantage of the rigidity of ...


5

Yes, systems can have just one use case. That is quite normal for systems with very specialized, automatic tasks and no real user. This reveals, however, that for such kind of systems, "use case analysis" does not bring you much benefit (except from the result there is only one). The purpose of this method is to split larger requirements into smaller ones,...


2

There is no hard and fast rules how to handle errors. When an operation could (theoretically) produce an error, you need to look at the situation, each situation individually, and decide how to cope with it. Case 1: Errors that you are convinced cannot happen. Check for them, and in a debug version have an assertion that will stop execution in the debugger,...


2

Your ResourceCommonProcedures doesn't really seem to be an example of the Template Method pattern (as it doesn't really define a 'template' for an operation, except perhaps in a trivial sense). Your base class acts as a factory that produces a concrete ResourceCommonProcedures-derived instance based on an identifying parameter (resourceType). Arguably, that ...


1

I would say Option 2 is standard practice. A direct client to database connection has always been considered bad practice, but usually this is in the context of standard privately hosted SQL databases. To make a direct connection to a DB work your main problem is preventing the user accessing other peoples data, or changing their own data without ...


1

This answer is based on the additional information from the comments. If the database is part of your system then whenever other system requests those data, your system has to offer them (let's disregard for a moment how is it done - this is true also if other system reaches directly to the database1). So from perspective of your system if other system asks ...


1

One use case? Don't stop there. What about systems without a use case? The ideal automated system has no use case. It just works. Anything that is used is semi-automatic at best. Your refrigerator keeps your food cool. Puting your food in and taking it out is independent from the system's behavior, that is not a use case. The cooling part is totally ...


1

One of the strong selling points of OO is supposed to be encapsulation: the implementation details are hidden away and only API, in the form of method signatures and the like, are exposed to the wider world. Yet there is a well recognised way of breaking that encapsulation: you guarantee that a method will perform certain actions, including calling other - ...


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