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

learn more… | top users | synonyms

6
votes
4answers
370 views

Is it ever OK for a conditional to have side effects?

I'm taking intermediate data structures course as a prereq for entry into the CS MS program at a University everyone in America has heard of. One line of code that was written in class caught my eye: ...
2
votes
4answers
470 views

Why aren't we building and using parallel processors *meant* for general computation?

We all know GPUs are much faster than CPUs for a wide range of applications. When someone asks why we are not just programming for GPUs at all, one of the most common answers is that GPUs are not good ...
1
vote
2answers
104 views

Should I throw guard exceptions that will be thrown by internal methods anyway?

I have some fairly simple code (C#): /// <summary> /// Truncates a string to a maximum length. /// </summary> /// <param name="value"> The string to truncate. ...
2
votes
1answer
69 views

class hierarchy with structurally different subclasses

I want to implement a protocol layer which sits on top of the TCP/IP stack. There is a limited set of PDUs that can be sent and for each PDU there is a class which represents it in a structured form. ...
0
votes
2answers
58 views

Map multiple functions over a single data item [closed]

I'm in the process of learning Scala and I came across a scenario today where I need to map multiple functions over a single piece of data and wondered if there was a formal name for this. It sort of ...
0
votes
1answer
73 views

Avoid Code Repetition in Condition Statements [duplicate]

I have been programming for over 15 years now. I consider myself a very good programmer, but I understand (like all of us) there are things that I need to work on. One of these things is code ...
2
votes
5answers
253 views

Do first-class methods exist?

Okay, I know first-class functions are cool, closures even better, etc. But is there any language with first-class methods? In my mind, I see a first-class method as an "object" that has both a ...
-2
votes
2answers
80 views

How to name a clamp function that only clamps from one side? [closed]

Clamp() is a function that ensures that provided variable is in provided range. You can find such function in .NET, in Unity, and probably anywhere. While it is useful, I often need to clamp my value ...
16
votes
1answer
658 views

Where did the notion of 'calling' a function come from?

I've always wondered why one calls a function as opposed to, for example, executing it. A Google search for function call etymology and similar terms turns up nothing useful, Wikipedia doesn't ...
1
vote
2answers
195 views

How do you guard against hidden overflows

consider the following: (i+j)/2 i and j are both 32 bit integers and the result should also be. But in the little equation, there's a hidden overflow, i+j could become larger then a 32 bit integer ...
-3
votes
3answers
131 views

What is the verb for “to make something into a plugin”? [closed]

What is the verb for "to make something into a plugin"? Example use: "Developer can you make Module Foo into a plugin?". "Yes sir, I can some verb Module Foo". Terms I have considered: pluginify, ...
-2
votes
3answers
182 views

Is there an official programming format? [closed]

A person can make their code readable and neat in their own way. However, is there a standard programming format that professional programmers are compliant to?
2
votes
2answers
251 views

Does it make sense to use interfaces if you don't have polymorphism?

Suppose I have distinct classes that have the same behavior, which can be represented like this: public interface Behavior { void operationA(); } public class ImplementerA implements Behavior { ...
0
votes
1answer
56 views

Traverse a matrix using a linear index to get an evenly distributed values sample

I'm looking for an algorithm idea on how to traverse a matrix using a linear index while avoiding row/column based traversals to get a more diverse distribution of values. To understand this better, ...
3
votes
3answers
469 views

Functional programming strategies in imperative languages

I've been convinced for awhile now that some strategies in functional programming are better suited to a number of computations (i.e immutability of data structures). However, due to the popularity of ...
3
votes
1answer
265 views

How can I rewrite this linked-list manipulation as tail-recursive?

This is an interview question I was once asked, and now I ask many of my interviewees. I have yet to see anyone come up with a tail-recursive solution during the interview. Given a liked list, I'd ...
37
votes
11answers
2k views

When should the programmer's spoken language be used during development? [duplicate]

I'm an Italian developer, but I have a good understanding of English. Sometimes, when developing an application targeted for an Italian audience, I wonder whether it is correct to use the Italian ...
8
votes
1answer
617 views

What's the copyright status of boilerplate code?

I check Open Source Compliance for commercial code. I have recently found a few examples where the commercial source is matched against quite a few OSS projects. The matches are very similar, but ...
13
votes
5answers
1k views

Dealing with not knowing parameter names of a function when you're calling it

Here's a programming/language problem I'd like to hear your thoughts on. We have developed conventions that most programmers (should) follow that aren't a part of the languages syntax but serve to ...
1
vote
1answer
106 views

How to manage version control company wide? [duplicate]

Are there any industry standards or best practises on how to manage a rapidly changing code base? The types of applications I am developing always have a custom aspect to them. So there will always ...
3
votes
1answer
152 views

Can the possibility of a data race be ignored in some cases? (while having concurrent threads) [duplicate]

I am programming a game engine as a hobby project, and I would like to separate physics and drawing into two separate threads. The position vectors of entities are subject to modifications by the ...
0
votes
0answers
99 views

Junior - How to understand the flow of the code? [duplicate]

A junior asking... First a rather large chunk of background Assume you have done some programming and now you want to take the next step out in the real world or at least learn more. I have no ...
1
vote
2answers
95 views

Logging events for reporting purposes

Are there any design patterns or best practices around logging events for use in reporting and BI systems. For example in a system which manages orders from a website, it would be beneficial if a ...
9
votes
12answers
2k views

Why don't more languages have the ability to compare a value to more than one other value? [closed]

Consider the following: if(a == b or c) In most languages, this would need to be written as: if(a == b or a == c) which is slightly cumbersome and repeats information. I know my above sample ...
1
vote
1answer
70 views

Assert Message in Unit Tests

I've just begun reading "The Art Of Unit Testing" by Roy Osherove, and while I'm mostly finding the material very helpful, he makes a statement about not using messages in your Assert statements. ...
15
votes
3answers
407 views

Should I include myself as an author after modifying 3rd-party code?

It's common practice to make some tweaks or fixes in 3rd-party code (be it a simple gist or an entire library). But it's also common that many of these code have they own licensing rules and ...
-4
votes
2answers
288 views

How to really understand programming? [duplicate]

I have started to learn to program. I am interested in it and dont mind how long it takes to learn. But I am using books to start out and I find that there are some things I get and some things I have ...
21
votes
9answers
3k views

Able to read Code but struggling majorly to write it [closed]

I had my first programming exam recently...and well I pretty much flopped it. Did not do great at all. I have only myself to blame as outside of college time, I pretty much did nothing. Now I have ...
2
votes
4answers
204 views

How to explain the difference between a variable and a key in a key-value pair?

Variables and the keys in key-value pairs are both identifiers for values, so, on a conceptual level, these seem very similar ideas. How would you explain the difference between these two concepts? ...
19
votes
2answers
1k views

What is the advantage of wrapping exceptions [duplicate]

It's very common in .NET for an exception to be wrapped in several layers of "outer exceptions" which give marginally more contextual data. For example, in EF if your update fails, you get exceptions ...
10
votes
3answers
827 views

Are these programming “classics” still relevant today and should I read them? [closed]

I have come across numerous older posts that highly recommend the following language agnostic programming books: Code Complete by Steve McConnel The Pragmatic Programmer - Andrew Hunt and Dave ...
20
votes
9answers
2k views

What is the benefit of having the assignment operator return a value?

I'm developing a language which I intend to replace both Javascript and PHP. (I can't see any problem with this. It's not like either of these languages have a large install base.) One of the things ...
0
votes
2answers
130 views

How to describe an n-dimensional cube? [closed]

I want to describe an n-dimensional cube (a 2-dimensional cube is a square, a 3-dimensional cube is a cube, etc). I'm pretty sure I need an array, but how do I organise it in the best possible way? ...
4
votes
4answers
1k views

Returning null or a empty value/throw exception? [duplicate]

Various programming books suggest that methods should not return null values (Clean Code for example). Instead of returning null default values (0 or empty string or empty object) should be returned ...
2
votes
2answers
101 views

Form cancellation. Where should any data rollback occur?

You have a form that has an object injected into it. The user interacts with the form and updates the injected object via the UI. If the user then 'Cancels' the form, whose responsibility is it to ...
5
votes
5answers
436 views

Finding most Important Node(s) in a Directed Graph

I have a large (≈ 20 million nodes) directed Graph with in-edges & out-edges. I want to figure out which parts of of the graph deserve the most attention. Often most of the graph is boring, or at ...
3
votes
4answers
266 views

How to handle affinities?

Assume we have an abstract class having several concrete classes which interfaces publish an information under several equivalent forms, with the difference that each class has a preferred form which ...
0
votes
2answers
83 views

Placing arguments on their own lines [closed]

This question applies to both parameters and arguments, since I've seen this style used in both. I usually write parameters like this someFunction(arg0, arg1, arg2) but I've recently noticed that ...
14
votes
2answers
649 views

Which is better: a bunch of getters or 1 method with a selection string parameter?

Our knowledge domain involves people walking over a pressure-recording plate with their bare feet. We do image recognition which results in objects of the 'Foot' class, if a human foot is recognized ...
1
vote
1answer
224 views

Will we go back(?) to fixed-point arithmetic in the near future? [closed]

As far as I recall, this has been the ongoing trend of the past, I'm just a student, so I might be wrong: Long ago: Integer numbers and calculations. Very precise, however cannot present a big ...
2
votes
1answer
144 views

Draw graph of a function whose characteristics are unknown [closed]

Suppose I have a function. I have code that, given an x value, produces a y value. I can assume that the function is somewhat mathematically sane, not something crazy like an ...
5
votes
3answers
1k views

Should I refactor a F class from code climate? [closed]

According to code climate (static quality analysis), a class is F, aka the worst mark you could be granted. I did submit a pull request to rearrange it here Which has been refused because the new ...
0
votes
1answer
117 views

Is there any use for layout managers beyond Java? [closed]

I am a beginning programmer and I was recently working on some primitive GUI apps in Java. That's where I encountered different layout managers. I browsed the web and it says that for advanced GUI ...
-1
votes
2answers
119 views

What are some examples of inverted classical inheritance? [closed]

Are there any examples of inheritance in languages where classes call their subclasses' methods rather than their super classes' methods? It should not behave like traditional inheritance like the ...
1
vote
3answers
255 views

is using a PUT with side affects acceptable (REST)

I want to create an undo history whenever the user updates a form. Because it's an update, I want to use a PUT request. However, I read that PUT needs to have no side effects. Is it acceptable to ...
5
votes
1answer
372 views

How can I implement a modular “save” function for a game?

I have to implement a method to save my game in such a way that I can change the storage medium with the change of only a single variable. Ideally I'd use an interface to designate the required ...
11
votes
1answer
524 views

How is machine learning incorporated into search engine design?

I am currently building a small in-house search engine based on Apache Lucene. Its purpose is simple - based on some keywords, it will suggest some articles written internally within our company. I am ...
7
votes
2answers
201 views

Definition of a type

Conceptually, I used to think of types as sets. However, I think I've seen people wishing to distinguish types A, B even if they represent identical collections of values. So I figured a better ...
4
votes
2answers
339 views

How to implement loose coupling?

I want to implement loose coupling in a project. I know two examples of successful loose coupling designs: On a Unix workstation, shell scripts realise a loose coupling between basic utilities. The ...
-1
votes
1answer
88 views

Term to describe keyword followed by statement block [closed]

Is there a general term to describe a keyword followed by a statement block? E.G. if() {statement block} while() {statement block} try{statement block} finally{statement block} Or even something ...