Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (775)
Games in Android Showcase (230)
games submitted by our members
Games in WIP (856)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1] 2
  ignore  |  Print  
  C#, did Microsoft just want to be different?  (Read 17486 times)
0 Members and 1 Guest are viewing this topic.
Offline Gibbo3771

JGO Kernel


Medals: 128
Projects: 5
Exp: 1 year


Currently inactive on forums :(


« Posted 2014-11-24 20:04:05 »

I have been using C# for the past week or 2, so far it has been a breeze but some things are really annoying me and it seems like it is due to Microsoft just wanting to be "different".

First off, Dictionary. Who named this? Every other languages uses the name Map, as in your map a key to a value. Even other languages by MS use map, like F#.

The List, addRange(). Why addRange? This gives me the impression I am wanting to add elements within a range inside the list, what is wrong with addAll()?

There is a lot of other nitpicky stuff that just seems illogically named, Visual Studio likes to call a project a solution, is there not supposed to be a problem?


"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Offline BurntPizza

« JGO Bitwise Duke »


Medals: 486
Exp: 7 years



« Reply #1 - Posted 2014-11-24 20:17:42 »

I'm pretty sure all those names are common conventions elsewhere, the universe didn't begin with Java.

Dictionary is pretty common (although I do prefer Map for it's mathematical connotation), one could argue that addRange is more accurate and clear as to what it means than addAll, given that the parameter is not (I don't think) necessarily all of the elements of a collection.
I did think "Solution" was a bit gimmicky, but it still makes sense at least.
Offline trollwarrior1
« Reply #2 - Posted 2014-11-24 20:26:48 »

At my work there is a lib made by some guy who used to work there and List's .size funcion is called .Usage() o-o
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline HeroesGraveDev

JGO Kernel


Medals: 382
Projects: 11
Exp: 4 years


┬─┬ノ(ಠ_ಠノ)(╯°□°)╯︵ ┻━┻


« Reply #3 - Posted 2014-11-24 20:29:45 »

To be fair the Java standard libraries can't agree on how to the length of a string, array, or collection. (.length(), .length, .size(), respectively)

Offline KevinWorkman

« JGO Plugged Duke »


Medals: 287
Projects: 12
Exp: 12 years


HappyCoding.io - Coding Tutorials!


« Reply #4 - Posted 2014-11-24 21:19:34 »

First off, Dictionary. Who named this? Every other languages uses the name Map, as in your map a key to a value. Even other languages by MS use map, like F#.

Java 1.0 had a Dictionary class: https://docs.oracle.com/javase/7/docs/api/java/util/Dictionary.html

The Map interface didn't come around until Java 1.2.

HappyCoding.io - Coding Tutorials!
Happy Coding forum - Come say hello!
Offline Slyth2727
« Reply #5 - Posted 2014-11-24 21:40:43 »

All I have to say about C# is that to me it's Java and so much more. Of course there are upsides to Java, but I fell in LOVE with C# when I first learned it.
Offline princec

« JGO Spiffy Duke »


Medals: 1059
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #6 - Posted 2014-11-24 22:23:20 »

In many ways it's inconsistent and rushed feeling. Definitely feels incomplete. I enjoyed extension methods, briefly. The different bracketing layout convention irritates me on sight but that's just a case of what I'm used to.

It seems like it's had the kitchen sink bolted on to it and every other kitchen appliance going to try and appease everyone with a personal issue with some aspect of the language and this hasn't helped its readability or even its design as a language. The whole properties / events thing is like a DSL somehow finding its way into the core language and I have a small vendetta against properties anyway. Methods not being virtual by default is irritating.

What I have rather liked about C# is the ability to use value types (yay!) although it's far less intuitive than you'd expect when they start mingling with reference types. Also I had a brief affair with extension methods though I am now slightly wary about their potential for unexpected meaning in code.

At the end of the day though... it's just not really anywhere near as good as Java is. It's just such a shame Java is so damned difficult to port to other platforms.

Cas Smiley

Offline thedanisaur

JGO Knight


Medals: 59



« Reply #7 - Posted 2014-11-24 23:49:38 »

Actually a project is not a soultion. A solution can hold multiple projects  Wink

Every village needs an idiot Cool
Offline SHC
« Reply #8 - Posted 2014-11-25 05:09:56 »

Why nobody mentioned events and beautiful delegates?  Huh

Offline Roquen

JGO Kernel


Medals: 518



« Reply #9 - Posted 2014-11-25 08:32:06 »

Actually dictionary is more accurate.  We don't (generally) have 1 to N maps, we have 1-to-1 or N-to-1 maps, which are dictionaries.  The only reason I like map is because it's less characters to type.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #10 - Posted 2014-11-25 09:25:23 »

For everything there is, there is a microsoft equivalent.
from Silverlight to Zune.

they even got into gaming with the original xbox no one really cared about. all of that because microsoft is... well I can find too many insults here

they want to be everywhere, and they like doing a lot of things bad, instead of one or a couple things good.

thats why all their products are rushed beyond believe, hurry and make money, dont care about the quality
sucky xbox 360 architecture leading to the RROD and all the windows problems from freezing, locking and BSODs are just the most famous examples

microsoft is quantity over quality basically

so yeah @topic, a lot of their crappy products have these distinction purely so they are different

"Solution" is not even a technical term, its a marketing term.
But seeing as they use "experience" up the ass with the xbox, it doesnt surprise.

Offline princec

« JGO Spiffy Duke »


Medals: 1059
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #11 - Posted 2014-11-25 09:56:12 »

Hm let's be fair here: Windows is excellent (still the best desktop OS IMHO) and MSVC++ is likewise state-of-the-art when it comes to C++ development. And Office is also pretty much awesome. And SQL Server. And even IIS, and IE11. And DirectX is basically converging on OpenGL. They've got a history of awesome software.

...and of course they also have a history of "yeah and we can do that too! With blackjack! And hookers!" with things like .net and C# but for all of that I'm glad it exists because it's brought next-generation programming ideas to a load of old farts (crazy stuff like JIT, garbage collection, and array bounds checks!) who thought that everything should be hewn from C++ using toothpicks and were frightened of Java because of Sun's incredibly inept handling. The competition from C# has done Java a power of good.

Cas Smiley

Offline SHC
« Reply #12 - Posted 2014-11-25 10:16:24 »

One major difference, is that it is possible to assign to
this
in C# structures. An example that uses that feature is OpenTK's Math structures, Matrix3 struct does this, for example.

1  
2  
3  
4  
5  
6  
7  
8  
9  
public void Transpose()
{
    this = Matrix3.Transpose(this);
}

public static Matrix3 Transpose(Matrix3 mat)
{
    return new Matrix3(mat.Column0, mat.Column1, mat.Column2);
}

So simple, isn't it? Yeah it confused me a lot at first, but it is possible (not in Java!!) only in structs.

Offline Stranger
« Reply #13 - Posted 2014-11-25 10:32:40 »

IIRC, something similar was in C++ v1  Huh

Anton
Offline ags1

JGO Kernel


Medals: 367
Projects: 7


Make code not war!


« Reply #14 - Posted 2014-11-25 11:15:12 »

Actually dictionary is more accurate.  We don't (generally) have 1 to N maps, we have 1-to-1 or N-to-1 maps, which are dictionaries.  The only reason I like map is because it's less characters to type.

One of my most used util classes is my OneToManyMap :-)

Porting a Java map (that can return null) to a C# dictionary using TryGetValue() calls is a highly tedious activity. I don't know enough about C#, but does it have a weak (non-existant keys allowed) dictionary variant?

Offline Gibbo3771

JGO Kernel


Medals: 128
Projects: 5
Exp: 1 year


Currently inactive on forums :(


« Reply #15 - Posted 2014-11-25 11:32:21 »

I didn't meant to start a language vs language thing here, I was genuinely curious to these naming conventions and why C# had to be different from other OOP languages despite sharing the exact same principles.

Actually a project is not a soultion. A solution can hold multiple projects  Wink

Soooo...you mean a workspace like every other IDE has? :p

I'm pretty sure all those names are common conventions elsewhere, the universe didn't begin with Java.

My original post seemed biased, apologies. I know it never began at Java lol. I was merely saying that when I had a look at Java, C++ and then I opened up VS and looked at my C# code, it seemed that things were different; for no reason other than "just because".

Why nobody mentioned events and beautiful delegates?  Huh

Topic is not really about functionality, more about functions that exist in each language but named differently. But yes, delegates and events are sexy. I do like anonymous "interfaces" with Java though, frowned upon but good for firing in small and quick callback even type code.

Microsoft is shite rant

Someone that feels the same as me, have a medal.

"This code works flawlessly first time and exactly how I wanted it"
Said no programmer ever
Offline richierich
« Reply #16 - Posted 2014-11-25 13:03:38 »

Re. C# is unnecessarily different: Maybe they felt they were improving things ... maybe they did ... maybe Java is not and has never been the perfect language...maybe the Java Executive Committee would be a tad conservative and slow-moving without Microsoft hustling them along...

From Wikipedia "...recent versions of Java (notably version 5.0) have in turn implemented ideas originally implemented in C#, such as the foreach construct, autoboxing, methods with variable number of parameters (varargs), enumerated types, and annotations".

In general, I think competition is good, even if sometimes we wish "our side" would "win" forever and all the "enemies" would go away and die. Visual Studio vs Eclipse, Java vs C#, Microsoft vs IBM or whoever, Intel vs AMD, Windows vs *nix, ad infinitum. Standards consistently raised.

Re. VS, well obviously it's such a tribal thing there's no point arguing too hard but, I mean, a good, free IDE, what's not to like Cheesy
Offline hwinwuzhere
« Reply #17 - Posted 2014-11-25 19:05:45 »

maybe Java is not and has never been the perfect language...

Is any programming language really perfect? There is always something. IMHO Java is just a very accessible and easy to use language.

There are two kinds of people in this world: Those who can extrapolate from incomplete data,
Offline thedanisaur

JGO Knight


Medals: 59



« Reply #18 - Posted 2014-11-25 19:46:41 »

Actually a project is not a soultion. A solution can hold multiple projects  Wink
Soooo...you mean a workspace like every other IDE has? :p

Not quite, VS has a workspace, it's like an umbrella that encloses multiple projects, the purpose? IDK, but it's there. I was originally pissed that Java had packages, you have a src folder why need another? Now I know better.

it seemed that things were different; for no reason other than "just because".

Things are this way in every language, they all have pros and cons. Microsoft probably looked at Java and thought, hey you know, this language is cool, but I bet we could do better and did their version. Is it better? meh....it's hard to say.

The world is full of grey


Every village needs an idiot Cool
Offline princec

« JGO Spiffy Duke »


Medals: 1059
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #19 - Posted 2014-11-25 20:40:18 »

Everything's blue in this world.

Cas Smiley

Offline nerb
« Reply #20 - Posted 2014-11-26 06:05:50 »

Is it just me, or is C# the language to learn if you want to land a software developer role? I think it's time I dived in to it...
Offline Cero
« Reply #21 - Posted 2014-11-26 07:12:34 »

I mean microsoft is "only" absolutely shit, not really in relative terms... Meaning all OSs sucks unfortunately, Windows just sucks the least. Although I dont use another MS software besides windows and office and even office with the new top bar thingy bullshit makes libre office look even better, so I don't know

Offline atombrot
« Reply #22 - Posted 2014-11-26 08:07:42 »

I know I'm a bit in a lonely place, here in a java gaming forum, but c# rocks and makes it a lot easier and more fun to program. I don't say java is bad. But java is very verbose and c# simply has made better design decisions in some places (also worse in others. one think I like better in java is that methods are overridable by default. Prefer itthat way but I understand the reasoning behind the default settings in c#. It makes the developer think more about his public API and what parts can be reused.).

The language itself is great. real generics, reflection of generic information, user defined value types, value types used as generic parameter, properties, var, dynamic, extension methods, first class functions, expression tree, yield, operator overloading. All those features and gimmicks make your life a lot easier if you understand them well and use them at the right places, as you write cleaner, shorter and more readable code.

For game dev I use java, at work I have the pleasure of working with c#, java, groovy, sql, javascript and some other uglier things. Don't get me wrong. We got shit done in java and we get shit done with c#. But the stuff with c# let's us concentrate a lot more on the actuall business problems and hides a lot of the technical noise...

The biggest downside for me until now was the lock in on windows. But now that microsoft open sourced most of .net (including the asp.net part) i can finally run an asp server cheaply.

@nerb: here in central europe both java and c# devs are in demand. It feels a bit like the demand for c# .net is a bit higher, but that might be subjective for our company or location.
Offline princec

« JGO Spiffy Duke »


Medals: 1059
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #23 - Posted 2014-11-26 09:39:03 »

Verbosity suddenly becomes a great asset when you've got to read someone else's code. Which is what I spend 99% of my coding time doing (usually looking at code the old me wrote, 6 months ago) and I bet you do too.

Cas Smiley

Offline Roquen

JGO Kernel


Medals: 518



« Reply #24 - Posted 2014-11-26 09:50:47 »

I'm the opposite.  For code only I'll read, it tends to be very terse and I inject some comments if I doubt I'll remember what or why some at some point in the future.  I have trouble doing the diagonal scan thing with verbose code.
Offline atombrot
« Reply #25 - Posted 2014-11-26 09:58:10 »

Verbosity suddenly becomes a great asset when you've got to read someone else's code. Which is what I spend 99% of my coding time doing (usually looking at code the old me wrote, 6 months ago) and I bet you do too.

Cas Smiley

For me it's the opposite with java... the relevant business logic is hidden by javas high verbosity which makes it harder to understand what is going on. Less verbosity is not equals less readability. Don't confuse the two. C# allows you to strip away more than is good. But if you do strip away the right amount you have less but better readable code...

Edit:
Just as an example:
"I have an apple. This apple I have is green. This apple I have has a sour taste. This apple I have has been bought by me for 1 dollar."
"I have a green, sour tasting apple, that i have bought for 1 dollar."

Both examples transport the same information, but the first one has just a lot more verbosity, which in turn has a negative impact on the readability. It takes longer to understand the first example, just because you have to read more to get the relevant information. The example is a bit constructed, but having devloped c# and java for some years it is exactly how it feels to me.
 I agree that making code less readable is a very bad thing. But in my opinion more verbose code is less readable.
Offline pjt33

« JGO Spiffy Duke »


Medals: 40
Projects: 4
Exp: 7 years



« Reply #26 - Posted 2014-11-26 10:53:17 »

My original post seemed biased, apologies. I know it never began at Java lol. I was merely saying that when I had a look at Java, C++ and then I opened up VS and looked at my C# code, it seemed that things were different; for no reason other than "just because".

C# wasn't only aimed at people with a C++/Java background. It was also aimed at people with a Visual Basic background. I suspect that that's the reason for the naming conventions: the .Net library followed the pre-.Net VB library and the Win32 API in general. (Quite a few parts of the .Net API are just thin wrappers around Win32).
Offline princec

« JGO Spiffy Duke »


Medals: 1059
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #27 - Posted 2014-11-26 11:09:20 »

I wonder why people find there to be a distinction between business logic and stuff like "exception handling" and "transactions" and the like... it's all the same and all as important as anything else. Trying to hide stuff away like that leads to all the most difficult to diagnose bugs that I've ever come across. The actual core of the "business logic" as such is usually trivial - like "subtract money from account and ensure it cannot go below zero", but the devil always hides in the actual details surrounding it. I like to see exactly what's going on*

Cas Smiley

* which leads me to one of my greatest beefs with OOP - encapsulation. In 20 odd years of using OOP I conclude that not being able to see what an implementation is actually up to under the hood is not a good thing.

Offline atombrot
« Reply #28 - Posted 2014-11-26 12:38:16 »

@cas: you don't seem to understand my point. If done properly you don't hide anything (if you are hiding relevant information you are doing it wrong). You just need less code to express the same logic and because of that you need to read less code to understand the underlying logic. It's as simple as that.

And not sure what projects you worked on, but the example you have given is probably the simplest form of complexity I have come accross in real life. Our business rules/logic are/is a lot more complex in many projects I have worked on.  
Offline princec

« JGO Spiffy Duke »


Medals: 1059
Projects: 3
Exp: 20 years


Eh? Who? What? ... Me?


« Reply #29 - Posted 2014-11-26 14:02:34 »

Well, I've worked on rather more complicated stuff to be sure but the rules are rarely significantly more complex than that. Certainly nothing even approaching the complexity of say, a sort algorithm, or a sprite engine.

Maybe someone can give me some examples of this so-called verbosity.

Cas Smiley

Pages: [1] 2
  ignore  |  Print  
 
 

 
EgonOlsen (1869 views)
2018-06-10 19:43:48

EgonOlsen (1901 views)
2018-06-10 19:43:44

EgonOlsen (1258 views)
2018-06-10 19:43:20

DesertCoockie (1703 views)
2018-05-13 18:23:11

nelsongames (1379 views)
2018-04-24 18:15:36

nelsongames (2003 views)
2018-04-24 18:14:32

ivj94 (2753 views)
2018-03-24 14:47:39

ivj94 (1955 views)
2018-03-24 14:46:31

ivj94 (3045 views)
2018-03-24 14:43:53

Solater (1090 views)
2018-03-17 05:04:08
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!