language-agnostic

What Is Your Software Development Directory Structure?

I have been experimenting with directory structures and am currently using the one below: | |_projects__ | | | |_blog.com_ | | |_mockups | | |_user stories | | |_.... | | | |_noteapp__ | |_mockups | ...

What type of variable names do you use to compare two objects

I do a lot of data analysis scripting, comparing two objects or strings to determine differences or come up with gaps that need to be filled. When you're in a loop, comparing object a to object b, do you have a preferred coding standard that makes sense (i.e., it is self-documenting) and can travel nicely to other code? Or are variable ...

Are incrementers / decrementers (var++, var--) etc thread safe?

Inspired by this question: http://stackoverflow.com/questions/443423/in-complexity-analysis-why-is-considered-to-be-2-operations Take the following psuedo code: class test { int _counter; void Increment() { _counter++; } } Would this be considered thread safe on an x86 architechure? Further more are the Inc / Dec as...

How many variables are too much for a class?

I want to see if anyone has a better design for a class (class as in OOP) I am writing. We have a script that puts shared folder stats in an csv file. I am reading that in and putting it in a Share class. My Boss wants to know information like: Total Number of Files Total Size of Files Number of Office Files Size of Office File...

"Approximate" greatest common divisor

Suppose you have a list of floating point numbers that are approximately multiples of a common quantity, for example 2.468, 3.700, 6.1699 which are approximately all multiples of 1.234. How would you characterize this "approximate gcd", and how would you proceed to compute or estimate it? Strictly related to my answer to this questio...

do you put your calculations on your sets or your gets . .

which is better ??? public class Order { private double _price; private double _quantity; public double TotalCash { get { return _price * _quantity; } } or public class Order { private double _totalCash; private double _price; private double _quantity; private void CalcCashTotal() { _tot...

Finding closest match in collection of numbers

So I got asked today what was the best way to find the closes match within a collection. For example, you've got an array like this: 1, 3, 8, 10, 13, ... What number is closest to 4? Collection is numerical, unordered and can be anything. Same with the number to match. Lets see what we can come up with, from the various languages o...

Generating Uniform Random Deviates within a given range

I'd like to generate uniformly distributed random integers over a given range. The interpreted language I'm using has a builtin fast random number generator that returns a floating point number in the range 0 (inclusive) to 1 (inclusive). Unfortunately this means that I can't use the standard solution seen in another SO question (when th...

Sample Problems for Multithreading Practice

I'm about to tackle what I see as a hard problem, I think. I need to multi-thread a pipeline of producers and consumers. So I want to start small. What are some practice problems, in varying levels of difficulty, that would be good for multi-threading practice? (And not contrived, impractical examples you see in books not dedicated t...

What Unit Test would you start with?

When you've come up with an overall design / idea for how a part of a system should work, how do you decide where to start when doing TDD, or rather, how do you decide your first test to start with? ...

Useless code metric: Yearly revenue per line of code

The world is full of useless code metrics so I thought I would add one of my own I even found someone talking about revenue per line of code. So what is the yearly revenue of the product you're working on divided by lines of code? You can choose any method you like to count LOC, it's not like we're being scientific or anything. If this...

What is Scope Creep?

This is going to be the noobist of all noob questions, but what exactly is scope creep, what does it entail? ...

How to prevent code rush?

When you have an idea that is blazing through your head for a product, yet everything that is right with the world tells you to plan this application before jumping into a code rush, what methods do you use to prevent rushing to code? From my experience planning software as apposed to building the software ad-hoc has always proven to ...

Can anybody explain the concept of pluggable adapter to me with good example?

Can anybody explain the concept of pluggable adapter to me with good example? ...

Software Critique: Open Source Software

Where can I find critical analysis of OpenSource projects? ie: in-depth analysis of methods within the source, a comparison of projects with others, and performance metrics ... I'd like to read something about existing projects that would give me an overview of its design, implementation, strengths and weaknesses, so I can choose somet...

How to tune a cache in an application server

Our customers have hundreds of projects per application server. Every project has its own metadata descriptor (~1MB in memory , ~1sec to load from DB). The metadata is used to validate every request to the server in various aspects (permissions, valid fields, field values etc...) We are heavily dependent upon this metadata. To save ti...

How do you design a class for inheritance?

I've heard it said that it is "difficult" to "design for inheritance", but I've never found that to be the case. Can anyone (and by anyone, I mean Jon Skeet) explain why this is allegedly difficult, what the pitfalls/obstacles/issues are, and why mere mortal programmers should not attempt it and just make their classes sealed to protect ...

How to do a presentation for your co-workers containing lots of code?

I'm supposed to do a presentation for my co-workers on a web framework I evaluated. These people are developers and hate long and boring PowerPoint stuff, so I got lots of little code snippets. I also put together a small sample application. My question is, how do I present the code so people can follow? Some things I thought of: Put ...

I need a problem for my algorithm. I need like search engine input data

Hello! Imagine you have some products, or items, or just anything that you want to see in some order of importance. Like you want in a search engine. Like websites. And you don't know how to sort them. But you have some criteria that give you a clue. You have a bag of criteria, and according to each, you can find a sorting, but you cann...

How do code coverage tools work in different languages?

Most established languages have solid test coverage tools available for them, but the depth of functionality differs significantly from one to another. Also, all the various VMs and compilers have such heterogeneous structure that writing a code coverage tool must be a very different job in C than in Lisp, for example. Python has sys....