language-agnostic

Recursion or iteration?

I love recursion. I think it simplifies things a lot. Another may disagree; I think it also makes the code a lot easier to read. However, I've noticed that recursion is not used as much in languages such C# as they are in LISP (which by the way is my favorite language because of the recursion). Does anybody know if there is any good re...

multi locale validation of input

Hi all, When validating user inputs in an application that is to be run across multiple locales, what is the most appropriate way of doing this? I encountered this in a project I was on a few years ago, and I am interested now in looking back at how else we could have tackled this problem. Ideas I have had are to either write an input ...

What is the best way to sort a partially ordered list?

Probably best illustrated with a small example. Given the relations A < B < C A < P < Q Correct outputs would be ABCPQ or APQBC or APBCQ ... etc. In other words, any ordering is valid in which the given relationships hold. I am most interested in the solution that is easiest to implement, but the best O(n) in speed and time is int...

Beautiful charting/graphing/scientific plotting

Are there any open-source charting libraries (at this point, I don't care what language/platform it's available for) that can produce "really, really, ridiculously good looking" plots, preferably with features for "scientific" plotting such as error bars? Keynote and Office 2007 really opened my eyes to the aesthetics, and I'm accustome...

What languages support multiple inheritance?

What languages support multiple inheritance and what techniques do they use to mitigate the problems that arise from using multiple inheritance? ...

Does the frequent change of requirements lead to spaghetti code?

If the requirements are changing frequently and you want to deliver your code in time so What is the best solution or methodology used to overcome going to spaghetti? ...

File Extension to MIME Type Web Service?

Are there any web services which will allow me to provide a file extension and it would return a list of possible MIME types? For example: http://mimetype.com/getMime/doc Which could return: application/msword,application/docappl/text,application/vnd.msword,application/vnd.ms-word,application/winword,application/word,application/x-...

Why do most languages not allow binary numbers?

Why do most computer programming languages not allow binary numbers to be used like decimal or hexadecimal? In VB.NET you could write a hexadecimal number like &H4 In C you could write a hexadecimal number like 0x04 Why not allow binary numbers? &B010101 0y1010 Bonus Points!... What languages do allow binary numbers? Edit Wo...

An algorithm to "spacify" CamelCased strings

Pretty basic, I'm just curious how others might implement this algorithm and would like to see if there are any clever tricks to optimize the algorithm...I just had to implement this for a project that I am working on. Given a string in CamelCase, how would you go about "spacifying" it? e.g. given FooBarGork I want Foo Bar Gork back. ...

Do you print hard copies of requirements, design documents and code?

I like to print out software requirements so I can easily mark them up, sketch UIs, etc. Do you print out requirements and design materials ahead of time or just view them digitally? What features make for the ideal "programmer's" printer? Laser or Inkjet? B&W or color? USB or Ethernet connector? Duplex? Availability of generic ink c...

Difference between i++ and ++i in a loop?

Is there a difference in ++i and i++ in a for loop? Is it simply a syntax thing? ...

Who cares... as long as the result is ok?

I am a bit stunned by lots of reactions on questions that point out that developers care more about the resulting compiled bytes than about the meaning of their code. I tend to nit-pick about postfix/prefix increment, as I tend to nit-pick about using a boolean for an enumerated type with two values, and about proper function naming, an...

What language has the easiest and most robust date parsing?

I know java has the SimpleDateFormat which seems fairly powerful, but you need to know the format ahead of time to use it correctly. TCL's clock scan function seems to be the easiest and most powerful I've seen. e.g. clock scan "1/08/2009 12:33:01 AM" will work just as well as clock scan "8-Jan-2009 12:33:01" EDIT: Okay, removing ...

How is PDL used in real-world programming?

I've been reading code complete, not far in yet but one of the things it talks about is PDL - a higher level design language, which you write each routine in before coding in the language of choice. I wondered if anyone actually did this in real life? Another thing it says is to leave each line of PDL in the code as comments. Surely t...

What exactly is programming?

I'm not looking for an outsider's definition of programming (which is easy enough to find). Rather I'm asking for an inside baseball answer. When you sit down in front of keyboard and screen and start working, what are you doing? This question was inspired by: http://stackoverflow.com/questions/475072/how-exactly-do-you-judge-how-...

Where do you get programming news?

I suppose the best answer to this question will be "what kind of programming?" But I'm having trouble finding any good sites for getting general programming news. By this, I just mean that I want some websites to keep up with what's new both in technologies and new techniques without being slanted one way or another. I'll read progr...

Is there a good example of using a factory method / pattern for creating game objects / characters?

I want a clean way of creating game object such as NPCs, bullets and power-ups, reducing the amount of inter-dependence on specific classes. I believe this is what the factory pattern is used for? I would love to see a good implementation from a real game. I'm not an expert on design patterns, and never use them if I don't understand t...

Are hard-coded STRINGS ever acceptable?

Similar to Is hard-coding literals ever acceptable?, but I'm specifically thinking of "magic strings" here. On a large project, we have a table of configuration options like these: Name Value ---- ----- FOO_ENABLED Y BAR_ENABLED N ... (Hundreds of them). The common practice is to call a generic function to test an ...

How do you rate programmers?

Does any rating system exist to rate the capabilities of a person as a programmer, much like an Intelligence Quotient Test, where specific insights on predefined aspects are rated based on answers / multiple-choice questions. Ideally in a language-independent manner because the core programmer understandings are usually similar from pla...

SQL CASE Statement Versus Conditional Statements In Programming Language

I'm going through some old stored procedures at work and constantly come across CASE MyColumn WHEN 'Y' THEN 'Yes' WHEN 'N' THEN 'No' ELSE 'Unknown' END It gets even worse when this is tied not to a word, but instead a colour. CASE MyColumn WHEN 'Y' THEN 'style="background-color:pink"' ELSE '' END The reason this was done was for ol...