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

learn more… | top users | synonyms

1
vote
1answer
80 views

Need some input on storing stdin, stdout, stderr information for debugging

I am working with a legacy system that is not too bad, but I thought of making some improvements to it, and I wanted to solicit your feedback to help me make good decisions. The platform is Linix ...
5
votes
2answers
3k views

What are the pros and cons of Inter process communication done via sockets vs shared memory?

I understand that two of the many more options for inter process communication can be : Shared memory Sockets Actually I saw these two options being exposed by Intellij Idea for debugging a Java ...
1
vote
1answer
152 views

How to share common methods if objects have different roles?

If 2 classes have the following in common: part of how their state is represented (both have a linear container) multiple identical methods (identical code, not just signature) But are not ...
7
votes
1answer
509 views

Loop fusion example using aspect-oriented framework

I had recently read a paper 'Aspect-Oriented Programming' by Gregor Kiczales and others, and found there the loop fusion example. Here is a definition of the loop fusion from the paper …the loop ...
7
votes
2answers
612 views

Best Practice to Avoid “Playing Telephone” with Constructor Arguments

I find that the encapsulation required by OO has me frequently passing paramenters down the line from parent to child to great grandchild to second grand nephew once removed (not actually that bad). ...
6
votes
4answers
1k views

Evaluate math expressions without a stack

How do you evaluate arbitrary math expressions using temporary variables instead of a stack? What I'm talking about is translating an expression into an array of simple operations- each that change ...
26
votes
11answers
2k views

Maintenance wise, is `else while` without intervening braces considered safe?

Is else while without intervening braces considered "safe" maintenance wise? Writing if-else code without braces like below... if (blah) foo(); else bar(); ...carries a risk because the ...
5
votes
4answers
441 views

What is thread safety? [closed]

What is it? I was reading Effective STL and came across it. I have also Googled it, but couldn't get any helpful info.
1
vote
3answers
845 views

When should one use “out” parameters?

In Objective-C, there are several methods like initWithContentsOfFile:encoding:error: where one passes in a reference to an NSError object for the error: parameter. In this example, the value of the ...
0
votes
1answer
561 views

Client-Server connection response timeout issues

User creates a folder in client and in the client-side code I hit an API to the server to make this persistent for that user. But in some cases, my server is so busy that the request timesout. The ...
4
votes
4answers
334 views

Is code that terminates on a random condition guaranteed to terminate?

If I had a code which terminated based on if a random number generator returned a result (as follows), would it be 100% certain that the code would terminate if it was allowed to run forever. while ...
7
votes
4answers
1k views

Looking for a real-world example illustrating that composition can be superior to inheritance

I watched a bunch of lectures on Clojure and functional programming by Rich Hickey as well as some of the SICP lectures, and I am sold on many concepts of functional programming. I incorporated some ...
38
votes
8answers
7k views

What should be allowed inside getters and setters?

I got into an interesting internet argument about getter and setter methods and encapsulation. Someone said that all they should do is an assignment (setters) or a variable access (getters) to keep ...
111
votes
17answers
23k views

Is there an excuse for short variable names?

This has become a large frustration with the codebase I'm currently working in; many of our variable names are short and undescriptive. I'm the only developer left on the project, and there isn't ...
22
votes
7answers
2k views

What does it mean that “language A is written in language B”?

I often hear the term that language A is written in language B. For example, PHP has been written C, C# is written in C++. Can someone please explain what does that mean and if it is even correct? ...
0
votes
2answers
85 views

Looking for terminology for the relation of a subject and a predicate [closed]

While writing some predicates for collection filtering I have stumbled over the choice of the right words for the relation of the subject and the predicate (English is a foreign language for me). What ...
22
votes
7answers
1k views

Pattern for a class that does only one thing

Let's say I have a procedure that does stuff: void doStuff(initalParams) { ... } Now I discover that "doing stuff" is quite a compex operation. The procedure becomes large, I split it up into ...
0
votes
2answers
190 views

When modeling a virtual circuit board, what is the best design pattern to check for cycles?

To make it simple assume you have only AND and OR gates. Each has two inputs and one output. The output of two inputs can be used as an input for the next gate For example: A AND B -> E C AND D -> F ...
23
votes
8answers
2k views

Should comments say WHY the program is doing what it is doing? (opinion on a dictum by the inventor of Forth) [duplicate]

The often provocative Chuck Moore (inventor of the Forth language) gave the following advice[1]: Use comments sparingly! (I bet that's welcome.) Remember that program you looked through - the ...
2
votes
2answers
108 views

How does one handle an incorrect resource file?

I'm starting the parser that will handle one of the key features of my app and realizing exactly who easy it would be for me to screw up a resource file that is provided to the application. For ...
26
votes
4answers
3k views

Can you use Pi as a crude random number generator?

I recently saw this question over at math.SE. It got me thinking. Could Pi be used as a crude random number generator? I mean the results are well known(how long has pi been computed to now?) but, Pi ...
33
votes
15answers
4k views

Why use other number bases when programming

My coworkers and I have been bending our minds to figuring out why anyone would go out of their way to program numbers in a base other than base 10. I suggested that perhaps you could optimize longer ...
4
votes
3answers
320 views

Is Reading the Spec Enough? [closed]

This question is centered around Scheme but really could be applied to any LISP or programming language in general. Background So I recently picked up Scheme again having toyed with it once or twice ...
4
votes
3answers
256 views

In dependency injection, is there a simple name for the counterpart of the injected object? [closed]

In tutorials and books, I have never seen a single word describing the object that the injected object is injected into. Instead, other terms are used, like "injection point" which don't denote the ...
-3
votes
3answers
305 views

In what practical ways is it good to remember the memory/pointers model? [closed]

A variable refers to a value. A variable is also stored in a memory address. People say that it's good to have this memory model in mind. Is that true? What is some sample code that shows this as ...
4
votes
4answers
1k views

Why should one use a single-use temporary variable?

Let's say we have a class called 'Automobile' and we have an instance of that class called 'myCar'. I would like to ask why do we need to put the values that our methods return in a variable? Why ...
0
votes
2answers
245 views

What is the standard for describing functions and objects?

What is the standard for describing functions/methods (function name, number of arguments, argument type, return type, etc...) in a manner that is language independent? EDIT: More specifically, how ...
2
votes
1answer
86 views

String patterns that can be used to filter and group files

One of our application filters files in certain directory, extract some data from it and export a document from the extracted data. The algorithm for extracting the data depends on the file, and so ...
13
votes
5answers
2k views

Why are invariants important in Computer Science

I understand 'invariant' in its literal sense. I also recognize them when I type code. But I don't think I understand the importance of this term in the context of computer science. Whenever I read ...
3
votes
2answers
429 views

Questions about identifying the components in MVC

I'm currently developing an client-server application in node.js, Express, mustache and MySQL. However, I believe this question should be mostly language and framework agnostic. This is the first ...
2
votes
2answers
2k views

Relationship between SOA and OOA

Thomas Erl defines SOA as follows in his site: Service-oriented computing represents a new generation distributed computing platform. As such, it encompasses many things, including its own ...
2
votes
2answers
144 views

Naming variables with fixed point units

What should I name a variable that has units with a fixed point? int herpLimitLo_psig2 = 6000; // 60.00 psig int derpLimitLoPsigwithtwodigits; int herpLimitHiPsigfixedtwo; int ...
2
votes
3answers
177 views

Overloading interface buttons, what are the best practices?

Imagine you'll have always a button labeled "Continue" in the same position in your app's GUI. Would you rather make a single button instance that takes different actions depending on the current ...
12
votes
10answers
2k views

What's the next level of abstraction? [closed]

Since programming languages initially only used lines of code executed sequentially, and it evolved into including functions which were one of the first levels of abstraction, and then classes and ...
3
votes
3answers
3k views

What defines code readability? [duplicate]

Possible Duplicate: How would you know if you've written readable and easily maintainable code? It is often said that readability is perhaps the most important quality-defining measure ...
10
votes
3answers
210 views

How could I avoid a distributed deadlock during a mutual connection between two nodes?

Suppose we have two peer nodes: the first node can send a connection request to the second one, but also the second one can send a connection request to the first one. How to avoid a double connection ...
6
votes
2answers
317 views

Use of versioned objects/data to handle program version compatibility?

Is there a common name for the practice of keeping a version number on your data, so that different versions of your program can identify, for example, "current", "legacy", and "too-old-to-deal-with" ...
4
votes
3answers
361 views

Naming a “do X if needed” method

What is a good way to name a method that checks if X needs to be done, and does X it if necessary? For example, how to name a method that updates a user list if new users have logged in? ...
10
votes
1answer
13k views

Programming language trends

Are there some statistics out there that show the approx. number of users that popular programming languages have and the rate this number increases over time?
6
votes
6answers
617 views

Generating different combinations from a list of muscles

Suppose we have a model of a human muscular system containing the following muscles each within a specific muscle group: Arms Biceps Triceps Forearms Torso Front Abs Chest Shoulders Torso Back ...
36
votes
12answers
3k views

Is there ever a reason to do all an object's work in a constructor?

Let me preface this by saying this is not my code nor my coworkers' code. Years ago when our company was smaller, we had some projects we needed done that we did not have the capacity for, so they ...
18
votes
8answers
2k views

Should laying out a GUI graphically be considered “cheating?”

I have a friend who has a slightly greater amount of programming experience as me. We were talking about all the different programming technologies we use and Interface Builder came up in ...
2
votes
2answers
127 views

What direction should I consider the offset when searching strings in reverse?

I'm making an indexOfReverse utility function in my C++ program, and I have caught a bit of a snag. Implementing the offset and maxOffset in my indexOf was very intuitive to me.. These start from the ...
2
votes
3answers
379 views

Why are the arguments for substring functions mismatched?

In many languages, the substring function works like this: substring(startIndex, endIndex) returns the substring from startIndex until endIndex-1 (if you view startIndex and endIndex as 0-based) / ...
7
votes
2answers
307 views

Parsing multiple file formats/protocols

We are starting a project where we will need to write parsers for a bunch of binary file formats, each of them representing very similar data (time-value series from different measurement devices). ...
45
votes
4answers
9k views

Which algorithms/data structures should I “recognize” and know by name? [closed]

I'd like to consider myself a fairly experienced programmer. I've been programming for over 5 years now. My weak point though is terminology. I'm self-taught, so while I know how to program, I don't ...
5
votes
7answers
520 views

if you were asked to answer to the question “ what is the difference between the English language and a programming language” how you will respond? [closed]

Basically in both cases you have: a well defined vocabulary a syntax to respect they both can express a business logic they can define semantics I don't think that will be fair to say "A ...
4
votes
3answers
446 views

Is case after case in a switch efficient?

Just a random question regarding switch case efficiency in case after case; is the following code (assume pseudo code): function bool isValid(String myString){ switch(myString){ case "stringA": ...
5
votes
5answers
567 views

When decomposing a large function, how can I avoid the complexity from the extra subfunctions?

Say I have a large function like the following: function do_lots_of_stuff(){ { //subpart 1 ... } ... { //subpart N ... } } a common pattern is to decompose it ...
4
votes
9answers
710 views

Why are effect-less functions executed?

All the languages I know of would execute something like: i = 0 while i < 100000000 i += 1 ..and you can see it take a noticeable amount of time to execute. Why though, do languages do ...