language-features

What programming language construct do you find the most useful?

Before I started branching out and learning other languages, I naively believed I could get by with the features Java provided. Since learning Ruby and some other languages that are very different from Java, I have found that there are some really powerful language features that I miss a lot when I go back to Java. I am curious, what a...

What is the prefered style for single decision and action statements?

In the case of languages that support single decision and action without brackets, such as the following example: if (var == true) doSomething(); What is the preferred way of writing this? Should brackets always be used, or should their usage be left as a preference of the individual developer? Additionally, does this practice dep...

Interpreted languages - leveraging the compiled language behind the interpreter

If there are any language designers out there (or people simply in the know), I'm curious about the methodology behind creating standard libraries for interpreted languages. Specifically, what seems to be the best approach? Defining standard functions/methods in the interpreted language, or performing the processing of those calls in the...

What is the hardest language to learn?

Following on from Teifion's recent post "Easiest language to start with", I'm interested in the community's thoughts on what is generally considered the hardest programming language to learn. Something of an elitist's dream to be able to mention at geek cocktail parties. I'm not just talking about ones with the strangest syntax, but als...

Expression Versus Statement

I'm asking with regards to c#, but I assume its the same in most other languages. Does anyone have a good definition of expressions and statements and what the differences are. Thanks in advance. ...

Do You Really Know Your Programming Languages?

I am often amazed at how little some of my colleagues know or care about their craft. Something that constantly frustrates me is that people don't want to learn any more than they need to about the programming languages they use every day. Many programmers seem content to learn some pidgin sub-dialect, and stick with that. If they see a...

GOTO command in PHP6?

I've heard rumors that PHP6 is planning on introducing a "goto" command. What is it supposed to be doing, once PHP6 gets out? I've tried searching a bit, but haven't found anything awfully descriptive. I understand that it won't be a "GOTO 10"-like command... ...

Python descriptor protocol analog in other languages?

Is there something like the Python descriptor protocol implemented in other languages? It seems like a nice way to increase modularity/encapsulation without bloating your containing class' implementation, but I've never heard of a similar thing in any other languages. Is it likely absent from other languages because of the lookup overhea...

What are the differences between "generic" types in C++ and Java?

Java has the generic keyword and C++ provides a very strong programming model with templates. So then, what is the difference between C++ and Java generics? ...

Double dispatch in C#?

I have heard/read the term but don't quite understand what it means. When should I use this technique and how would I use it? Can anyone provide a good code sample? ...

Are there legitimate uses for JavaScript's "with" statement?

Alan Storm's comments in response to my answer regarding the with statement got me thinking. I've seldom found a reason to use this particular language feature, and had never given much thought to how it might cause trouble. Now, I'm curious as to how I might make effective use of with, while avoiding its pitfalls... So my question is, ...

DateTime.Now vs. DateTime.UtcNow

I've been wondering what exactly are the principles of how the two properties work. I know the second one is universal and basically doesn't deal with time zones, but can someone explain in detail how they work and which one should be used in what scenario? ...

What is an example of "this" assignment in C#?

Does anybody have useful example of "this" assignment inside a C# method? I have been asked for it once during job interview, and I am still interested in answer myself. Thank you! ...

What languages do date, time, and calendar operations really well?

This is probably too much to ask, but is there any language that does a really terrific job of representing time and date operations? I'll grant straight away that it's really hard to write a truly great time library. That said, are there any widespread languages that have one? Basically, I want something that handles time and date as...

Handling the data in an IN clause, with SQL parameters?

We all know that prepared statements are one of the best way of fending of SQL injection attacks. What is the best way of creating a prepared statement with an "IN" clause. Is there an easy way to do this with an unspecified number of values? Take the following query for example. SELECT ID,Column1,Column2 FROM MyTable WHERE ID IN (1,...

Why doesn't VB.NET 9 have Automatic Properties like C# 3??

Would having a nice little feature that makes it quicker to write code like Automatic Properties fit very nicely with the mantra of VB.NET? Something like this would work perfect: Public Property FirstName() As String Get Set End Property UPDATE: VB.NET 10 (coming with Visual Studio 2010 and .NET 4.0) will have Automatic Prop...

How does "this" keyword work within a JavaScript object literal?

I just came across an interesting situation in Javascript. I have a class with a method that defines several objects using object-literal notation. Inside those objects, the this pointer is being used. From the behavior of the program, I have deduced that the this pointer is referring to the class on which the method was invoked, and ...

What language features (1 per answer please) should be added to VB.NET in future versions?

What languages feature (1 per answer please) should be added to VB.NET in future versions? Update: where possible provide links to examples of language feature as used elsewhere. ...

Javascript as a functional language

I am looking get to grips with functional programming concepts. I've used Javascript for many years for client side scripting in web applications and apart from using prototypes it was all simple DOM manipulation, input validation etc. Of late, I have often read that Javascript is one of the languages that supports functional program...

Will a future version of .NET support tuples in C#?

.Net 3.5 doesn't support tuples. Too bad, But not sure whether the future version of .net will support tuples or not? ...