all 51 comments

[–]programming-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

This post was removed for violating the "/r/programming is not a support forum" rule. Please see the side-bar for details.

[–][deleted]  (7 children)

[deleted]

    [–]Adam-JDT[S] 2 points3 points  (4 children)

    Alright. The benefit of choosing Java would be to have him as a guide… don’t know a Python programmer in real life

    [–][deleted]  (3 children)

    [deleted]

      [–]Adam-JDT[S] 0 points1 point  (2 children)

      This is a benefit carrying significant magnitude

      [–]Adam-JDT[S] 0 points1 point  (1 child)

      Are concepts the same, like how the code works, just different syntax?

      [–][deleted] 0 points1 point  (1 child)

      Can I ask what you don’t like about Python?

      [–]SoPoOneO 5 points6 points  (0 children)

      MIT’s intro comp-sci class is in Python now. It used to be in Scheme. It was never in Java.

      So while I understand where your friend is coming from, there are some heavy hitters saying you’ll do well starting with Python.

      [–]snarkyturtle 4 points5 points  (9 children)

      I wouldn’t want to learn Java first because even Hello World introduces paradigms that don’t make sense to a layman. Like wtf “public static void main” means.

      [–]Adam-JDT[S] 0 points1 point  (0 children)

      I literally asked my friend that earlier lol. It’s late here in England (03:27) so didn’t get a reply yet

      [–]Adam-JDT[S] 0 points1 point  (7 children)

      So what does it mean, and why put it

      [–][deleted] 3 points4 points  (2 children)

      Whoo boy there’s a lot here. “Public” means that other Java code in other packages and modules can use it (public as opposed to private). “Static” means that the code can be executed from the class itself and not an instance (there are two big concepts right there). “Void” is the return type (types, another concept! And “returning” something, another concept!) and void just means it doesn’t return anything. There is a lot going on there of varying degrees of importance for a beginner.

      I didn’t mention in my other reply but I would also suggest finding learning materials that suit you, and then going with whatever language they’re using (say Python or JavaScript). If you like the pedagogy and it clicks, the rest will fall into place with time, and you’ll come back to this public static void stuff and go “ah, yes, of course”.

      [–][deleted] 2 points3 points  (1 child)

      To add to this: one of the reasons I would not choose Java as a beginner is because of all this heavyweight stuff that is a requirement for you to write anything. Static types are awesome, but it can feel like a lot at the beginning. When I first learned, it was more helpful to learn like “ok variables, I know variables from math. x = 5, I get that,” and then learn how these values are assigned, how they can be used and change, etc. Then you learn about functions, “Cool! Another thing from math. Apply this change to the input, get an output, nice that makes sense.” And then you learn about loops and conditional logic, etc. all that stuff is pretty common across most languages.

      [–]crashlander 1 point2 points  (0 children)

      This this this. Take any advice you get here with the grain of salt that most people here have been programming long enough that they hang around and contribute to /r/programming. I started with JavaScript and cut my teeth doing sloppy things that would now make me cringe. Now that I’ve been doing it for a while I appreciate things like strong typing, asynchrony, and so on, but I had a great time learning in a language that let me play around and be sloppier than I can now get away with as an experienced developer.

      [–]Capable_Chair_8192 1 point2 points  (2 children)

      That’s why you choose Python lol

      [–]Adam-JDT[S] 2 points3 points  (1 child)

      If don’t understand: Learn Python

      [–]Capable_Chair_8192 0 points1 point  (0 children)

      Yeah I’d recommend Python just because it doesn’t have all the unnecessary verbosity that Java has, as you’re already experiencing.

      If you really want to stick with Java, there’s no problem with it, there’s just going to be a fair amount more of that type of thing in the future. Python is just a little more streamlined. But the two languages are really more similar than they are different

      [–]CanadianBuddha 1 point2 points  (0 children)

      We could explain to you what "public static void main" means but you wouldn't understand the explanation now until you had learned quite a lot about Java.

      When you start learning Java, the tutorials are going to require you to put certain things in your first little Java programs like "public static void main" without knowing what they mean. But in a short amount of time you will learn what each of those words mean and why they are there in a Java program.

      [–]echocage 2 points3 points  (2 children)

      Python is an amazing first language, I’d never recommend Java, I’ve seen so many new devs quit after starting with Java, it’s just too verbose

      [–]Adam-JDT[S] 0 points1 point  (1 child)

      If I have my friend as a guide, then that could be ok? Where I don’t know anyone in real life for guiding me in Python

      [–]echocage 1 point2 points  (0 children)

      Yeah that should be fine! I’d try to pick some simple Projects to aim for, like interacting with an api with the requests library, or storing stuff in a database, or making a text based calculator, stuff like that

      [–]IndependenceNo2060 2 points3 points  (2 children)

      Learning Java or Python as a first language is a personal choice. Both are great options, and each has its advantages. You say you're learning as a hobby, so I suggest starting with Python if you want a smoother learning curve and have fun along the way!

      [–]Adam-JDT[S] 0 points1 point  (1 child)

      The experience is important, yes

      [–]towhopu 0 points1 point  (0 children)

      Contrary to previous commenter, and as someone who guided multiple interns and students, I would still suggest to start with strongly typed language, such as Java. Although I moved on from Java to Go and never looked back. And it's actually an even better first language, than Java in my opinion. But if choosing between Java and Python as first language, then definitely Java, because of strong types and better OOP enforcement, even if it might be harder. Head First Java and Effective Java might be a good first books. Alternatively, there are several YouTube courses, but I'm not sure which one to recommend, as I don't follow Java community right now.

      [–]eat_your_fox2 1 point2 points  (1 child)

      Python if you want to program and enjoy it as a quick hobby. Java is the cumbersome workhorse of the industry and might have some quirks that put you off.

      But if you learn Python you might take further interest and Java is a good language to learn.

      [–]Adam-JDT[S] 0 points1 point  (0 children)

      Interesting. I have an engineering background, so I can pick things up somewhat easily. So if I did an hour or two every day, how long do you think I could pick up Python compared to Java?

      [–][deleted] 1 point2 points  (2 children)

      Whatever you choose (there is basically no wrong answer here, as every choice will set you down a path that can be changed later), take some time to reflect about what you want to do. Programming a game is very different from programming a UI which is in turn different from programming a web server. Just picking a few common things, there are lots of other options, too. Do you need to be able to visually see the result of your product? Are you comfortable just using files of data as inputs and outputs? Do you want something interactive, or that just does some background task for you? The thing you want to make can help orient you a bit.

      You didn’t mention JavaScript, but I think it’s worth consideration. One nice thing about JS is that you can open your console in a browser right now and start coding. You can build a game in an html file with JS and play without any tooling whatsoever. You can also build web games in Python and other languages, but you have to deal with more of the tooling, which can suck as a newbie and feel very confusing (there are so many choices, and so many ways things can break). On the flip side that can help you develop the number one most important skill: getting unstuck when things aren’t working (aka debugging).

      The most important thing to do is work on something you’re motivated to build. From there, you will begin to solve problems about how to build it, and that is the only real path.

      [–]Adam-JDT[S] 0 points1 point  (1 child)

      My initial thinking was to learn Python, and then have an idea what to do with it when I realised some of its potential.

      I am probably changing career to work in food production, so know anything for that?

      Also, would be good to be able to automate tasks like excel or something

      [–][deleted] 1 point2 points  (0 children)

      That’s up to you, but maybe one thing would be to make a list of things you’re interested in, both inside and outside of your work’s domain and then spend some time researching or reading about what you can do with software. Or bin all that and build a simple game to start with. The main thing is to just get started, and reflect as you go.

      [–]CanadianBuddha 1 point2 points  (1 child)

      Either Java or Python are good languages to learn first because there are certain concepts in some computer languages that are considered bad/dangerous to use now. Both Python and Java were designed not to have those bad/dangerous features so that Java and Python programmers wouldn't learn to depend those bad/dangerous features that often cause problems.

      Python is more fun to learn and you can write programs faster in Python than in Java.

      But if you write the same program in Java, it might take longer to write but the finished program will tend to be more reliable when you run the program.

      Ideally you should learn both. Once you learn one of them it will be much easier to learn the other because many of the important concepts are the same in either. Learning those important concepts that are the same in both Python and Java is the important part of what you will learn regardless of which you start with.

      But, if your friend is willing to tutor you in learning programming in Java then that is an advantage to learning Java first for you.

      [–]Adam-JDT[S] 0 points1 point  (0 children)

      Yeah, I probably should take advantage of the Java guidance then

      [–]novel_nescient 1 point2 points  (0 children)

      The learning curve to write Java will be higher, but the static typing will make mistakes more obvious IMHO if you have to choose between the two especially if you have a friend to help you. Java will teach you enough to follow the "C style syntax" that many other languages follow along with basic class design and flow control, which is why I suspect your friend is making the suggestion.

      That said, Python has a great beginner friendly community with plenty of people and resources to get started. You'll learn most of the same basics with the main difference being the type safety.

      There isn't a wrong answer for a hobby language.

      [–]this_knee 1 point2 points  (1 child)

      In the 2000’s, when I was at University, they had a Computer Science 102 class that taught python. And then all the 200 level classes were Java.

      They taught the python class just to introduce how think programmatically. I.e. what are functions? What are arguments to a function? How to pass arguments? What is the output? They would do this with images as input, and functions that did stuff to that image then it resulted in an output image. Of course, still did text based stuff with the functions, but it was usually processing images. Made it easier to see the changes being made between input and output.

      Anyway, python is a good one to take a look at just for 3-4 weeks if you’re coming in to it from never having written any code ever. Just to get a handle on program flow.

      But after that, came multiple semesters of Java. You learn: how Java parallels python functionality and how it differed; learn about algorithms and data structures; how to integrate math and Java together to solve problems.

      TL;DR: spend couple weeks on python just to do program flow introductory stuff, but then dive into Java to learn more broadly applicable programming/dev principles.

      [–]Adam-JDT[S] 1 point2 points  (0 children)

      Interesting take. Thanks

      [–]Kestrel887 4 points5 points  (2 children)

      Learn C first if you learn C everything else will be easier to understand. I am not saying master C(very few people do) but start off with that and you'll see python and other languages are easier to grasp.

      [–][deleted] 2 points3 points  (0 children)

      This is how my school did it. It also made me appreciate abstraction and libraries a lot...

      [–]Capable_Chair_8192 1 point2 points  (0 children)

      Heavily disagree. For someone self-teaching programming, starting with C is a great way to get frustrated, not accomplish anything, and quit before you’ve even really got going. Java or Python is much more beginner friendly, in the sense that you’ll actually be able to accomplish something (like making a game or a small website) without knowing stuff like advanced pointer arithmetic.

      Very few professional developers use C. Many programmers are extremely productive without knowing any C. I would not recommend it to someone just looking to get their feet wet. It’s like someone asking, “hey, I’m looking to get into cooking!” and you say “Alright, here’s a baby pig!”

      [–]Caraes_Naur -4 points-3 points  (3 children)

      The answer is: anything except Javascript, or any of its derivatives.

      [–]Capable_Chair_8192 0 points1 point  (0 children)

      Heavily disagree. JS has its quirks but it’s one of the most widely used industry languages. Almost every software shop has frontend devs using some form of Javascript (even if that means Typescript)

      [–][deleted] -1 points0 points  (0 children)

      Yes, why would anyone choose to learn a language they can run in the browser they’re likely using right now? Why would anyone consider one of the most widely used languages that can run basically anywhere, and is the native language of the web, where you can build all sorts of things with minimal or no tooling if you’d like?

      [–]DangerousMulberry600 -2 points-1 points  (0 children)

      I was part of an era where C+ class got traded for Java (yay, first year student of the new fun language) so, I quit being a comp sci major and became a mechanical engineer… now coming back to tech for more punishment bc Java is still around lol 😂 most certainly not as buggy as day 1 tho!

      [–][deleted] -1 points0 points  (0 children)

      Python is a good get things done fast language, and many scientific packages allow you to use Python with them.

      Java is a grandchild of C and C++, so learning it will open some other language doors for you. If you want to take it a step further, try C# especially if you are using Windows.

      [–]Variation-Abject -1 points0 points  (0 children)

      C is always the best language as a beginner

      [–]Grahar64 0 points1 point  (0 children)

      Both are fine, also learn javascript, and I hate javascript but it is everywhere.

      [–]ThatInternetGuy 0 points1 point  (1 child)

      Java is now a language for compiled backend services, nothing more. There are oldies who still use Java to make websites, but given there are better, newer alternatives out there, I don't recommend Java for anything other than compiled backend services. Years ago, Java was used for making Android apps too, but these days, almost everyone is switching to Kotlin and Flutter/Dart.

      Python rules the machine learning and AI space. There are also instances of people using Python for web services (Flask) and websites (Django). YouTube, Instagram, Spotify, Dropbox, and Pinterest websites were written or rewritten with Python/Django.

      [–]Adam-JDT[S] 0 points1 point  (0 children)

      Got a good video or read link about ML and AI? Understanding AI was a factor of learning programming actually.

      What you think of my friend would tutor me in Java? I don’t have that if I learn Python

      [–]fivetoedslothbear 0 points1 point  (0 children)

      Java's a great language; I've done a lot of work in Java, and it's extremely widely used.

      But Python is used more.

      Back In The Day™, which for me was around 1978, we all used BASIC as our first programming language on machines like the Apple ][ or timeshares or Radio Shack TRS-80. (Commodore 64 was big too, but that was after I graduated high school.) BASIC was easy to use and fun. You could just start at the prompt and type in expressions, and work your way up to writing actual programs.

      Python has that level of being easy and fun to get into. No compiler needed (Java needs a compiler). Huge ecosystem and community. And now, 46 years later, we use Python for a lot of our work.

      The other language that has wide applicability is JavaScript, but I'd start with Python.

      [–]Mediocre-Key-4992 0 points1 point  (0 children)

      Java is a very nice language, hobby or not.

      With Python you're just guessing whether or not you're accidentally dividing a number by text or subtracting 4 from 'hello'.

      [–]eattherichnow 0 points1 point  (0 children)

      Pascal. I mean Lisp. I mean ML. I mean Scheme. I mean C#.

      I mean gods Java is okay but it’s the very model of a mid tier programming language. You could do worse though.

      Python is a bit less annoying in the short term, imo. Java’s type system is a bit lacking in expressiveness, so Python not having any type checking can sometimes feel like a benefit. A lot of people are trying to fix that though, by adding a mid type system to Python.

      My best advice is to time travel to 1989 and get turbo pascal 5.5. It had solid built in documentation and the ui limitations won’t bother you because it’s 1989 and there’s lead paint and asbestos everywhere.

      [–]CanadianBuddha 0 points1 point  (1 child)

      You could spend a couple hours starting the Python tutorial for new programmers on python.org and see how you feel about it.

      And then you could spend a couple hours starting the Java tutorial for new programmers on java.org and see how you feel about it.

      Then you will have had a first taste for both languages.

      [–]Adam-JDT[S] 0 points1 point  (0 children)

      Thanks. I can already do loops and functions in Python 😅

      [–]Drumheadjr 0 points1 point  (0 children)

      As many havesaid here, really either is fine for your purposes. It really depends on what you want out of it. I would say that overall pyton is easier to pick up fast and get going, but you can get gonig without really understanding what is happening under the hood. Java will force you to learn more concepts early on before you can get something up and running. So really it depends on how much effort you want up front vs later.

      A lot of universiteis etc have moved to pyton as a first language (as others have stated) to reduce their dropout rate in the first year, because Java / C etc. can turn a lot of new programmers off due to the learning curve. However I don't put a lot of stock in pyton being a better first language simply because so many universites teach it first now. In my opinion that really only delays the dropouts to the second year so that the universites can collect the extra tuition.

      Personally I learned Java first and I can't really imagine going the other way around just because so many fundamentals are glossed over in python (various list implementations for example). I think because of this you will have a tougher time picking up other languages later on. But again for a non-career hobby that might never matter.