[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Java or C#?

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 61
Thread images: 4

File: csharp-vs-java.png (31KB, 220x140px) Image search: [Google]
csharp-vs-java.png
31KB, 220x140px
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?
>>
>>60261252
they are really similar. learn both at the same time.
>>
java gives you the flexibility but makes you wish you were writing c#
c# gives you nothing to write
>>
>>60261252
>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.
>>
File: i701^cimgpsh_orig.png (20KB, 174x162px) Image search: [Google]
i701^cimgpsh_orig.png
20KB, 174x162px
>>60261321

>C++
>Portable
>>
>>60261252
C# is a way better language, but the java ecosystem and jvm install base is enormous.
>>
>>60261252
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.
>>
>>60261368

What does functional stuff look like in C#?
>>
>>60261368
C# compiled with MONO is pretty usable on linux, the setup is a pain though.
>>
>>60261464
> MONO
Will be taken over by Microsoft d(b)otnet
>>
>>60261400
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.
>>
>>60261540

Isn't that basically what Java 8's streams, lambdas, method references etc. do? Some brief examples would be nice.
>>
On a slightly related topic, can anyone help me with this program im making on c#? Please
>>
>>60261556
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.
>>
>>60261611
Post details, retard
>>
>>60261613

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.
>>
>>60261400
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.
>>
>>60261294
kotlin gives both
>>
>>60261661
java 8 streams do that too? and better
>>
Kotlin is obviously the only choice.

fun main(args: Array<String>) {
val numbers = listOf(1, 2, 3)
println(numbers.filter(::isOdd))
}

fun isOdd(x: Int) = x % 2 != 0
>>
>>60261661
Why ToList and not ToArray?
>>
>>60261252
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.
>>
>>60261627
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?
>>
>>60261661

yeah, you've been able to do similar shit in java since 8
List<Cars> 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?


>>60261673

that's a JVM language, isn't it? What's the sell?
>>
>>60261252
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.
>>
>>60261252
Java if you want a job, C# if you do not want to fall in mental instability.
>>
they're pretty much the same language, so if you learn one learning the other takes about an hour
>>
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.
>>
>>60263010

Learning C++ is hell though.
>>
>>60263025
Modern C++ isn't all that bad.
>>
>>60261714
Why do you have two params in the sorted function? Why the substraction?
>>
>>60263077

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

>>60263079

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.
>>
>>60263141
Oh thank you, so I guess that depending on the result of the operation the item is placed in the sorted list
>>
>>60263141
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?
>>
>>60263221

I believe that's in Java 9.
>>
>>60261714
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#.
>>
File: dong.png (290KB, 343x432px) Image search: [Google]
dong.png
290KB, 343x432px
>>60263141
>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*
>>
>>60263306

>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.
>>
>>60263342
>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.
>>
>>60261252
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
>>
>>60263469

What do you consider to be fast?
>>
>>60263469
>it's a slow and gigantic resource hog
It's not 2004 any more.
>>
>>60263512
Yeah, it takes even more memory than it was in 2004 so it could be as slow as it was.
>>
>>60263416

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.
>>
>>60263522
>Yeah, it takes even more memory than it was in 2004 so it could be as slow as it was.
Uhh, by what measure?
>>
>>60263574
>nu-C++ is something I could quite like, if it took a torch to everything else.
Oh definitely. "nu-C++" is pretty solid.
>>
>>60263501
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

>>60263512
>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.
>>
>>60261252
C#
If you're interested in android check the Xamarin framework to write multiplatform phone apps in c#
>>
>>60263851

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.
>>
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 :(
>>
>>60264134

Definitely Java. There's no question if you just need to get a job.
>>
>>60261252
Java EE cannot be replaced with C#.
>>
>>60264153
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.
>>
>>60264204

Well fucking do it, you won't learn here on /g/.
>>
>>60264242
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
>>
Someone please reassure me that C# is not a meme so I can feel good about myself.
>>
>>60261686
No. Streams feels like a clunky afterthought. Having to call .stream() is a PITA. The corresponding functionality in C# uses the IEnumerable<T> 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.
>>
>>60264334

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.
>>
>>60264397
>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
>>
>>60264334
> The corresponding functionality in C# uses the IEnumerable<T> interface

And the same functionality including the syntactic sugar of 'natural' LINQ also ties to the IQueryable<T> 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#.
>>
File: 1487928505289.jpg (163KB, 600x894px) Image search: [Google]
1487928505289.jpg
163KB, 600x894px
>>60261252
>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.
Thread posts: 61
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.