7
votes
4answers
400 views

Tic-Tac-Toe design

Kindly look at this code and point out design flaws or areas for improvement. I think I've done the last part right (the enum). I think the rest of the design is flawed but I am very new to ...
1
vote
3answers
244 views

Do the objects in this code follow OO standards?

I previously posted my first attempt at writing a program that I was given to test my skills for a position that I was interviewing for. I have rewritten the program using the excellent advice that I ...
4
votes
2answers
3k views

Random password generator

I just wrote my first Java class, and I wanted to share it with you and maybe get some quick check from more experiences coders than I am. I want to learn OOP, and Java is just the tool I thought was ...
0
votes
0answers
7 views

In which object should I implement wait()/notify()? [migrated]

I'm working in an Android project with multithreading. Basically I have to wait to the server to respond before sending more data. The data sending task is delimited by the flag ...
4
votes
1answer
110 views

Avoid flickering on game screen

This is the smallest SSCCE of my project. I get flickering on the screen with this code. Main class (on which I start the application) ...
4
votes
3answers
308 views

Simple spin game

I see many many programs that are written out of the main method. But most of my programs are written in main() and access some ...
0
votes
1answer
29 views

Where the validation should be done in a 3 layers Entity-Repository-Service application? [closed]

I am struggling to define where the validation process would be better placed in the different layers of the application? (I am not talking about user input validation here, I'm really talking about ...
10
votes
2answers
395 views

Finding average of eight immediate neighbors of a matrix

I have this basic Java code to find average of eight immediate neighbors of a matrix. Is there any way to simplify or merge any part of it, or can I refactor it? I'm a beginner in Java programming ...
10
votes
2answers
103 views

Functional interface hierarchy in Java 8

I just created the following code and am wondering whether it is logically correct (all other feedback is of course also welcome): ...
7
votes
1answer
88 views

Interacting with GUI class and Main class

Usually when I make mock-up programs (like this one), I look for things I can improve on in case the situation happens again. Today I thought I'd brush up on basic OOP (I understand the concept of ...
1
vote
1answer
87 views

MVC Layout - Which way to add listeners is better?

So I'm doing a basic MVC layout for a pretty basic game that I am making. The game requires the user to move up/down/left/right via buttons on the GUI. Since I'm using an MVC layout and my buttons are ...
4
votes
1answer
120 views

Simple class to represent progress

Progress class was written using TDD. Interface of this class (pseudo-code): ...
2
votes
3answers
92 views
2
votes
1answer
70 views

Correct use of delegate pattern

I would much appreciate your advice on this design I am going to implement. I am relatively new to object programming and I am not so sure about the delegate pattern. I need to provide the ...
5
votes
3answers
161 views

Creating date strings and setting dates

I've created a Java class, Date, in which I basically create date strings and set dates. Is there anything I can do besides adding comments to improve/shorten my ...
5
votes
2answers
107 views

A simple web-app code - user registration. Is the layering ok?

So knowing the little pieces is something different and putting them together is something different. Here is the code where I try to follow good oop practices and 3 - layered structure. Any ...
6
votes
3answers
396 views

Imitate randomness of a dice roll

I have written some code in Java that consists of two classes. I have tried my best and I want you to tell me if I can improve and how good this is. Also, how important is OOP? Java is an object ...
1
vote
1answer
296 views

Getting multiple inputs from single EditText

This is an Android app and there is a EditText box, and I need to accept multiple types of inputs one after another in order. This order is predefined. On ...
14
votes
4answers
734 views

Modelling a Call Center

This is the requirement I have (from the book: Cracking the Coding Interview) Imagine you have a call center with three levels of employees: fresher, technical lead (TL), and product manager (PM). ...
6
votes
4answers
980 views

Making a word processor

The Word Processor I had in mind would be similar to Microsoft's word and OpenOffice. I am trying to keep my logic separated from the User Interface and that separated from the controller, basically ...
2
votes
0answers
93 views

How to design a robust class for Packet Capturing tool? [closed]

I need to design a class for packet capture tool. Class should provide service to start and stop a dumpcap packet capture. Class should be capable of accepting all sorts of inputs which includes ...
5
votes
2answers
2k views

“Deal Or No Deal”-style game in Java

This game is explained here. Could this code be more efficient? The Game Class ...
7
votes
1answer
712 views

Drawing a triangle and some concentric circles

For class, I had to use Java to draw a triangle and some concentric circles. Here's my code (questions follow): ...
10
votes
3answers
737 views

Basic bingo game in Java

I've recently wrote a simple bingo game in Java to refresh myself in oop principals I have not touched in quite a while. I feel like I have accomplished this, but I would like to learn as much as ...
6
votes
1answer
137 views

Circular dependencies between immutable objects; the Freeze Pattern

Generally, I structure small threadsafe immutable objects like this: ...
4
votes
2answers
232 views

Managing employee information

I have created a program that allows the user to view/add/delete employees and also view employee payslip, either weekly employee or monthly employee, which is all done in the console. My programme ...
3
votes
1answer
94 views

Throw an exception to control the flow of code execution

There is a recommendation not to use an Exception to control the flow of execution. This gives me a reason for doubt when I do something like this: ...
7
votes
2answers
361 views

How is my BlackJack game design?

This is a command line BlackJack game created in Java as my final project for an advanced programming class. What do you think about it? Have I used OOP correctly? What grade should I get for this? ...
4
votes
2answers
6k views

Blackjack code review

I am very new to Java and programming theory and am desperately trying to improve my knowledge. This is the first program I've made without help and really would appreciate some feedback. I know there ...
13
votes
2answers
779 views

Guessing game - am I using the concept of objects in Java properly?

I'm new to Java and find it hard to grasp the concept of objects. I wrote a simple guessing game to practice the concept of OO programming but I am not sure if I am doing it correctly. The objective ...
4
votes
2answers
80 views

Review of java interface for constructing brain model

I have built a partial human brain model and the following is an example of how I use all the classes. I was wondering if anyone could critique my implementation strategies because I feel like the ...
3
votes
2answers
89 views

Help me improve my Hangman app

I just created a Hangman app (same game mechanics mostly) using Java. I did this mainly to test my knowledge in OOP design/coding. I'd like to know your thoughts on my code The whole project is on ...
3
votes
2answers
123 views

Constructing a binary tree in java

I am constructing a binary tree. Let me know if this is a right way to do it. If not please tell me how to?? I could not find a proper link where constructing a general binary tree has been coded. ...
6
votes
5answers
2k views

Empty method in abstract class

I have an abstract class which holds a hook method for a template method. Not all classes which extend this class will need to implement this method (in fact most will not, but a few will). As such ...
5
votes
3answers
266 views

How to split this Bingo game into 3 separate classes?

I have a single file of a java Bingo program that I want to split into three separate classes (BingoMain, BingoGUI, BingoCard). Extending a program across several files is something I have never ...
2
votes
3answers
312 views

Clear ArrayList

I create class level static ArrayList by the following line. static ArrayList<Student> studentList = null; Then I create and fill ArrayList with some ...
5
votes
1answer
127 views

Batch process as an OO design solution

I was given the task of batch process a single-level control break program to produce a lecturer information report by lecturer from a university course file. I have attempted to create a solution ...
6
votes
2answers
149 views

Calculating min and max with if-statements within a for-loop

This code section is from the main method of my Annual Fuel Use class. The program projects my annual fuel usage based on at least three fill ups of my car. Here, I am calculating the max and min for ...
10
votes
3answers
8k views

Text-based RPG in Java

I'm writing a simple text-based RPG in Java. I think it's a good exercise to practice OO and think about how objects should best interact. I'd be interested in hearing any thoughts! The ...
0
votes
2answers
113 views

Q&A minigame structure

I've decided to improve / test my knowledge so far, as I haven't coded in Java for a while now. Is there anything I can improve in my code? The OOP structure? The code itself? Useless code? ...
4
votes
3answers
154 views

Is there a better, more object oriented way to write this Finder method?

I have several lists of objects which are stored in different locations, based on what they are and who needs them - the system, or the user, for example. There are times where I am only given an ID ...
5
votes
1answer
100 views

Writing an effective method that reflects good OO design and fixes this broke method

I'm working on my personal project and have recently had a bit of trouble with a method I wrote during the week. This method compares user input from the same ...
0
votes
1answer
2k views

Java Fraction Class - Adding Together Two Objects [closed]

I'm currently working on a fraction class. I've successfully figured out how to create a fraction object as well as check for errors but I've blanked and cannot figure out how to add together the two ...
2
votes
2answers
899 views

What's wrong with static utility classes, versus beans?

My inclination is to make these methods static: ...
1
vote
2answers
849 views

Designing classes and methods for hospital management system

I am working on hospital management system project. I have implemented it using the following design. Is it a good design? I have created four classes: Patient, ...
2
votes
3answers
113 views

Did I Needlessly Complicate This Function?

Background: We're using a class called Places (inspired by Allen Holub's great article on DrDobbs) that resolved our program paths based on the existence of a configuration file, environment variable ...
6
votes
1answer
342 views

Intern with no mentor struggling with refactoring and OOP

A little background I'm an intern at a large engineering company, and I'm also the only CS major in the entire building. The people on my team don't have technical backgrounds, but hired me to start ...
0
votes
1answer
146 views

Java game selection + true/false game review needed

First of all, I won't include the spin game there, cause its very simple. just random formula. Ok, I went a bit deeper into object oriented since the last time, I learned array lists, using them with ...
2
votes
4answers
158 views

One or multiple classes? Better-looking way to create tetrominoes in game

Background A few weeks ago, I started working with Java. To get more familiar with the language, I decided to make a Tetris clone. So, as I finished the Tiles ...
1
vote
1answer
67 views

Single Player Pong - Java

I recently created the following code: Pong class: ...