New answers tagged

-1 votes

Who did async/await first?

Grand Central Dispatch was released in 2009, and was used to achieve the same as async/await. With very clumsy syntax in C or C++, slightly clumsy syntax in Objective-C and easier readable syntax in ...
gnasher729's user avatar
  • 42.6k
0 votes

How to organize "master" data VS "working" data in MS SQL

CoW This sounds like a copy on write situation. You have an evolving table such as SurveyQuestion, and you'd like for various callers to take a reference to its current snapshot. For simplicity I will ...
J_H's user avatar
  • 2,782
0 votes

Who did async/await first?

You should take promises into consideration: promise = async something result = await promise Because it operates on promises or futures or similar. Promises arrived to JavaScript with ES2015 (at ...
Michael Quad's user avatar
0 votes

Clean Architecture: Loading data for the domain layer

Somewhat similar to @user3347715's answer, I would design a FriendRelationship aggregate root that contains exactly the data perimeter needed to enforce your invariant. So, load user IDs remote from ...
guillaume31's user avatar
  • 8,372
2 votes

Clean Architecture: Loading data for the domain layer

The general approach here is going to be to model the interaction taking place. That is, make the implicit explicit. Let us add an additional concept to this system, FriendRequest, to carry some of ...
user3347715's user avatar
  • 3,104
0 votes

Correct microservice project structure C#

I think what you are asking is this: Type A Service { SendEmailAboutThing(MyThing x) { this.emailer.Send(new Mail() { Subject = x.Title Body = x.Data1 + x.Data2 ...
Ewan's user avatar
  • 70.9k
0 votes
Accepted

What C# Object Composition strategy would you apply for CoreObjects with a governing 'ObjectType' property

This DesignType determines various fundamental characteristics of the design object, and various calculated values of the design type may have different calculations based on the DesignType. The ...
radarbob's user avatar
  • 5,823
0 votes

What is good practice when inheriting static classes isn't possible/allowed

I am very late to this party but will add an approach I often use in case it helps anyone in the future: The OOP principle of "composition over inheritance". If I have multiple static ...
Eric Schnipke's user avatar
1 vote

How can I keep accurate time in a Windows Forms (WinForms) application?

IMHO you are approaching this from the wrong angle. As mentioned, the OS already provides a local time zone as an offset to the system time / UTC. Under modern Windows systems, it requires less clicks ...
Doc Brown's user avatar
  • 200k
3 votes

How can I keep accurate time in a Windows Forms (WinForms) application?

This sounds like you're in a pretty unenviable position, as you're expected to satisfy conflicting stupid requirements. First off, messing with system time is a bad idea in general, especially when ...
Hans-Martin Mosner's user avatar
2 votes
Accepted

How can I keep accurate time in a Windows Forms (WinForms) application?

Instead of capturing the start time and using a timer, capture the start time and record the operating system tick count. StartTime = DateTime.Now; 'Or however you are currently computing it StartTick ...
John Wu's user avatar
  • 26.1k
2 votes

Poolable classes with default custom properties/logic without affecting OOP hierarchy

I'll chime in from a more language-agnostic perspective. This is a common difficulty in class-based OO languages. The current solutions to this problem (that I can think of) are: Code generation (...
Alexander's user avatar
  • 3,572
1 vote

Where Refit interfaces fit in a Clean Architecture structure

You've struck on a key issue with attribute-based configuration. It tends to force you to reference your attributes on a level that you would rather keep agnostic. This is why some developers start ...
Flater's user avatar
  • 45.2k
3 votes

Poolable classes with default custom properties/logic without affecting OOP hierarchy

Your question raises many flags for possible response. Firstly, "poolable" sounds like an instance-based behavior, not a type-based one. Overall I get the feeling that you're conflating the ...
Flater's user avatar
  • 45.2k
2 votes

Poolable classes with default custom properties/logic without affecting OOP hierarchy

You can store the reference to the pool in a separate data structure and access it through extension methods. Bearing in mind you have to maintain the pool itself somewhere, you probably already have ...
John Wu's user avatar
  • 26.1k
3 votes

Poolable classes with default custom properties/logic without affecting OOP hierarchy

Make the Poolable class generic that has the "value" contained inside it. So you would have something like Poolable<Player> which would allow players but not sprites. If the class is ...
JMekker's user avatar
  • 182
1 vote

Poolable classes with default custom properties/logic without affecting OOP hierarchy

I think that the usual solution is to create a class that implements IPoolable and does the logic that makes a class poolable. Then an instance of this class is injected into the class that you want ...
kiwiron's user avatar
  • 2,288
1 vote
Accepted

MVVM: How and should I expose view models' models to other view models?

I've come up with an interesting solution where I introduce a new interface called IViewModelWithModel<TModel> which looks like this: public interface IViewModelWithModel<TModel> { ...
aelsi2's user avatar
  • 21
1 vote

MVVM: How and should I expose view models' models to other view models?

It looks like you have a fairly complicated problem with the undo and redo. However there are a few things that stand out to me in your post as "code smells" "I've added a view model ...
Ewan's user avatar
  • 70.9k

Top 50 recent answers are included