Stack Exchange Network

Stack Exchange network consists of 174 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

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.

1
vote
0answers
24 views

Simple Serial Port Windows Interface

I implemented a very simple blocking uart interface. Most of the serial instruments I interface with are master/slave and I have to wait on data to proceed forward. I am contemplating add some ...
17
votes
5answers
3k views

House plan design (Head First C#)

I've been working through the book Head First C# and this is an exercise from chapter 7, which is about interfaces and abstract classes. Note that the class design was mandated by the authors, I'm ...
3
votes
1answer
89 views

Writing to a file in Golang across concurrent go routines

I've been reading around how golang writes to a file, and this stack overflow question and this reddit question highlights the fact Go doesn't gurantee atomicity when writing to a file system. ...
0
votes
1answer
76 views

Functional List in C++ [closed]

This is rather toy example of immutable datatype in C++. I've tried to follow functional languages like Scheme, Racket - making list as a cons cell: list is list or is empty. ...
5
votes
1answer
85 views

Service for generating faked objects

I'm using the Bogus library to mock up some data for testing. This is my main method demonstrating how the faking service should be used: ...
1
vote
1answer
38 views

Proper naming for objects which have a position and bounds on a plane

I have an interface which is for an object which has bounds in a 2D plane. ...
2
votes
1answer
89 views

Handling related generic type parameters

In answering a question on StackOverflow, it occurred to me that a more generic version of GroupBy for C# that delegated membership in each group to a class could ...
-1
votes
1answer
41 views

An interface for designing Arduino code [closed]

Writing code could be divided into three parts. 1.Interface structure At this stage programmer should describe all the devices used in his project. Of course, only those of them which Arduino ...
1
vote
1answer
273 views

ChangeCalculator for calculating money denominations in change

I'm doing some exercises in OOP and I just created a program that calculates amounts of denominations in a change at the shop. So, let's say something costs 10, I give 25.30 (for some reason), so I ...
0
votes
3answers
76 views

“Human” interfaces with two implementation classes

The Helloworld class executes all of the methods. Human is the interface, and Nate & <...
6
votes
1answer
114 views

Catching missing attribute errors sooner in Python using strict interface specifications

I use Python daily for long-running simulations (yes, very very optimal, I know). As you could probably guess, my coworkers and I have issues with simulations running for several minutes before ...
0
votes
1answer
54 views

Using a wrapper on a primitive as a generic for an interface used for Java lambda

I apologize for that title, lol. I have a Java method that I'm writing where I want to be able to pass in an array of Objects and two interfaces that will be used for lambda expressions that specify ...
2
votes
1answer
112 views

Implementation of generic unordered list in java

This question is a follow-up question of this question. These features are added to the new class - Generic class User is capable of setting the size ...
0
votes
0answers
29 views

Processing RabbitMQ messages with Processors from another system / Interface Segregation

I was reviewing a app that runs as a service and processes messages form RabbitMQ. The app processes the messages using Processors retrieved from another system. ...
4
votes
1answer
67 views

Designing the constructor interface for a reflection object (any class)

I am working on cleaning up and making open source a C++ reflection library that has served me well over the last few years. One of the most important classes of the library is ...
2
votes
0answers
497 views

Processor for handling generic commands

I'm trying to implement business logic layer based on concepts of commands and command handlers. A command is a thing that contains input parameters for executing some action, and it knows what kind ...
4
votes
1answer
241 views

C++ implementation of the decorator pattern

This is a C++ implementation of the decorator pattern. I am also learning about interfaces and (pure) virtual functions. ...
1
vote
1answer
463 views

Templatized Object Pool in C++

I'm following Robert Nystroms example to try and implement a decent object pool for my next couple of C++ based games. My version is templatized to allow arbitrary classes to be pooled. I'm asking ...
1
vote
1answer
575 views

PHP OOP API Class

I want to do an API or contract in Laravel focus when one person wants a contract or credit, but honestly it's for a scholarship but the process it's similar when I got a credit from a bank. Honestly ...
0
votes
1answer
26 views

interface design for allowing custom parameter struct, falling back on defaults

Right now I have an awkward setup, but don't really know what the cleaner solution would look like. The parameter struct is defining the action keys for a simple fly camera. Right now it looks like ...
0
votes
1answer
81 views

Different implementation of an Interface along with additional parameters

I am designing an interface for 2 distinct implementations as follows: Perform operations without client credentials ( for my local applications) Perform operations using security token. (for web ...
1
vote
2answers
997 views

Creating a Student class for a project

To recover from yesterday's disaster, I re-read the SOLID principles and refactored my code. Hopefully I did a better job than yesterday. I wanted to keep my Student...
1
vote
0answers
249 views

MongoDB database abstraction

Backstory The company I work, we have the code below that acts as an abstraction of our database layer, which is mongoDB. This ensures our other code is not too dependent on the database. This is ...
2
votes
1answer
2k views

Creating data objects dynamically at runtime from an interface

Sometimes when I write objects for holding data (not real DTOs, no serialization involved) I also create an interface for it. The class that implements it can also perform some null checks. I don't ...
2
votes
1answer
137 views

Implementing an HotelManager interface in Java

Got a mission to implement an Hotel Manager interface. I will post the interface and the attached class Reservation, and will add my code. What I am asking you is ...
9
votes
5answers
338 views

Declarative type comparer

Writing comparers by either implementing the IEqualityComparer<T> or the IEquatable<T> interface is another boring ...
1
vote
1answer
52 views

Passing some redundant parameters to an interface vs creating a new request object every time for the interface

I am writing a proxy class, that will fetch a certain property (say propertyA) by calling an underlying service. Currently we use Service A to get propertyA, but there is a chance that in the near ...
2
votes
3answers
944 views

OOP modelling of a car agency

Exercise: A car dealer wants a computer system to manage the data of their vehicles and classify them by type. All cars have the following data Engine serial number Brand Year ...
1
vote
0answers
265 views

Base Class Interface for Parent/Child tree hierarchy

I have a class named Object, which is a common interface for all its derived class. The following rules apply to all Object instances. As zero or one parent. As zero or more child. Can not be the ...
9
votes
1answer
1k views

OOP modeling of a boat rental system

I have some question about this exercise, did I model the problem correctly (the code works)?. If I did it correctly, Is there anything that can improve the code?. For example, how could I avoid the ...
1
vote
0answers
24 views

Factory module to convert DOM / ORM data structures

The following code is part of a real estate data processing API. It is being invoked by several modules of a software that translates real estate data in-between different formats (ORM models, DOMs, ...
-2
votes
1answer
219 views

Parsing various types of message strings

Similar question MessageFormat: represents the various kinds of messages. (XML, JSON, ...
7
votes
2answers
216 views

Object-oriented Quarantine implementation

I am a newbie in thinking object oriented solution for a problem, so I am trying to improve. I have tried to implement a quarantine assignment. Here is a requirement with unit test cases. I am trying ...
3
votes
0answers
370 views

Implement OO interfaces in Python

Edit: Whoops! I just remembered there's already an long-lived package for this, zope.interface. I'd like a review all the same. This is a proof-of-concept ...
4
votes
2answers
365 views

Validating Shift class through builder pattern

I have a Shift class that looks like this: ...
3
votes
0answers
50 views

Extensible Python Interfaces

Some background before the actual code: My team needs to develop an optimization library for a specific problem. In order to optimize (pun intended) the projects life-cycle I am trying to write some ...
14
votes
2answers
1k views

Using events together with interfaces in VBA

Introduction Because of the limitation of VBA in using events in interfaces I was searching for a kind of workaround. For sure I also read this which also provides an approach, but I was searching ...
8
votes
1answer
227 views

Trie implementation for a data structure library in C

I'm implementing a trie structure for a library, as an exercise in data structures. Details The tree structure is represented as a doubly chained tree. A struct ...
4
votes
1answer
59 views

Fetching files or directories in a given directory

This is a self-teaching implementation to get files for a given directory in order to simplify os.Walk in Go (avoid to pass a func for recursively walking across ...
3
votes
1answer
334 views

Scala traits for arithmetic expressions

I am learning Scala and want to know, what is preferred style of writing a function for a trait. First: ...
6
votes
2answers
130 views

A simple program which returns specific value from array

After researching for an hour regarding SOLID Principles, I tried to do it myself. Please note that most of these codes were from the ideas of others. I created a simple program which returns ...
2
votes
1answer
92 views

Handing multiple workflows cleanly in LOB application

Background I'm about to build a LOB application that resembles an e-commerce solution (without paying and being open to the public). It will be used to receive orders for fulfillment purposes based ...
1
vote
1answer
25 views

Multiple Interfaces modifying contract

I have a problem with my interface-design. I especially ask for help with the overloaded compute-Method. For a calculator I work with these Interfaces: ...
2
votes
2answers
83 views

Represent a person who has different roles for different offices

People have different types of roles depending on the office they are working at. For example, a person has two roles (cashier,cleaner) at OfficeMax and five roles(manager,security,etc) at OfficeLess. ...
5
votes
0answers
273 views

A* Algorithm in F#

Inspired by this post I looked up A* on wikipedia and went on with my own implementation as seen below where I try to mimic the pseudocode on Wikipedia but in a recursive manner. I would like any ...
4
votes
1answer
1k views

Classes representing items in an RPG game

I wrote a little program in C# that contains classes representing Items in RPG game. I wanted to have access to all inherited classes parameters from list contains parent Item class instances, so this ...
5
votes
1answer
739 views

Generating RPG Characters (Objects)

I am a beginner Java programmer. I have just finished up an assignment and would appreciate some advice and/or constructive criticism on my program. I am trying to ensure I do not advance my knowledge ...
4
votes
3answers
2k views

Generating 50 Random Shapes

I am a beginner Java programmer. I have just finished up an assignment and would appreciate some advice and/or constructive criticism on my program. For context, I have the assignment details, ...
2
votes
0answers
58 views

Expression validator service

I'm working on a project (in C++98) that uses a grammar validation service to validate mapping expressions for a small DSL. To simplify the project code, I've written a small interface for using the ...
4
votes
2answers
2k views

Automatic IEqualityComparer<T>

There are APIs like the Except extension that require the IEqualityComparer<T> to work. I find it's too much work for such ...