Skip to main content

All Questions

Tagged with
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, ...
David Moore's user avatar
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: ...
user253872's user avatar
-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 ...
tuskiomi's user avatar
  • 185
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, ...
Neminda Prabhashwara's user avatar
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: ...
makiz1234's user avatar
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'...
CL40's user avatar
  • 133
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 ...
Destroyer's user avatar
  • 477
6 votes
2 answers
264 views

Opposite access to enums

Consider I have many enums (Java) that looks somewhat like this: ...
Hallel's user avatar
  • 163
0 votes
3 answers
105 views

"Human" interfaces with two implementation classes

The Helloworld class executes all of the methods. Human is the interface, and Nate & <...
nate's user avatar
  • 3
0 votes
1 answer
87 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 ...
Devsman's user avatar
  • 113
2 votes
1 answer
3k 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 ...
Hamidur Rahman's user avatar
1 vote
2 answers
2k 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...
user avatar
4 votes
2 answers
2k 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 ...
NotSure's user avatar
  • 149
1 vote
1 answer
101 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 ...
Vardaan Sharma's user avatar
3 votes
3 answers
5k 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 ...
I likeThatMeow's user avatar

15 30 50 per page