language-agnostic

Where did the concept of Interfaces come from?

In c#, we have interfaces. Where did these come from? They didn't exist in c++. ...

Would it be useful to add extra info to stack traces?

Would it be useful to be able to mark objects where the value ofString.valueOf() would included in any stack trace. In my example below I used "trace". Variables that aren't declared at the point of the stack trace would just be ingored. It would make debugging much easier and make it much easier to write programs that are easy to debug...

What are some different ways of implementing a plugin system?

I'm not looking so much for language-specific answers, just general models for implementing a plugin system (if you want to know, I'm using Python). I have my own idea (register callbacks, and that's about it), but I know others exist. What's normally used, and what else is reasonable? What do you mean by a plugin system? Does Depend...

Which, and why, do you prefer Exceptions or Return codes?

My question is what do most developers prefer for error handling, Exceptions or Error Return Codes. Please be language(or language family) specific and why you prefer one over the other. I'm asking this out of curiosity. Personally I prefer Error Return Codes since they are less explosive and don't force user code to pay the exception p...

Private vs. Public members in practice (how important is encapsulation?)

One of the biggest advantages of object-oriented programming is encapsulation, and one of the "truths" we've (or, at least, I've) been taught is that members should always be made private and made available via accessor and mutator methods, thus ensuring the ability to verify and validate the changes. I'm curious, though, how important ...

Why are we still using compiler command lines?

I've been designing a compiler framework (targeting .NET) for a while now and I've been thinking more and more about deprecating the command line interface. A lot of my compiler's flexibility comes from the ability to define custom pipeline elements (to handle DSLs, macros (which have their own DSL to define), etc) and the command line ...

Why do you not declare several variables of the same type on the same line?

Why is it bad practice to declare variables on one line? e.g. private String var1, var2, var3 instead of: private String var1; private String var2; private String var3; ...

What is an ideal variable naming convention for loop variables?

If you are writing a simple little loop, what should you name the counter? Provide example loops! ...

Exceptions: Is this a good practice?

This is written in PHP but it's really language agnostic. try { try { $issue = new DM_Issue($core->db->escape_string($_GET['issue'])); } catch(DM_Exception $e) { throw new Error_Page($tpl, ERR_NOT_FOUND, $e->getMessage()); } } catch(Error_Page $e) { die($e); } Is nested try, catch blocks a g...

Why don't languages raise errors on integer overflow by default?

In several modern programming languages (including C++, Java, and C#), the language allows integer overflow to occur at runtime without raising any kind of error condition. For example, consider this (contrived) C# method, which does not account for the possibility of overflow/underflow. (For brevity, the method also doesn't handle the...

What opensource CMS: generates clean xhtml, is skinable with css, and has a lightweight markup content editor?

See title. By lightweight markup I mean something like markdown or wikitext. ...

Conditional logging with minimal cyclomatic complexity

After reading "What’s your/a good limit for cyclomatic complexity?", I realize many of my colleagues were quite annoyed with this new QA policy on our project: no more 10 cyclomatic complexity per function. Meaning: no more than 10 'if', 'else', 'try', 'catch' and other code workflow branching statement. Right. As I explained in 'Do you...

How can I lookup data about a book from its barcode number?

I'm building the world's simplest library application. All I want to be able to do is scan in a book's UPC (barcode) using a typical scanner (which just types the numbers of the barcode into a field) and then use it to look up data about the book... at a minimum, title, author, year published, and either the Dewey Decimal or Library of C...

The quick hack you are most proud of

What crazily awesome (or crazily bad) stuff have you hacked together to meet a tight deadline? What are you most proud of? ...

If you could go back in time and change just one technically-related decision that you made, what would it be and why?

It's said that one of the best ways to grow is to learn from one's own mistakes and those of others. In fact, there are some organizations that find zero-based thinking so important that they actually catalogue all of their lessons learned such that they don't make the same mistakes again. With that in mind, if you could go back in tim...

CMS without front end?

In many projects we are developing we need to have CMS functionalities in the back end of the site. On the other end we don't want to or can't commit to a complete front end solution. To explain this better: CMSes like Joomla or DotNetNuke are complete web site solutions, they let you store and publish data. They are not friendly at al...

Optimal multiplayer maze generation algorithm

I'm working on a simple multiplayer game in which 2-4 players are placed at separate entrypoints in a maze and need to reach a goal point. Generating a maze in general is very easy, but in this case the goal of the game is to reach the goal before everyone else and I don't want the generation algorithm to drastically favor one player ov...

What Language Feature Can You Just Not Live Without?

I always miss python's built-in doc strings when working in other languages. I know this may seem odd, but it allows me to cut down significantly on excess comments while still providing a clean description of my code and any interfaces therein. What Language Feature Can You Just Not Live Without? If someone were building a new lang...

What not to test when it comes to Unit Testing?

In which parts of a project writing unit tests is nearly or really impossible? Data access? ftp? If there is an answer to this question then %100 coverage is a myth, isn't it? ...

What is your approach to learning a new language or framework?

I've read that an effective approach to improving your programming skills is to learn new languages and frameworks. How do you approach learning a new language/framework? Even with the wide range of information available online, I often find myself looking for a good book on the language I'm interested in. With the basics understood, I...