Questions tagged [interface]
Object interfaces allow you to create code which specifies which methods a class must implement, without having to define how these methods are handled.
195
questions
4
votes
2
answers
177
views
C# items that don't follow rest of interface
I'm working on a game with unity, and I've created a state manager for the in-game state of certain organisms. Each state implements a ISimpleStateManager interface,...
2
votes
1
answer
89
views
API design for Implementing NaN/Unknown values for custom numeric type
I'm gradually writing an arbitrary-precision arithmetic library for C++. I've decided it could be useful to have the default constructor produce an object of indeterminate value, rather than relying ...
1
vote
1
answer
97
views
Take meal orders from breakfast, lunch and dinner menus
I have an exercise requires me to write a service to management menu.
The requirement like this:
Food menu includes: breakfast menu, lunch menu, dinner menu. The three menu haves list menu item( name, ...
4
votes
0
answers
96
views
Determine when a file is no longer being changed by hashing
I have a requirement to essentially scan a filesystem on any kind of filesystem and move a resource whenever it is ready. To do this I have the following code
...
4
votes
0
answers
117
views
Injectable EventLogger for custom application events that are handled differently from normal logs
I am trying to become better at designing classes for dependency injection and IOC in general. It is often not an intuitive concept.
I have the following python interface and implementation for a ...
1
vote
0
answers
84
views
Hashing service for files or directories on a generic filesystem [closed]
my program requires a hash to be generated for files and folders for data integrity between transfers and file system events (if hash is different, file is not ready). For data integrity, I wish to ...
6
votes
1
answer
2k
views
Date range generator
An app has a feature that's much like any calendar application (like the Outlook calendar for example).
Consequently, I need to do a lot of date logic. I wrote a class with date calculation methods ...
1
vote
1
answer
102
views
Java: Using one class or algebraic data types to model different state?
I'm creating a tool to analyze a card game which is played by three players. A Card is associated with a number of points and looks like this:
...
1
vote
0
answers
135
views
.NET Repository Pattern
I'm currently in the process of defining some framework, one of the first things that I thought I could start with was defining some repository pattern/layer.
I generally wanted some input on it, ...
-1
votes
1
answer
61
views
implementing abstract classes vs interfaces [closed]
I am new to using interfaces and abstract classes. The team I am working with came up with an implementation of what they call a base class that will be implemented by all view model classes. This is ...
3
votes
1
answer
161
views
Lightweight interface implementation in Python 3 using abstract classes
Here is my take at a lightweight interface implementation, where I focus on discoverability of suitable classes from strings (for simplicity, class name is used as an id). Each interface has it's own &...
-1
votes
2
answers
183
views
A simple java game engine [closed]
I'm starting an object orientated game engine in Java. My plans for the engine is to be able to split things easily into multi-core loads. My idea is that a Unique (interface with a ...
2
votes
2
answers
85
views
Registering listeners according to SOLID pricipals
I'm practicing oop concepts these days. To figure it out I tried the below problem.
There is a sensor monitoring system. It is a simple system that prints a value, ...
2
votes
1
answer
38
views
Typescript : Adding types to a function that takes in a string and returns a different promise based on the string
I have a function that takes in a string and based on the string hits different APIs to fetch images.
I have solved it by writing an interface and then as the return type of the function, it returns a ...
5
votes
2
answers
474
views
Best approach for the Design Pattern for multiple schedulers using interface and abstract class
I have a requirement to fetch data for different types of Users (Customers, Publishers etc) for three different timelines (retro, current, and past), all have different URLs. There is a scheduler ...
0
votes
1
answer
447
views
4
votes
1
answer
2k
views
multiple inheritance in c++ to implement different interfaces
I am working on a finite element (FE) code and want to provide multiple material models (20+). In FE applications, the computational domain is subdivided into a set of geometrically simple elements, e....
0
votes
3
answers
251
views
Using "Generics" to implement "Unit Of Work"
I need to design a generic "Unit Of Work", basically so that I can "change the context of the Database" only changing the implementation of ...
7
votes
4
answers
1k
views
IService<T> or defining IProductService, ICustomerService
As per tutorial here, I have the following classes:
(In reference to this tutorial's section)
...
7
votes
2
answers
146
views
Refactoring validator system
I've validator system that validates input data before saving to DB.
So let's say I want to create new user.
We are at the service class:
...
3
votes
3
answers
584
views
Returning interfaces in Java without significant casting
I am writing some code that takes and returns interfaces following the patterns in Effective Java Third Edition. I understand the principle - we want to take in interfaces because in many cases we don'...
4
votes
1
answer
1k
views
Interface class for SQLite databases
I am learning the basics about managing an SQLite database by using Python and, mainly for practice purposes, I have then defined an interface class in order to let operations on database as clear as ...
1
vote
0
answers
65
views
Code for creating a dialog for choosing a date
I have code that creates an AlertDialog to select a date by a user. I ran into a problem that this code began to take up a lot of space. Could you offer ideas on how to shorten this code / put it into ...
-2
votes
1
answer
624
views
C++ generic task interface for delayed execution
I want to rework my current game-server engine to use some global queue of tasks which will be distributed through all the working threads.
I started with task interface. I want it to be able to ...
1
vote
1
answer
2k
views
Should Golang interface be shared among different packages of an application?
I'm developing a Go application that has lots of packages.
Many of the packages use the same type from a 3rd party library.
Should an interface be defined for the type in each package, and let the ...
4
votes
1
answer
184
views
Architecture Logging
I have two database tables UsersDownload, Non-UsersDownload. There is also two model object and two service that take in the object and insert the data into the correct table. Is this the best ...
0
votes
1
answer
67
views
Schedule talks in tracks [closed]
Consider my simple business requirement as follows:
There is a list of talks and they need to be scheduled in tracks. Each track has a morning session starting at 9am and an afternoon session starting ...
3
votes
1
answer
902
views
C# REST / Http Client Abstraction
I have a REST library. These are the abstractions. Have I missed anything that a developer would need to use this in a dependency injection / IoC Container scenario? Anything that bothers you about ...
4
votes
0
answers
336
views
C# Dictionary Wrapper for VBA
I am a technical reviewer/writer and I use VBA for Word a lot to manage issues in Word documents I receive. I have frequently come across niggles when using Collections, Scripting.Dictionaries or ...
6
votes
2
answers
264
views
Opposite access to enums
Consider I have many enums (Java) that looks somewhat like this:
...