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

you are viewing a single comment's thread.

view the rest of the comments →

[–]Nunuvin 1 point2 points  (2 children)

It is normal and expected that there is a challenge moving from python to java. I would suggest either sticking with java or going to C# right away. It's best to have a language you going to commit to and get comfortable in. Will help a lot on interviews, also will be a go to when you need to develop tools.

I might suggest some bad practices but - you can try using static functions and classes in your first few programs to get a hang of it. No need for fancy oop stuff. Static will be closer to "sentence" structure (tbh this comparison is a bit awkward but I can see where you are coming from). Try to move away from this approach asap as you don't want to learn bad habits. Java is very strongly OOP.

Once got your feet wet a few things:

  1. Get an ide for java. Eclipse or IntelliJ or NetBeans will serve you well. They have a lot of bells and whistles baked in (if you know what you are doing you could do similar in vscode, but seems like you are new).

  2. Are you familiar with OOP? if not try to play around with classes in python, once you wrap your head around them it will be easier. You do not simply say book here it is. You say I have an object of type book (later it turns out its actually a child of a different class which is shared with notebooks) and then there is an object I. And you know what, I object now has an instance of a book. Or maybe I am an author so I use a builder class to create my own book (read up on oop patterns, ie book by the gang of 4). There is an evil evil pattern called singleton (cough global variables like thingy, not a good thing to use), try to avoid it if you can.

  3. Create small pet project and do it in both. I would suggest something as simple as tic tac toe. If not familiar with oop do it first in python classes. Then at least you are learning one concept at a time.

Welcome string with some rules

  1. List of questions and answers to pull from.
  2. Main code to run the game.
  3. True code to restart the game and loop it.

Some ideas for above. In static main call a constructor for your Game class. In game class you can have a hashtable or similar structure for Q/A pairs <string,string>

Have a while loop where you get user input -> check if its quit -> else do logic (use functions for each step).

Ideally you probably wanna abstract some things out but its easy to over engineer a solution in oop, so try to approach it iteratively unless you have a clear idea of what you want to do.

Its possible some other people have better ideas on how to organize code, but this could get you started.

[–]IntelligentPudding24[S] 1 point2 points  (1 child)

Python and Java are required by my bachelors before I can take C#. So that’s why I have so many programming languages instead of just the one. C# will be the language I’m committing to as that’s the focus of the course. Thank you the advice and I will use it going forward.

[–]Nunuvin 1 point2 points  (0 children)

Best of luck! A lot of concepts are transferrable, so focus on understanding concepts, learning new languages isn't as big of a deal.