Martin Frank
  • Member for 5 years, 7 months
  • Last seen this week
friend locator app
10 votes

major issue: misunderstanding of exercise you should find the amount k of friends - not the friends within an distanz k major issue: bug for(Pair pair : list){ double d = distance(pair); map....

View answer
Would love some insight on the current state of my Blackjack code
5 votes

separation of concerns your Deck has too much responisibilities - the deck is responsible for holding cards in the deck, this is good. But it also mangages the players (even AI turns!) works as ...

View answer
User details logging
5 votes

as mentioned in the comments it might be helpful to extract methods to remove redundant code - you might want to read a more detailed explanation on "methods in java" to gain basic knowledge ...

View answer
2048 graphic game
5 votes

some minor issues dry - dont repeat yourself Area.moveADirectionis full of redundant code - try to create a method for all that is in common - may i suggest a method void move (int dx, int dy) that ...

View answer
Minesweeper implementation java
Accepted answer
4 votes

Very nice piece of code, thank you very musch for sharing your work with us! i tried to list the issued order by severity. segregation of concerns / composition over inheritance / MVC Your displaying ...

View answer
Three Card Monte game using Java
4 votes

single responsibility your class does all things together reading user input printing dialogs handle game logic by this you violate the openClosed principle. If you want to change your code (eg. ...

View answer
Hotel booking with multiple options. Improvement through subclasses?
4 votes

OOAD - Object Orientated Analyze and Design It's always a good idea to start with a pen and a pencil before you do any coding. Here is a demonstration on how such an Design could look like (I ...

View answer
Sudoku solver recursive backtrack in Java
Accepted answer
4 votes

Object Orientated Programming you don't use object orientated programming! that would clean up the code in a large scale public class Board { //private int[][] board; primitive obsession - use ...

View answer
Proper way to find newest file in a directory
Accepted answer
4 votes

some minore issues only... naming / return type public static Path getLatestFile() assumes that you return only ONE file, but it's easily possible that you have two files of the same date... so you ...

View answer
Generating a Lua script for a tile map maker
4 votes

maybe you can push some of your code into a text file and use it to generate code? template.txt: local Map = IceRunner.Map local MapKit = IceRunner.MapKit local Up = IceRunner.MapTools.UpExtent ...

View answer
Graph Implementation with Dijkstra's Algorithm
3 votes

your major issue is the redunat code you say... so you should try to put things that some classes have in common into a common class there is a very nice example of the proper usage of interfaces, of ...

View answer
pattern matching coding challenge
3 votes

your code looks fine - some minor issues: test driven developement if you have clear requirements, write test to validate them. "The method should pass the following tests" i hope you have ...

View answer
Refactoring duplicated code with abstraction and generics
Accepted answer
3 votes

common Interface classes that share the same behaviour should implement the same interface. That applies to Movie, Book and Song. Their interface is ReviewProvider: public interface IdProvider { ...

View answer
Print all combinations from dictionary which will result in number N
Accepted answer
3 votes

I'm picking up your point: The code looks nasty but I am not sure how to make it look good. if you are using java it's recommended to write code in object-orientated manner. Doing so will clean up (...

View answer
Online Reader System Object Oriented System
3 votes

bloater pt 1 on my first glance i saw that two classes are not required - the name for that anti-pattern is called Middle Man: Library UserManager you can easily refer directly to these List<?>...

View answer
Developed TicTacToe game
3 votes

Coding style guide well, simply one: Java uses CamelCase for methods not underlines eg. game1.do_game(); would be game1.doGame(); naming i have a little problem with your namings, see for example ...

View answer
Basic abstract graph implementation in Java
3 votes

Additional to these good answers a minor issue: using interfaces instead of concrete classes. When you're working with List it would be helpful to work with the interface instead of its concrete ...

View answer
How do I simplify the following code which solves the attached challenge?
3 votes

better splitting method instead of comparing each character of the string, use an regex! String input = ... String output = new String(input); Pattern p = Pattern.compile("\\d+"); Matcher m = p....

View answer
LeetCode: Longest String Chain (Java)
3 votes

Data Design your major flaw is your poor data design. As described in the question you have find out when one word is a predecessor of another A word chain is a sequence of words, where one word is ...

View answer
Island perimeter code challenge in Java
3 votes

Instead of looking for cool new features of Java i would strongly suggest that you concentrate on the basics of Java: Objects: Think in Objects: So far you have identified these Objects: Map, a Cell ...

View answer
Multithreaded TCP Client
3 votes

It might sound a bit petty but you might check for all exceptions that can be thrown from Socket (or at least a one-for-all-exception: RuntimeException)... Socket throws: (done) IOException - ...

View answer
Bird watching database in Java
2 votes

Data Model you have a class Bird as Data Model - but it has too much responibilities: apart from being a data entitiy it is also kind of an Observation - that violates the single responisbility ...

View answer
Simple Swing tool which displays a few procedurally generated dungeon levels
Accepted answer
2 votes

very nice code for a beginner, thank you very much for sharing. so some issues with your code i see: class Exit well you have a place holder in your Room for instances of the Exit but you never create ...

View answer
Generate and Control JMenu Radio Buttons Using An Enum
2 votes

dependency injection with the feedback from your comments i would provide those <T extends Enum<T>> that you want to use already in your constructor. That would remove the not-so-handy ...

View answer
Java hangman game
2 votes

minor issues: language source code is written in english. I don't speak english and many other don't do as well. that might be one reason why this review has no answers yet. NB_ERREURS_MAX String ...

View answer
In-Memory FileSystem in Java - Is there a better OOP approach?
2 votes

create Subclasses / interfaces if you think there is a difference in Behaviour then there is a need for a seperate class - if you think some classes have something in common, extract an interface! so ...

View answer
JTextPane with line-numbers
Accepted answer
2 votes

Awkward Container you create a composite component - the child items are JTextPane inputArea JTextPane lineNumbers as container for these you use a JScrollPane - why is that so? why don't you use a ...

View answer
Simple Banking Program - OOP Principles in Java 11
Accepted answer
2 votes

Naming Even though this is only an example application you should use proper names public class Main could have a far better name, maybe think of public class ExerciseObjectManipulation. You can find ...

View answer
Drawing a Koch snowflake in Android
Accepted answer
2 votes

Some minor issues, nothing serious... Try to calculate the points before you draw and store them to easily redraw them (and not calculate over again). What's the purpose of the Action interface, what ...

View answer
Java Battleship game
Accepted answer
2 votes

ok lets put hands on: Class name for your StartGame is not helpful, rename it into a more matching name, i think like BattleShipGame and start the game instead from your controller BattleShipGame ...

View answer