I learned Java in uni and think it's a fine language to start with. It's also been modernized a lot in the past decade, and if you really want a more modern language it's easy to transition to Kotlin.
I'd take Java over Python or JS any day. It wins on performance, it wins on type system, js is just a plain trash language not at all suited for general purpose programming (TS solves some problems but not all and it has its own problems) and python is fineish but it's slow and just kind of icky, I'd never do serious software development in python. It's fine for small scripts and notebooks and such, we learned python as part of our math classes while the programming classes focused primarily on Java. We also had a class on web development using JS, ML using Python and windows programming using C++ and C#.
I struggle to see any significantly better candidates for a first language than Java. Sure you could go with C but nobody really uses it any more outside of niches. C++ is out, too much stuff. I really like C#, it's my daily driver and I wouldn't mind it as a first language but I think Java is more approachable for beginners. Less confusing syntax to learn. I don't know Go but maybe that could be an alternative? Other than that I'm a bit out of options.
Java is a fairly simple language that's easy to learn and allows teaching a lot of important concepts that will be useful in other languages moving forward. That's a big thing I think, it's not meant to be the only language. The word polyglot is used some times, to me it just means programmer. I don't know any competent developers who only know one language. You end up learning multiple and I think Java is a good entry point.
C# is amazing. Decisions at the education level were made well before it went cross-platform though (FWIW, I've been using it since before v1.1).
Would be interesting in what confusing syntax you're referring to. I think one of the beauties of it is that it's additive. You can program plenty of simple stuff in it with conventional style code, but there's a lot of syntactic sugar available that makes things so easy when you need to start scaling things.
I agree, C# is my language of choice and I've been using it professionally for over 5 years. I use it for personal projects as well.
I'm referring to all the stuff C# has that Java doesn't. Async, ref/in/out keywords, extension methods, linq, lots of stuff. Maybe it's not a big deal, like I said I wouldn't really mind it. I just think Java is a bit simpler in this regard which is an advantage for beginners.
Some differences where I prefer java are checked exceptions and imports. C# usings are ambiguous, it can be difficult to figure out where things are coming from for code samples outside an IDE. And checked exceptions are just good IMO. I've never seen why people dislike them, having used Java and C# I think Java does it better. It's easy to miss exceptions in C#, I wish library developers could use checked exceptions to tell me which exceptions I should worry about.
Anyway both languages are great first languages and great general purpose languages. Highly recommend both.
Thanks for taking the time to respond. Ultimately though, most of those aren't required from the beginning, but the syntactic sugar, abstractions, and performance gains from them are amazing.
You probably already know, but I'll opine a little bit about extension methods. I use them a lot.
Entities > Repositories > Functionality. All split out.
- Entities (pretty much just gets and sets, nothing more than necessary).
- Repositories via extensions to determine where the data comes and goes from (some data comes from SQL, some from Redis, some from Postgres, doesn't matter since it's split out) and any particular queries you need for optimizing things.
- Functionality via more extensions without adding additional code to the entities.
Separation of purpose/use.
I may or may not have completely replaced our data layer in the middle of the height of our season with no interruption. Little bit passionate about this one.
Would you happen to have something like a github repo with examples of those repositories? I'd be interested in seeing that.
Personally I'm not a big fan of copious extensions. I use them some times but I'd describe my usage as sparingly.
I wish. It's on Github, but my hands are tied and I can't share them since it's someone else's property now (hooray for exits, I think).
It's mostly a thought process...
I have or need something (entity), lets get data about it (repository/extensions), we need to do something with this now (only extensions).
Lots of "static" and "this" involved, but the separation and eventual simplicity makes it worth the effort.
Edit: I tried going through some of them to anonymize some for examples, but it felt like treading in dangerous territory.