Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
Questions about problem solving and planning for a solution through software design.
0
votes
Design and relationship of a cursor and its referred object
In my opinion, it makes no sense to make Document an abstraction but have it be used through a separate class. If you intend to make the implementation of Document private, then the Cursor is part of …
5
votes
Accepted
How to design to allow for future logic revision?
No matter how you design your code, there always exists a requirement that'll force you to alter the functionality. … If you keep your design modular, even if new additions require significant amounts of rework, you'll at least be fairly confident you're not inadvertently breaking completely unrelated functionality. …
9
votes
Are classes with only a single (public) method a problem?
doesn't support it; if that's the case, it's not so much a failing in your design as it is a shortcoming in your language of choice. …
8
votes
Should one create underlying architecture to increase flexibility - in advance or when needed?
Writing code is a process of discovery - just like no plan survives contact with the enemy, every design will have flaws that are only caught once you start implementing it. … Even if you miraculously get the design correct now, there's no guarantee it'll still be relevant later, as you said.
In short, it's a slipperly slope. …
1
vote
Structuring an application that reads from a .properties file
Parse the config file and create an object representing the config file's values. Then you can decide how to construct Foo, Bar, and Baz based on the the values of the object's fields.
2
votes
Accepted
ADT design choices
In my opinion the former makes more sense if there's not much you can sensibly do without knowing whether you have an A or B. If you wanted to unconditionally get the string with the former declaratio …
79
votes
Accepted
Is there a good reason to make pure functions non-public?
A pure function could still be an implementation detail. Although the function may cause no harm (from the point of view of not breaking important invariants/contracts), by exposing it both the author …
4
votes
Why are interfaces more helpful than superclasses in achieving loose coupling?
What I don't understand is this:
Abstractions can be superclasses or interfaces.
If so, why are interfaces specifically praised for their ability to allow loose coupling? I don't see how it's differe …
0
votes
Writing a method to 'transform' an immutable object: how should I approach this?
An alternative to an iterator is to pass in whatever you want to do with the color as an argument to transformColor.
void transformColor(Color original, Color target, int duration, int steps, Functio …
3
votes
Isn't striving for elegance counter-productive?
There's always a requirement your design can't accommodate. …
1
vote
Returning results of method on batch list?
Result, or as it's known in functional languages, Either, is only marginally different from Optional, so your final design should have roughly the same API. …
7
votes
Am I wrong in thinking that needing something like AutoMapper is an indication of poor design?
There is a deeper issue here: the fact that C# and Java insist most/all types must be distinguishable by name rather than structure: e.g. class MyPoint2D and class YourPoint2D are separate types even …
3
votes
Best Practices - separation of concerns and inheritance issues
Consider using delegates instead of abstract classes. The Template Method pattern is mostly a hack to work around a language's lack of first-class functions. So instead of overriding "execute", pass i …
12
votes
Accepted
Aren't decorators easily breaking the ISP?
//violates the ISP, because it has to implement it, but it's not using it,
//just passes the operation
public ITearResult tear() {
return page.tear();
}
This is not correct. The decorator is usi …
2
votes
Accepted
Design for an interface implementation that provides additional functionality
Consider this solution:
interface IDevice
{
void PerformA();
int GetB();
}
interface INewDevice : IDevice
{
bool CheckC();
}
class DeviceModel1 : INewDevice
{
...
}
class DeviceMo …