3 ms·
That's just bading coding style, most C# code is not that verbose and crazy.
by manigandham 10y ago
That's just bading coding style, most C# code is not that verbose and crazy.
- rubber_duck 10y agoMany people like C# because compared to Java it's about half the verbosity - C# is still a very limited language with plenty of verbosity and tedium built in, something like F# just blows it away in comparison (even more than C# does Java). Not to mention that the standard OO cult of unit test / mock everything and make everything "reusable" leads to such shitty designs that almost fall out naturally from the language/paradigm. Oh and the one class per file with 3 method interfaces and 10 ceremony lines with namespaces and import definitions/braces. I prefer C# over Java, and in some cases even over F# (it's slightly lover level and therefore it's simpler to control for things like heap allocation) but it usually is that verbose and crazy in the real world from my experience.
- edgyswingset 10y ago> Not to mention that the standard OO cult of unit test / mock everything and make everything "reusable" leads to such shitty designs that almost fall out naturally from the language/paradigm. Not sure I'd call it a cult. From an F# perspective I do it this way: * REPL-driven work to get it up and running * Unit tests to protect what needs to be correct against change * Mock the service boundaries * Expose object-oriented layer to C#/VB consumers Unit tests, mocking, and reusability are good things. Overuse (e.g., mocking to make sure that X calls Y in some business logic engine) is just what it is - overuse. Users of functional languages have their own problems, like suffering from code golf and over-using partial application. I wouldn't call one any worse than the other, it's just the functional crowd is smaller so you see it less.
- rubber_duck 10y agoThere are a bunch of "preachers" who advocate "best practices" which are rarely presented as "we had A and B problems and X worked out better than Y", instead it's "X gives you 1/2/3/4 over Y and therefore X is better", and the community follows along - cult like. Limited nature of language helps promote these "patterns" and "best practices" because it's often hard to find a better solution and much simpler to just apply them indiscriminately, and you end up with verbose and crazy code that the C# ecosystem is full of. I agree that both have their own issues but I do think one is better than the other, F# is more succinct (without turning in to code golf) and (actually) being multi paradigm avoids cases where OO just doesn't fit well. With micro services, actors, distributed computing, etc. those cases are expanding.
- manigandham 10y ago> Not to mention that the standard OO cult of unit test / mock everything and make everything "reusable" leads to such shitty designs that almost fall out naturally from the language/paradigm. Oh and the one class per file with 3 method interfaces and 10 ceremony lines with namespaces and import definitions/braces. This is the bad coding style I'm talking about... C# is pretty great but it cant stop people from just writing more for no reason.
- userbinator 10y agoYou haven't seen a lot of C# code then... in my experience, as the sibling comment points out, it's slightly better than Java, but what I've noticed is that C# is gradually becoming more abstract and "enterprisey" while Java is actually getting better, moving in the other direction.
- KirinDave 10y agoNot sure what you expect to happen here though. Just like Akka or Erlang named services, what's happening here is you're asking the runtime to find (or in this case perhaps instantiate) an instance and proxy for said instance of the class. You're calling the global reference, asking it to give you a proxy to that object, and you need to mention somewhere in the line what type you expect. Without a stronger type system or a complete abandonment of type safety, the most you could do is shorten this by 1 term and move the type from the template term to the left (something has to assert the programmer expects IBrainStuff). The only other way to do this is explicit code generation (ugh) or implicit code generation (e.g., F# type providers). Which is why in a sibling comment I mentioned I think that an F# binding to this library would be generally more acceptable for people who dislike that kind of abstraction, because the type system can do a lot more to help. Erlang's model of actors and messages isn't "enterprisey" and this isn't "enterprisey" code, this is just "sufficiently complex OO code." If you like strongly typed OO languages, this style of coding is your nemesis and your hero at the same time.