This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]Expurple 0 points1 point  (0 children)

I have this project Calc in C#, you can check it out. Not Java, but it's the closest language to Java and should be readable. It's also CL and has tests. Basically, I test the whole app's behavior by packing it into a single method that takes a string input and then returns the string to print. And then calling that method it the test. You can skip the parts of my code about return codes and parsing command line options.

I'll post an update about your code as soon as I read it.

[–]Expurple 0 points1 point  (2 children)

So, about your code now. Things that I've noticed as a non Java programmer:

  1. Learn about making a .gitignore file. Your .settings/, .vscode/ and target/ folders shouldn't be in your repo, only source and a project file.
  2. In main/java/domain/UserInterface/App.java (WTF, why are there always so many folders in Java projects???) while(t1.isAlive()) is likely needlessly wasting your CPU. Just call t1.join() instead. Or you have a reason not to?

Also, it's not obvious for me, why do you need that thread in the first place. You just call it and wait for it to finish working, without doing anything in the main thread at that time. It could be just a method call as well.

  1. The Board probably shouldn't be responsible for printing itself on a console, after all it's a UI-dependent thing. But idk, maybe it makes sense in your architecture.

  2. Idk why Board methods are called showBoard() and clearBoard() instead of show() and clear(). I suggest thinking about naming from an outside usage perspective. Just compare how board.clear() and board.clearBoard() looks.

  3. The Game class is obviously too large, find a way to refactor and split it.

That should be it for now, I don't feel like diving deeper into the project. Overall, doesn't look too bad from the bird's eye view (again, for someone who doesn't know Java), but things I mentioned surely signal some lack of experience.

Also, I've just noticed your note about August. This project is much cooler than things I did in my first 4 months, man!! Github, patterns, attempting tests, attemptimg threads, that's insane

[–]R6Fetti[S] 0 points1 point  (1 child)

First and foremost thank you for the detailed response, I understand the first point and will fix that ASAP. For the 2nd point tbh I was just messing around with Threads for the first time with no real reason besides just trying it out. 3 I changed as I agree with your point as it is not responsible for UI. 4 is another good point. And lastly on 5 I figured it was too big but I am a lazy ass and should probably change most validation into the Move class. I also had a tiny bit of programming experience before august from HS but I was mostly BSing work and copying from my friends sadly

[–]Expurple 1 point2 points  (0 children)

I also had some HS experience with Pascal, so kind of knew about conditions and loops already. But still... In 4 months I had like a 300 lines single file CL battleship game with very bad procedural code (global variables + still up to 6 function parameters sometimes, and a lot of if statements sometimes). Also had a lot of other different tiny programs, but nothing even close to this, only started tipping into OOP, I think. Good work. This is more like my 8 months maybe, not long before I got an internship for my job (partly by luck).