This tag is for questions that aren't specific to a programming language or environment.

learn more… | top users | synonyms

19
votes
7answers
2k views

while(true) and loop-breaking - anti-pattern?

Consider the following code: public void doSomething(int input) { while(true) { TransformInSomeWay(input); if(ProcessingComplete(input)) break; ...
55
votes
17answers
4k views

How to deal with tautology in comments?

Sometimes I find myself in situations when the part of code that I am writing is (or seems to be) so self-evident that its name would be basically repeated as a comment: class Example { /// ...
1
vote
1answer
1k views

How are Implicit-Heap dynamic Storage Binding and Dynamic type binding similar?

"Concepts of Programming languages" by Robert Sebesta says - Implicit Heap-Dynamic Storage Binding: Implicit Heap-Dynamic variables are bound to heap storage only when they are assigned ...
2
votes
1answer
629 views

What is meant by elaboration of a declaration statement?

Intuitively I understand "elaboration" and have a very mild idea. But I want to know exactly what is elaboration of a declaration? I came across this word in this context: Stack dynamic storage ...
1
vote
3answers
286 views

When checking for transposed day and month values between two Dates - should comparing 11/11/2000 and 11/11/2000 return true or false?

Assuming a function with a signature of boolean isTransposed(Date date1, Date date2); Example outcomes: date1 date2 Outcome 06/02/2000 02/06/2000 true 02/06/2000 06/02/2000 true ...
1
vote
3answers
520 views

Calculate Ellipse based on 4 points

I need to move an object based on 100 images rotating. The object needs to move in a path that is forming an ellipse when I'm rotating the image based on my gestures. I have 4 points, 2 pairs of ...
10
votes
7answers
397 views

What is a good alternative to the name variable for a language that only has immutable references or labels?

For example, in functional languages, variables are single assignment and their values are immutable once assigned. So they have two states unbound and bound, once bound they can't be changed. Is ...
3
votes
6answers
352 views

Would the concept of source code layers be of any use?

I'm talking about something like layers in photoshop, except they apply directly to the source code. For example, in pseudo-code... inventing what some project might look like - say a computational ...
14
votes
6answers
1k views

Do I really need a unit test framework?

Currently at my job, we have a large suite of unit tests for our C++ application. However we don't use a unit test framework. They simply utilize a C macro that basically wraps an assert and a cout. ...
41
votes
17answers
5k views

Why Use !boolean_variable Over boolean_variable == false

A comment on this question: Calling A Method that returns a boolean value inside a conditional statement says that you should use !boolean instead of boolean == false when testing conditions. Why? To ...
11
votes
7answers
1k views

Which statically typed languages support intersection types for function return values?

Initial note: This question got closed after several edits because I lacked the proper terminology to state accurately what I was looking for. Sam Tobin-Hochstadt then posted a comment which ...
6
votes
3answers
3k views

When is method overloading appropriate?

Suppose I am working on an existing, reasonably large system. I have an object, myObject of class MyClass (for the example's sake, suppose I'm working in Java). myObject is a composition containing a ...
3
votes
3answers
229 views

Patterns for Maintaining Model State in Real Time

While some platform in some languages already address this issue, I would like to keep this semi-language agnostic and to focus on patterns associated with this issue. I have a data model that ...
9
votes
6answers
699 views

How do you name your GUI controls?

It's a generally considered a bad practice to use the Hungarian notation, but is common to find GUI controls named userNameTextBox and userNameLabel. Do you put the control type in it's name? Isn't ...
31
votes
13answers
2k views

Problems (such as maintenance) in development with unpopular language

I'm developing some application with clojure(lisp) alone in my team. It starts as small application. No problem. But as it's having features and extending the area, it's becoming important program. I ...
2
votes
2answers
783 views

What is the reason behind the if syntax of CoffeeScript?

In most other languages the condition comes before the statement to be executed when the condition is met. However, in CoffeeScript (and maybe some other languages) the syntax is: number = -42 if ...
6
votes
3answers
1k views

Various programming concepts (from a Python viewpoint)

Ever since I've started lurking on stackoverflow, I keep coming across programming concepts such as abstract classes, virtual functions, contracts, interfaces, etc., from a questions about other ...
11
votes
3answers
783 views

Randomly generate directed graph on a grid

I am trying to randomly generate a directed graph for the purpose of making a puzzle game similar to the ice sliding puzzles from Pokemon. This is essentially what I want to be able to randomly ...
37
votes
13answers
5k views

Is it bad interview practice to have candidates write a linked-list implementation?

Reading this site and SO I've seen many stories of interview questions and answers saying a candidate had to implement a linked list from scratch. Usually this is a "gimme" exercise for programming ...
11
votes
6answers
9k views

What are concrete examples of use cases of linked lists?

A linked list can be used when you want cheap insertion and deletion of elements and when it doesn't matter that the elements aren't next to each other in memory. This is very abstract and I would ...
2
votes
1answer
177 views

Publishing an internal web app on the internet to a much larger group of users than before

My company has developed a web application based on GWT (Google Web Toolkit) and Ext GWT in the browser, JBoss application server and Oracle in the backend. The app allows users of different ...
2
votes
3answers
211 views

Package name best practice when porting a library

What is the suggested way (specifically in the open-source world) for the package name when porting a library. Say I am porting someone else's library where they have used a reverse domain name ...
6
votes
5answers
418 views

Finding an A* heuristic for a directed graph

In a previous question, I asked about finding a route (or path if you will) in a city. That is all dandy. The solution I chose was with the A* algorithm, which really seems to suit my needs. What I ...
1
vote
3answers
125 views

Encapsulating a single property

If you have a single property that is relevant across a full project, but you should logically have only a single representation of, how would you represent this? In my case, I am developing a simple ...
23
votes
6answers
1k views

What are the arguments against parsing the Cthulhu way?

I have been assigned the task of implementing a Domain Specific Language for a tool that may become quite important for the company. The language is simple but not trivial, it already allows nested ...
0
votes
3answers
807 views

Collection providing lookup by one of several keys [closed]

What do you call a collection in which each item may be looked up by one of multiple keys? A partial, simplified definition in C# might be: class MyDataStructure<TKey1, TKey2, TValue> { ...
30
votes
9answers
5k views

Why is it impossible to produce truly random numbers?

I was trying to solve a hobby problem that required generating a million random numbers. But I quickly realized, it is becoming difficult to make them unique. I picked up Algorithm Design Manual to ...
7
votes
1answer
202 views

Need help with naming (marshaling interface calls) [closed]

This question was reopened on "English Language & Usage": http://english.stackexchange.com/questions/53683/synonyms-for-multiplexing-and-demultiplexing/ This question is related to something ...
9
votes
5answers
933 views

Should code review be performed before or after unit tests

I am debating with my colleague on when to perform code review - before or after unit tests. What is the best practice? Some factors we might need to take into account (there may be more): Size ...
5
votes
2answers
222 views

How to “back track”?

I find that I start projects and, due to my lack of experience, find that old database structures and huge blocks of code are inefficient and memory-costly. However, by the time I realize a re-design ...
9
votes
5answers
655 views

Are there any language agnostic unit testing frameworks? [closed]

I have always been skeptical of rewriting working code - porting code is no exception to this. However, with the advent of TDD and automated testing it is much more reasonable to rewrite and refactor ...
7
votes
2answers
129 views

What do you do when working with multiple languages with different capitalization schemes?

I'm making a webapp using Django. The Python convention for naming variables is lowercase_with_underscores, but the Javascript convention is camelCase. In addition, I've seen many people use ...
23
votes
5answers
1k views

Beginner's guide to writing comments?

Is there a definitive guide to writing code comments, aimed at budding developers? Ideally, it would cover when comments should (and should not) be used, and what comments should contain. This ...
67
votes
13answers
5k views

Why don't we store the syntax tree instead of the source code?

We have a lot of programming languages. Every language is parsed and syntax checked before being translated into code so an abstract syntax tree (AST) is built. We have this abstract syntax tree, why ...
14
votes
5answers
819 views

Why am I seeing so many for(;;) constructs? [closed]

To my way of thinking, a for loop is used to iterate over a known or determinable range. String[] names = //something; for ( int i = 0; i < names.length; i++ ) { //do stuff } which is equivalent ...
6
votes
5answers
2k views

Becoming a polyglot programmer

I know a few programming languages. The most marketable ones being Java, Javascript, as well as non-trival stored procedures. I also know some Python, Actionscript and a few dinosaurs language. I ...
9
votes
4answers
646 views

Using “catching exceptions” to improve readability, Good or Bad?

In the section When to Use Exception in The Pragmatic Programmer, the book writes that instead of: retcode = OK; if (socket.read(name) != OK) { retcode = BAD_READ; } else { ...
4
votes
5answers
14k views

How long would it take for someone completely new to programming to get enough knowledge to make it to the job market as a junior programmer?(C#) [closed]

I just want to know how long would it take me to become proficient enough (in let's say C#) in order to be able to get into the job market as a junior/entry level programmer. I have read all those ...
67
votes
16answers
4k views

What is the/Is there a right way to tell management that our code sucks?

Our code is bad. It might not have always been considered bad, but it is bad and is only going downhill. I started fresh out of college less than a year ago, and many of the things in our code puzzle ...
13
votes
7answers
1k views

Why don't more languages support recursive/nested comments? [duplicate]

Possible Duplicate: Why do most programming languages not nest block comments? Most languages I've worked with don't have support for recursive/nested comments. Is there any reason why ...
13
votes
5answers
2k views

What is the good explanation of Tennent's Correspondence Principle?

I found myself struggling to see what is this principle about and why is it so important for language design. Basically, it states, that for every expression expr in language should be exactly the ...
7
votes
4answers
1k views

what is a good way to show mysql experience?

As always, if this is a duplicate question that I have yet to uncover, please feel free to close or delete it. I'm attempting to get into the programming industry. I've focused mainly on PHP due to ...
17
votes
13answers
303 views

How to name parts of your program as a non native English speaker [duplicate]

Possible Duplicate: Do people in non-English-speaking countries code in English? I am from the Netherlands and we speak Dutch. I have worked on quite a few projects now in various ...
6
votes
3answers
186 views

Is it bad practice to define/use “Preset” functions

Lets say I have an extremely robust and versatile function: void DoAnything(action, target, context) In my program, 90% of the time I call this function, it's with the same parameters: ...
3
votes
6answers
348 views

Multiple projects - similar platforms or as different as possible?

When working on multiple projects simultaneously (for the sake of simplicity let's say half time each on two projects), which is better? Should the two projects Use the same language? Same/similar ...
5
votes
7answers
1k views

Server-side event logs through DB or writing to file?

I am developing a web application as well as the API the web application uses. I'm trying to determine whether it is better to log events (to determine the path that leads to an error as well as to ...
19
votes
9answers
672 views

What are good techniques for keeping your place in code?

I understand using bookmarks to remember a single point in your code. However, how does one keep track of the flow of the code they are investigating? Eg: multiple bookmarks and the order in which ...
2
votes
3answers
3k views

Beginning to code with java (No coding experience) [duplicate]

Possible Duplicate: Best Java book you have read so far I want to learn java but, I have absolutely no coding experience. what is the best website, book, or anything that is best at ...
23
votes
2answers
4k views

What are the advantages of prototype-based OOP over class-based OOP?

When I first started programming Javascript after primarily dealing with OOP in context of class-based languages, I was left confused as to why prototype-based OOP would ever be preferred to ...
11
votes
2answers
508 views

How does event bubbling generally work and is it synonym to event propagation?

I'm trying to wrap my head around the general workings and principles of event dispatching in event-driven (sub-)systems. Although I have used it on quite a few occasions in for instance Javascript, ...