Programmers Weekly Newsletter
Programmers Weekly Newsletter

Top new questions this week:

Are all magic numbers created the same?

On a recent project, I needed to convert from bytes to kilobytes kibibyte. The code was straightforward enough: var kBval = byteVal / 1024; After writing that, I got the rest of the function ...

asked by GlenH7 44 votes
answered by whatsisname 61 votes

How to define "or" logically

Recently, I came across a problem that required me to define the logical "OR" operator programmatically, but without using the operator itself. What I came up with is this: OR(arg1, arg2) if ...

asked by user3687688 30 votes
answered by BlueHat 71 votes

Is there any algorithm pattern to protect any content in the web to ensure I am the first one who created it?

A few years ago there was this hacker (don't remember who he was) that full disclosed a vulnerability in a given system, but to make sure nobody took credit for that, he created some kind of PGP key. ...

algorithms encryption cryptography internet copy-protection  
asked by Fagner Brack 26 votes
answered by MichaelT 35 votes

How to enforce good/better source code control practices?

I suspect that I'm focusing on the wrong problem so I will first describe what I think the problem is before presenting the possibly suboptimal solution I envision. Current Situation: Currently my ...

version-control svn co-workers  
asked by VolkerK 18 votes
answered by MainMa 37 votes

Is it good practice to inherit from generic types?

Is it better to use List<string> in type annotations or StringList where StringList class StringList : List<String> { /* no further code!*/ } I ran into several of these in Irony.

c# inheritance  
asked by Ruudjah 14 votes
answered by Stephen 6 votes

Should a front-end developer ever specify JSON format for back-end developers?

I am taking the front-end role in a project. Should I be specifying for my back-end teammates the exact format of JSON that their PHP returns to my JavaScript? For example, should I be telling them ...

development-process teamwork interfaces json front-end  
asked by Gnuey 13 votes
answered by grahamparks 34 votes

Why can't the Scala compiler give pattern matching warning for nonsealed classes/traits?

If I use an unsealed trait or abstract class in Scala and then use pattern matching, I wonder, does the compiler not know at compile time for this particular patternmatch what possible implementations ...

scala type-safety trait  
asked by valenterry 8 votes
answered by Jörg W Mittag 10 votes

Greatest hits from previous weeks:

How can one manage thousands of IF...THEN...ELSE rules?

I am considering building an application, which, at its core, would consist of thousands of if...then...else statements. The purpose of the application is to be able to predict how cows move around in ...

design design-patterns business-rules prolog logic-programming  
asked by David 163 votes
answered by exDM69 46 votes

Should we avoid object creation in Java?

I was told by a colleague that in Java object creation is the most expensive operation you could perform. So I can only conclude to create as few objects as possible. This seems somewhat to defeat ...

java object-oriented programming-practices performance  
asked by Slamice 108 votes
answered by Jarrod Roberson 255 votes

Can you answer these?

how does CC licenses (0,BY,BY-SA) affect proprietary/closed source applications?

I think this question is specific to indie developers be concerned about. Think about it as a "license clarification" or a "license practical use case". I need to know how must be my project basic ...

licensing creative-commons  
asked by Aquarius Power 1 vote

Recommend an approach to decouple Product and Access code constructs, in order to simplify Product testing

I have some code that tightly couples Product specific code and Product-Access code. I am not sure how to untangle it. So for example, for testing Product, I have to mock up Access objects. And ...

php coupling permissions  
asked by Dennis 1 vote

Compose nested EventEmitters elegantly

I am developing a server-side JavaScript tool, and trying to do so in a modular way. I have a Parser class that is an EventEmitter - you call parse and it will eventually emit data and end events. It ...

javascript inheritance node.js event-programming composition  
asked by Brandon Horst 1 vote
Subscribe to more Stack Exchange newsletters

Unsubscribe from this newsletter or change your email preferences by visiting your subscriptions page on

Questions? Comments? Let us know on our feedback site. If you no longer want to receive mail from Stack Exchange, unsubscribe from all emails.

Stack Exchange, Inc. 110 William St, 28th Floor, NY NY 10038 <3