New answers tagged

2

The most often-cited source of Program to an interface, not an implementation. is GoF Design Patterns (1995): https://en.wikipedia.org/wiki/Design_Patterns#Introduction Chapter 1 is a discussion of object-oriented design techniques, based on the authors' experience, which they believe would lead to good object-oriented software design, including: "...


1

I would say, if overloading is available, you only include the argument in the name if you have to use different arguments of the same type (like first name and last name). For other cases the argument immediately follows the method name anyway so it will read pretty fluently. Also IntelliSense (or whatever they call it in Java) will do a nice job providing ...


11

Identifiers should not repeate information that is already indicated by the types. So findAppleByString() and findAppleByInteger() would be redundant. But in your case the function names add the information that the integer represents an ID and the string represents a cultivar name, which is not indicated by the type system. You could also have multiple ...


3

There are two opposing goals involved here avoidance of arbitrary dependencies to some global state variables (which makes testing and reasoning about the code hard, especially when the code base grows) avoidance of having to write a lot of cumbersome, similar code which repeats passing the same parameter over and over again. Often, there is a compromise ...


1

Begin db transaction Update the db, setting a status or a flag that means something like "processing". Commit transaction Perform the API call. If the API call succeed, the process still in control, begin transaction, do your db updates, also update the status/flag to "done", commit transaction. All good. If the API call fails, or the ...


-1

I often see developers jumping into several levels of abstraction immediately, which I don't subscribe too. I always make a simple implementation first... enough to satisfy the requirements of the software... maybe with some re-use in mind, but simple. Then as a program evolves, or as the same requirement arises in another project.. I can always break it ...


1

When it comes to any type of design, using standards seems to me the best approach rather than always reinventing the wheel. For the last few years, I have been using IETF RFC 7807 (Problem Details for HTTP APIs) with greate results. RFC 7807 - Problem Details for HTTP APIs


0

As the answer by Hans-Martin Mosner explain it depends on the target system and the user expectations. But there is something to add. If you choose to bundle all the dependencies in one package you should know very well what you are doing and you should be able to create a self contained environment. I don't know about Apple, but often in Windows and ...


5

This actually depends a lot on package dependency handling and user expectations. Linux distributions typically have packaging systems that allow dependencies to be expressed such that interpreters or other required software will automatically be installed, and most users will expect software installs to work that way. Windows application installers often ...


2

In practice, requiring library/interpreter/resource X almost always means requiring a specific version of X. But only one version of X can be installed as the global default, and users hate having to care about configuring/installing/maintaining their global default; they only want stuff done. Therefore, the balance in the trade-off between "depending&...


Top 50 recent answers are included