Skip to main content

All Questions

25votes
6answers
2kviews

A Library Class : Point

I am trying to create a library of my own which contains (among others), a class called Point. As the name suggests, it is intended to encapsulate a point ...
Hungry Blue Dev's user avatar
21votes
3answers
2kviews

How to Train Your Dragon

I started out practicing on implementing the builder pattern and somehow ended it up with this 2 hours later. It isn't really much, but it works and I'm hoping review should bring about a lot of ...
Legato's user avatar
  • 9,839
7votes
1answer
352views

Model simulation using Java annotations

A couple of days ago I posted my code that models systems made up of moving parts. I got several great tips and ideas and here is my latest version. My actions are now methods annotated with @Action (...
uros calakovic's user avatar
6votes
5answers
840views

DP solution to min triangle path

I am studying for interviews for various companies. I wrote a solution to this problem, but if an experience programmer looks at it I am sure there are certain areas the code can be made in to a more ...
Mark Isenberg's user avatar
1vote
1answer
684views

Refactoring conditional statements among different classes

I wonder there is any method of refactoring nested condition. It's just the same content with different contents and different classes which looks bad. I really want to reform this code which looks ...
user1842715's user avatar
82votes
6answers
233kviews

Design a chess game using object-oriented principles

I would like to know if my approach is correct and how could it could be improved? Also, is there a way to get rid of the relation between the Piece and the ...
SummerCode's user avatar
23votes
4answers
28kviews

Simple builder pattern implementation for building immutable objects

This is a builder pattern implementation to build immutable Person objects: Person class ...
Levent Divilioglu's user avatar
21votes
2answers
39kviews

Generic DAO written in Java

I initially thought that this was just an architecture issue so I placed it on programmers as Thoughts on refactoring a generic DAO. Then I asked on codereview meta here and decided to put up the code ...
Aseem Bansal's user avatar
8votes
4answers
2kviews

A new type of builder pattern

The fact is that I wanted to apply the builder pattern. But this could not be achieved, since I could not create an instance of the class with an empty constructor - this is dangerous. The goal is to ...
Miron's user avatar
6votes
2answers
12kviews

Stack data structure unit testing

I have this contract: public interface Stack<T> { void push(T object); T pop(); int size(); } I am curious what you think about my test of the <...
magulla's user avatar
6votes
3answers
1kviews

Factory for classes unknown at compile time

I have a class called Machine. It contains a list of parts and a list of actions. The list of parts will contain instances of the ...
uros calakovic's user avatar
6votes
2answers
925views

System for registering people

For a small administrative program, I have to be able to register people and their data. But, files are sometimes created through a phone call "on the fly" and then later certain data is added to the ...
Vahx's user avatar
  • 267
6votes
1answer
190views

Object-oriented implementation of a real-world scenario of using a bathroom

Is there any object oriented way or design pattern I can use to make this code better? How can I avoid casting in this code? What if I add new Object like WaterTank ...
Rutvik D Mehta's user avatar
4votes
2answers
226views

ProductManager: a basic CRUD for products with SQLite

I would like to have a review of this basic CRUD application so I can improve and learn from your experience. The code can be found here. Design pattern/coding principles improvement that could be ...
Mithos-Yggdrasill's user avatar
4votes
2answers
347views

Acquiring a data key

I recently started using the builder pattern in one of my projects: ...
arsenal's user avatar
  • 2,177

153050per page
close