Sup guys and girls. I want to learn either C# or Java. I have some experience with C from a decade or so ago at college and still remember a bit of it but it seems like these days things like C and C++ are not the most sensible choice for a desktop or mobile app.
anyway so C# or java? I am tempted by java because of android but c# looks to be a better overall language.
opinions on this sunny sunday?
Xavier Lee
they are really similar. learn both at the same time.
James Anderson
java gives you the flexibility but makes you wish you were writing c# c# gives you nothing to write
Jonathan Price
>C++ are not the most sensible choice for a desktop if you want to make something that's properly cross platform and efficient, you'd want to.
Luis Smith
>C++ >Portable
Cameron Phillips
C# is a way better language, but the java ecosystem and jvm install base is enormous.
Oliver King
C# is probably overall more pleasant to use and better supports a functional style of programming along side OO (esp. if you don't count Scala, or for some reason can't use Java 8). Also C# has developed nicer syntax for lots of common things you'll want to do (short get/sets, async/await, new null check stuff from C# 6.0).
Java if you intend to run on Linux, otherwise C# in my opinion.
Ryder Adams
What does functional stuff look like in C#?
Aaron Hughes
C# compiled with MONO is pretty usable on linux, the setup is a pain though.
Julian Gonzalez
> MONO Will be taken over by Microsoft d(b)otnet
Cooper Clark
Two things I like in the language are the ability to pass functions around as parameters, and the LINQ interface that lets you do all sorts of operations on lists/sets of objects, and chain those operations together (filter, transform, sum, etc). Biggest thing it's missing IMO is currying functions.
Ayden Thompson
Isn't that basically what Java 8's streams, lambdas, method references etc. do? Some brief examples would be nice.
Justin Roberts
On a slightly related topic, can anyone help me with this program im making on c#? Please
Brody Robinson
Yeah, that was what I said in my earlier post, that with Java 8 (and Scala) that the gap between C# and Java is basically filled. It took them many years to bridge that gap though - I would assume going forward that C# will probably lead on these types of features (like currying, I hope!)
Personally, I prefer the syntax of C#, but that doesn't count for much to you.
Daniel Jones
Post details, retard
Zachary James
That's the way it's always been. Java is deeply scarred by its legacy shit (generics, anyone?) and is always slow on the uptake.
Joshua Taylor
Lets say I have a list of objects that are all of type "Car", and I want to operate on that list.
var result = Cars.Where(c => c.Brand == "Chevy").OrderBy(c => c.Price).ToList();
I'm taking a list of cars, picking out only the Chevys and returning a list sorted by price in one line of code that's easily readable.
Kayden Sullivan
kotlin gives both
Kayden Mitchell
java 8 streams do that too? and better
Jeremiah Brown
Kotlin is obviously the only choice.
fun main(args: Array) { val numbers = listOf(1, 2, 3) println(numbers.filter(::isOdd)) }
fun isOdd(x: Int) = x % 2 != 0
Jonathan Foster
Why ToList and not ToArray?
Joseph Jenkins
Java. Has everything C# has now with Java 8. Far cleaner with things like Spring.
Also syntax is way easier.
However, they're both OO languages. You learn one and you'll know the other.
Ryder Myers
It's a playlist generating app, where the user inputs their mood (energetic, flustered, content) and the time of day (morning, noon, night). It takes the input and creates a playlist, made from six songs. I have the GUI set up if you'd like to see?
Joseph Jackson
yeah, you've been able to do similar shit in java since 8 List result = Cars.stream().filter(c -> c.Brand == "Chevy").sorted((c1, c2) -> c1.price - c2.price).toList();
Also isn't the next java introducing type inference with var?
that's a JVM language, isn't it? What's the sell?
Nathan Moore
since they are so similar to one another, i'd suggest c# at first, because Visual Studio is easier to work with than Eclipse. When you get to web services I'd say switch to Java, handles that area better.
Lincoln James
Java if you want a job, C# if you do not want to fall in mental instability.
Bentley Murphy
they're pretty much the same language, so if you learn one learning the other takes about an hour
Eli Green
What about C++?
After you learn C++ (even just the basics) you can pick up C# or Java or pretty much any other language. Also if you make it with C++ you will be a better programmer than if you start with a garbage collected language imho.
Ryan Martinez
Learning C++ is hell though.
Nathaniel Flores
Modern C++ isn't all that bad.
Julian Morales
Why do you have two params in the sorted function? Why the substraction?
Dylan Ward
You're right that C++11 fixed a lot of shit, but if you want to understand C++ properly you're essentially learning three different languages. >C >Early C++ >C++1x
Defining a comparator that compares two objects. Return value being positive, zero, or negative determines whether the two objects are greater, equal, or lesser. This is a standard Java interface.
Jose Gonzalez
Oh thank you, so I guess that depending on the result of the operation the item is placed in the sorted list
Hunter Morgan
Another thing in C# there is the sugar sintax of VAR for the left hand, in Java 8 is there something similar or you just must know the type resulting from the stream?
Caleb Foster
I believe that's in Java 9.
Benjamin Barnes
Yes, I've said as much a few times in this thread. However:
1) C# had it first. This matters if you have to work on a legacy Java system, and it also suggests C# will beat Java to market on other significant features in the future.
2) As with all things Java, syntax is just a little uglier and clunkier than C#.
Andrew Powell
>but if you want to understand C++ properly you're essentially learning three different languages. This is especially true in enterprise and project maintenance settings. C++ has changed a lot, arguably for the better, but that doesn't mean the old C++ isn't still rampant. I still, in my work, come across code that uses singletons, weird memory map tricks, and generally C-style conventions for enterprise problems.
My dream is that Stroustrup one day goes insane and deprecates all the old C++ conventions. He and his board are a bunch of pussies. They'll urge and pressure people to use the modern C++ conventions via the new standards and standard libraries, but people still sperg out against RAII and smart pointers. They'd prefer to maintain their ancient code bases that are riddled with early implementations of OOP that simply suck a giant cock. I want Stroustrup to develop a metaphorical dementia or Alzheimer's and just straight up send out a standard like:
>What the fuck is a macro? I looked at that shit just yesterday and thought it was hella-fucked-up. Fuck that shit, nigga. Macros are DEPRECATED! You use that shit? Good luck, dude. My standard doesn't even have macros. Is that some dumb fuckery wizardry? Nah, I'm not doing that. Obey my type and scope rules. NO MORE FUCKING MACROS REEEEEEEEEEEEEEEEEEEEEEE *proceeds to throw chairs at insane asylum security guards*
Parker Thompson
>Within C++, there is a much smaller and cleaner language struggling to get out
The older the language gets and the more it improves, the truer this becomes. Some day we'll get a true successor.
Sebastian King
>The older the language gets and the more it improves Maybe in research papers and small projects this is true, but in the businessware shit I deal with all I see is garbage.
I see old, bug ridden, solutions every fucking day. It's terrible. I'll walk into pajeet-tier code every time I consult for a moderately aged firm or corporation. Fuck, I've seen C++ code that doesn't use ANY C++ conventions besides classes. I'm talking Doom 3 style syntax where the C++ is just "C with classes". And I don't mean the classy way like in Doom 3. Noooo, I mean the shit ridden way where I looked at performance and I notice they're using a basically Boost 1.0 library with huge memory hogging.
Justin Sanchez
java is cancer it's a slow and gigantic resource hog literally anything is better it had one pro - being cross platform, but now afaik C# also has linux and mobile implementations so I don't see a reason to recommend java
Nicholas Jackson
What do you consider to be fast?
Joseph Hall
>it's a slow and gigantic resource hog It's not 2004 any more.
Eli Wilson
Yeah, it takes even more memory than it was in 2004 so it could be as slow as it was.
Colton Carter
I think you misunderstand. The language spec improves, and new constructs emerge that supersede old techniques. The language, generally speaking, improves. But all your old code is still around. It sucked before, but it's even worse now that you know what the better way to do things is. You have to maintain all that old shit while striving to do things the new way. This is what makes C++ dirty and bloated. nu-C++ is something I could quite like, if it took a torch to everything else.
Nicholas Hernandez
>Yeah, it takes even more memory than it was in 2004 so it could be as slow as it was. Uhh, by what measure?
Alexander Reed
>nu-C++ is something I could quite like, if it took a torch to everything else. Oh definitely. "nu-C++" is pretty solid.
Lincoln Wilson
C++ also simplifications they've added since C++11 makes it pretty much just as easy to develop and debug as managed languages pretty much a perfect programming languages
>2004 uhuh although I haven't touched java in half a decade, last time I did touch it, it was still a slow resource hog.
Elijah Hughes
C# If you're interested in android check the Xamarin framework to write multiplatform phone apps in c#
Isaiah Lewis
C++ is an exception. It might run twice as fast but it'll also take twice as long to develop. Generally speaking, your time is more valuable than the computer's.
As far as GC languages go, Java's fast.
Nathan Kelly
So it looks like 50/50. Guess I should just flip a coin?
I appreciate the advice on C++ but I have until the end of September to learn enough to get a job. If I can't do that then I will accept that I will forever be a NEET :(
Jack Thompson
Definitely Java. There's no question if you just need to get a job.
Asher Moore
Java EE cannot be replaced with C#.
Connor Cook
yeah this is what i am thinking.
i just need to get my shit together and find a job. i can learn C++ or whatever else later but I have to get a job. I have set a target for 4-5 months as I already have some programming experience from back in college and I wasn't totally shit at it so I am not starting from zero. Still gonna be a fucking tough few months. I want to get a handful of projects on github and maybe a couple of apps in the play store just to show I an actually program and get stuff released.
Luis Cooper
Well fucking do it, you won't learn here on Sup Forums.
Joshua Jenkins
Yeah I literally installed IntelliJ 2 minutes ago. I just wanted to ask about java and c# as I wasn't sure which to pick
Julian Campbell
Someone please reassure me that C# is not a meme so I can feel good about myself.
Oliver Gomez
No. Streams feels like a clunky afterthought. Having to call .stream() is a PITA. The corresponding functionality in C# uses the IEnumerable interface which is used for pretty much everything. Also, the functional interfaces in Java can not throw checked exceptions. A PITA to use with existing code throwing such. Not a problem in C# since there are no checked exceptions. Furthermore, the interface naming. In Java there's like 40~ interfaces with different names, in C# there's Action and Func.
Josiah White
Everything that was added to java to "fix" it is an afterthought. Even stuff as ancient as generics. Java 8 stuff is fun to use but still pretty broken.
Isaiah Reed
>Everything that was added to java to "fix" it is an afterthought. Even stuff as ancient as generics. >Java 8 stuff is fun to use but still pretty broken. I don't disagree
Aaron Hernandez
> The corresponding functionality in C# uses the IEnumerable interface
And the same functionality including the syntactic sugar of 'natural' LINQ also ties to the IQueryable interface, supporting custom pluggable LINQ providers that allow you to map expressions to things other than plain object searches.
I.e. you can write database queries, OData queries, queries for search products such as solr or elasticsearch, etc.
Once Java gets that shit ironed out, _then_ it'll truly have that feature on par with C#.
Justin Russell
>it seems like these days things like C and C++ are not the most sensible choice for a desktop This is wrong, people will avoid your application if you use one of these languages due to the big amount of dependencies. Moreover they are shitty, pajeet and cause bloat. Please use Scheme or C instead.