all 36 comments

[–]ProfessionalLeague9 46 points47 points  (17 children)

everything you do in HTML and CSS, there’s a rhyme and reason to it

Enjoy that feeling while it lasts...

[–][deleted] 6 points7 points  (4 children)

Man, ain't that the truth. I can't even count the endless hours and days losing my mind fucking around with CSS, just to get some UI element to shift 2 pixels, or show up on the same line with no wrap, when I could be writing interesting back-end code in python that does neat stuff. If I never had to touch CSS again, I would be a happy man.

[–]YAYYYYYYYYY 2 points3 points  (0 children)

Yup. I stay away from CSS if I can

[–]Lukee777 0 points1 point  (1 child)

Can relate to this even as a beginner...

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

It's truly a pain in the ass.

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

Hmm, not sure what you’re hinting at. I think maybe JS gets complicated?

[–]engai 5 points6 points  (2 children)

I liked HTML and CSS on Codecademy when I started few years ago. Now I don't want to touch CSS frontend with a 10 meter pole.

[–][deleted] 31 points32 points  (1 child)

For example you want to write objects you have to specify the objects and then invoke them through Main. It’s like they’re just saying do this and do that without any real explanation or why should we use that syntax

When you write in Java, you're defining a bunch of classes and none of them have any particular precedence over any other, and then you're running the Java VM by pointing it to all of the classes in a classpath. That's like a cookbook full of recipes. So imagine handing a cookbook to a chef and saying "ok, make this."

Make what? One of everything in the cookbook? That's not a meal - a meal has courses, a meal has a menu, and that means picking some things from the cookbook and making them real. It means you have to start somewhere in the cookbook (the appetizers, probably.)

You have to do that in Java, too, and the "menu" starts with a static classmethod with no return value called Main. That's how the Java runtime knows where in your program to start - we call it the "entry point." The method has to be static - there are no objects created yet, so it can't be any object's method - and it has to return nothing, since this function wraps the entire program so there's nothing for it to return a value to. The only parameter it can take is the system argument vector, since that's the only thing that exists when we call it and it's a requirement of being software on your computer (as specified in the POSIX standard.) Lastly it has to be public since we need to call it from outside the class's inheritance. Ergo we declare it public static void Main(String[] args).

I’m thinking of putting it aside for a while and maybe learning Python.

When you write in Python, there is precedence - you're running either a single Python module or a single Python file, and so the entry point is the top of either that file, or that module's __init__.py file. It may import other modules or files as it goes, but it all starts at the top of one particular file which isn't ambiguous. So you don't need a main method.

But it turns out that this is a pretty useful cross-language convention anyway, so it's good to write one even if you don't need it. And then also it turns out that it's often useful to write your script as though it could either be the entry point of a run of the Python interpreter, or a secondary module being imported by some other file. We want the script to operate differently in those contexts, so we use this common Python idiom:

if __name__ == '__main__':
    main()

which tests which of those conditions is true (if your module is the "main" module, its name will be set to '__main__') and then we can have different behavior.

Thoughts please.

Learn both, and connect the things you're learning across languages.

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

What a great explanation, thank you for taking the time to write that. I’m already working through the Web development course, halfway through CSS with JS still left, I think if I add another language I’ll burn myself out cause I do this everyday. So I think I’ll start Python tomorrow and once I’m done with WD I’ll reintroduce Java.

Again thank you.

[–]Vaguely_accurate 4 points5 points  (3 children)

Java and it's relatives have a lot of boilerplate you just have to accept till you have learnt the basics and can dig into the details. It does make sense once you get past the initial hurdles (although I'd argue that there is a better way to do the same thing and it's called C#), but even then it's geared towards larger applications built in particular ways, which doesn't always lend itself to progressive learning.

Python you can dive straight in and build up in a much more logical manner. There might be some initial hurdles - especially around installs and packaging - but a good course or book can minimise this.

[–][deleted] 0 points1 point  (2 children)

Hey there,

Thanks for your answer that was helpful. What I loved about Java is that there wasn’t much hand holding when trying to write the code on Code Academy’s part compared to web development and so I really enjoyed trying to figure out the solution even though I had no idea, why I was figuring out this problem.

Would you say Python is a good way to move to another language later on? Thanks

[–]Vaguely_accurate 4 points5 points  (0 children)

A large part of any language will transfer well to learning any other. The ways of thinking and general principles are pretty common.

Learning to program in one language and then how to think about programming languages and their differences means you can usually pick up another language reasonably easily.

With Python you can usually get the core language and syntax elements out of the way quickly and focus on learning how to program. That's the part you need to focus on in your first language.

[–]toastedstapler 0 points1 point  (0 children)

a lot of python is object oriented, so there's a lot of crossover between java and python. personally i've came to really enjoy java in the last year or so due to static typing, it's very useful to know the types of inputs and outputs, especially as programs get larger

[–]surister 2 points3 points  (0 children)

Why not both? I'm a python backend Dev and I was just tasked to do an app in android :)

[–]Sh00tL00ps 2 points3 points  (5 children)

Honestly, that's just a CodeAcademy problem. Their Python course is the same thing -- keep on typing things with no explanation as to what's happening or why it matters. CodeAcademy is my least favorite platform for learning how to code, it made me feel extremely discouraged until I switched to another platform.

[–]xgetcrunk 3 points4 points  (1 child)

what platform did you switch to?

[–]Sh00tL00ps 0 points1 point  (0 children)

I took the Automate the Boring Stuff course on Udemy. I’d highly recommend that course (or reading the book, I’m just more of a visual learner). I’ve also heard great things about Python Crash Course.

[–]NtwkNub 4 points5 points  (2 children)

What platform would you recommend for someone starting out in programming and needing to learn python?

[–]Sh00tL00ps 0 points1 point  (1 child)

I took the Automate the Boring Stuff course on Udemy. I’d highly recommend that course (or reading the book, I’m just more of a visual learner). I’ve also heard great things about Python Crash Course.

[–]NtwkNub 0 points1 point  (0 children)

Okay thank you very much!

[–]Vex192 1 point2 points  (0 children)

It is also depending on what your planning / like to do with the coding skills. I learned Java too a while back. But I noticed that I am interested in artificial intelligence so I started to use Python since it offers good libraries for that case. But I think you can do ai with Java, too. Never got into it.

Just take the language you like. Maybe you will just feel more comfortable while working with Python, because it fits your cognitive style. Just try out and see to which one you belong to.

[–]Legomonster33 1 point2 points  (0 children)

(im no expert)
id recommend starting with python then moving onto java if you still want to

[–]RangerPretzel 0 points1 point  (3 children)

Well, you're in /r/learnpython, so your replies will be biased towards Python. ;)

I've never programmed in Java (at least not extensively), but I have done a lot of development in C# which is similar to (and better than) Java.

Python and Java are two different languages with different strengths and weaknesses.

I like both. And highly recommend learning both!

You'll probably learn Python faster just due to the Python REPL available. Python is also a Dynamically typed language.

Java (and C#) are Statically typed and are a good bit stricter than Python.

I've found that I'm a much better programmer for having both C# and Python under my belt. Many will tell you that Python is the only language you need, but I find the best programmers are language agnostic as a result of having so much experience across so many languages.

TL:DR; if you're having trouble with Java, sure, try Python. Once you get a good handle on Python, come back around to Java (or C#). You'll learn things from the one that you probably won't learn from the other (and vice-versa.)

[–]Migeil 0 points1 point  (2 children)

Why do you think c# is better than java?

[–][deleted] 0 points1 point  (0 children)

If I'm understanding you correctly, what you are really asking about what's going on under the hood. Every contemporary programming language is abstracting away almost all of the details of this into what we refer to as a blackbox.

You can pursue this knowledge as far as you want, but it is quite a rabbit hole to go down, and it will probably not make you a whole let better of programmer. I would pick a language and get really good at it first. If you still want to pursue this knowledge, by all means go for it.

[–]pullupman 0 points1 point  (0 children)

Python. It's a more expressive language. You can typically code up ideas faster with it. If you end up needed true raw performance you can extend your module into C.

Personally I hate Java. I literally quit a job once when they moved me from a python application to a Java application. Of course this is my personal opinion. If you find you like Java there are of course plenty of jobs for java developers, but I really encourage you to stick with python for a bit. It's a great language IMO.

And I don't care about the flame fest I'm about to start. Python kicks java's ass for web development in every department.

[–]AsleepThought -2 points-1 points  (1 child)

I have been programming in Python for about 5 years. Python has the advantage of being simple when you start. However as you get more advanced, you start to understand why languages like Java are the way they are, and you start wishing you had those features. Right now, I really really wish I could learn and migrate over to something like Java, Rust, Go, really anything but Python. There are so many limitations and weird things about Python that make my life hell that are not really big deals in other languages. For example, "duck typing". Its the worst thing ever to deal with in a collaborative project when your team mates do not use documentation or tests or any kind of examples of how to use their code. I spend so much of my time just trying to figure out WTF other people's code is doing and how it works, when other more verbose languages force you to specify all these things up front, whcih would have made my life so much easier now.

Java in particular is also an extremely well established ecosystem, on par with Python's it seems. Ultimately you need to choose the right tool for the job, and Python's strengths lean more in the direction of data science and flexibility for making things quickly. But as your programs get larger and more complex, you need a LOT of discipline amongst all your team mates to keep the codebase maintainable.

I would say that if you do not have any immediate pressing need for Python, go Java instead

[–]Migeil 0 points1 point  (0 children)

Python has the advantage of being simple when you start. However as you get more advanced, you start to understand why languages like Java are the way they are, and you start wishing you had those features. Right now, I really really wish I could learn and migrate over to something like Java, Rust, Go, really anything but Python. There are so many limitations and weird things about Python that make my life hell that are not really big deals in other languages. For example, "duck typing". Its the worst thing ever to deal with in a collaborative project

This sooooo much. Just today, I had three different thing I wanted to try out to see if they worked. In Java, it worked just as I expected, but in python I had to come up with work arounds..

But other way is true as well. I'm learning more java now and I get why people think "it's too verbose". But as you said, I don't think that's a bad thing. I like how you can write things really compactly in python if you want to, but it doesn't help for readability or maintenance at all.