Poll: What's Your Favorite Programming Language?
471–480 of 626 posts
Re: Poll: What's Your Favorite Programming Language?
#472Re: Poll: What's Your Favorite Programming Language?
#473Earlier quoted context omitted.
I hate to hijack this comment, but this topic really highlights an issue with the HN comments. It is now virtually impossible to have any broader discussion since this thread filled the page. A topic that is massively more broad than discussion about C#.
I've only been here a few years, but how and why is this new? If you're implying that it has to do with the lack of visible scores, I'd point out that I think that the comments are still ordered by score, even if they aren't necessarily displayed. If it's just because of the sheer number of comments attached to the C# specific parent, I can't remember a time when a really popular comment didn't take up a larger share…
Re: Poll: What's Your Favorite Programming Language?
#474Earlier quoted context omitted.
Writing C# code in Visual Studio feels almost like telepathy. Intellisense is so good that, it nearly writes 30-40% of total code.
if your IDE writes 30-40% of code for you it just means your language needs at least 30-40% more code than it should to cleanly describe the algorihtm. (not dissing C# here, just all IDE-aised languages)
Re: Poll: What's Your Favorite Programming Language?
#475Earlier quoted context omitted.
As someone who's more than happy with C#, I'm wondering if there's a world out there I'm missing but I can't really connect with what you're saying. 1. "Strong and intelligent"? "Convenient"? 2. "Sense of design"? My current side project includes a web scraper which uses the following open source projects: AutoMapper, CsvHelper, HtmlAgilityPack, Twitter Bootstrap, jQuery, Modernizer, Moq, NLog, MongoDB C# driver, Pet…
> 1. "Strong and intelligent"? "Convenient"? Not a C# user, but few languages of the strength and intelligence of types in ML. Covariant arrays (which C# presumably adopted for the sake of Java programmers) moves an easy, and obvious, compile time type check to runtime. The type inferencing in C# is very weak relative to ML/Haskell. The type syntax is generally more lighweight in ML/Haskell as well. For example a fun…
var firstNumber = numbers.FirstOrDefault();
(This isn't strictly the same as what you described if "None" is different from "null".) Once such a method exists, does it matter how many lines of code it is written in? I posit that every language feature in a reasonably intelligently designed language serves a valuable purpose, and that everybody has different needs, and the verbosity in C# serves certain needs.Here's an implementation in C# that is a function on types T implementing the IList interface (rather than IEnumerable like LINQ does):
public static T Head(this IList list) {
return (list == null || list.Count == 0) ? null : list[0];
}
It is used in the same way as the FirstOrDefault() example above. Much more verbose, I'll agree! But the real question for this thread is is it less convenient, and if so why? All the verbosity stems from just a few logical places:1. the 'option' function you have in your example. In reality, your 'option' is doing all the work I did above, which means that comparing the verbosity of your sample code to the C# equivalent of FirstOrDefault() is perfectly valid in my opinion :)
2. the explicit return type. This serves a valuable purpose in my opinion.
With your code, it's easy to break the hd function by changing the implementation to return a different type. You might not even notice the bug if the different type's implementation is close enough to the right one. I once had a bug like this in VB6 years ago: I changed a method to use an integer instead of a string, and VB's automatic type casting happily allowed the rest of my code to function... until in the middle of a demo I ran a function I hadn't tested and default value of 0 broke something expecting an empty string! My lesson: type inference can be dangerous.
It also makes refactoring a large project much more difficult in my opinion because there is no way to distinguish between specification and implementation. Consequently, changing your implementation runs the risk of breaking your specification without being informed.
There is a school of thought that says your unit tests should cover this aspect of the specification... but then all I'm doing is implementing explicit types in a roundabout way - let the compiler do that I say! That being said I don't know if ML/Haskell have 'interface specification' types to ward against this, where you need it (and everywhere else you get to save on verbosity)? That would be a nice improvement to C#: private methods can use extended type inference, anything public (including implementing an interface) need to be more explicit.
3. syntax: visibility (public), static modifier and return statement. This is a matter of personal preference. With Resharper in Visual Studio each of these words costs me 2 or 3 keystrokes, and if I like I can use templated code snippets to reduce that for any situation, so I'm not too bothered :)
Re: Poll: What's Your Favorite Programming Language?
#476Earlier quoted context omitted.
I find that I'm rather productive in python for scientific computing and go towards C (or occasionally even fortran) when I need something faster. I also find that it has a rather shallow learning curve for students who come in knowing java... But generally, I think it's good to pick the right language for the right domain. I keep trying to find an excuse to learn Erlang ;>
> ...go towards C (or occasionally even fortran) when I > need something faster Try cython next time.
Re: Poll: What's Your Favorite Programming Language?
#477Re: Poll: What's Your Favorite Programming Language?
#478Earlier quoted context omitted.
Sorry, wait - how is this different than the RoR magic. Where you can do stuff like MyObject.findByArbitraryProperty and it just works? That's PFM if you ask me. Django, RoR, and Node all have lots of magic bits. You don't have to use any of the magic, which also goes for MVC. (I do agree with you though - just because other frameworks have magic bits doesn't mean I like it in MVC. I would also prefer it not be there…
It doesn't fit the language and the environment. ASP.NET MVC is way too much of a RoR clone than is good for them. C# programmers aren't used to magic: they're used to compilers telling them about typos. Convention over configuration is nice, but it's essentially the concept of dynamic typing translated to frameworks. It fits badly in a statically typed language. I'd have much preferred ASP.NET MVC to have less magic…
That being said there is definitely a deficiency in strong typing in ASP.NET MVC as-is. That's why I use T4MVC (http://mvccontrib.codeplex.com/wikipage?title=T4MVC_doc&...). I'm not too sure how the MVC team have done things much differently, though, without overcomplicating the framework... you'll note the T4MVC approach is based on code generation that inspects your source tree.