language-agnostic

How do you stop interim solutions from lasting forever?

Say there are two possible solutions to a problem: the first is quick but hacky; the second is preferable but would take longer to implement. You need to solve the problem fast, so you decide to get the hack in place as quickly as you can, planning to start work on the better solution afterwards. The trouble is, as soon as the problem ...

When do you use an IDE?

I know that some people swear against using a language-specific IDE ever (vim/emacs or die! type stuff) and that some people are really uncomfortable with coding/compiling in the terminal at all, so my question has the following parts. When do you switch from one to the other Is it even necessary to know both? If not, which should you...

What's the right way to display emoticons?

In your own application that is. [edit] Alright, so I agree completely -- more than you know -- without equivocation that graphical emoticons are an abomination. But! That doesn't help me when the project owners tell me that we must support graphical emoticons. [/edit] The problem more complex than it would initially seem, especially...

How do I provide good documentation in my code?

I am always wondering what should I write for inline code documentation? I always end up with one liners "This function does x" or a 4 paragraph essay describing every micro detail of the function. I am trying to find a balance that provides good documentation without being to verbose. So if you could replay with the one thing that yo...

How do you get non-technical folks to appreciate a non-UI problem?

Suppose you're working on an enterprise project in which you have to get management signoff in order for you to develop a new feature set. Usually your management has no problem signing off on some bright shiny new UI feature. Unfortunately they have a hard time appreciating some behind-the-scenes issues that are crucial to the applicati...

Test cases, "when", "what", and "why"?

Being new to test based development, this question has been bugging me. How much is too much? What should be tested, how should it be tested, and why should it be tested? The examples given are in C# with NUnit, but I assume the question itself is language agnostic. Here are two current examples of my own, tests on a generic list object...

What techniques have you actually used successfully to improve code coverage?

I regularly achieve 100% coverage of libraries using TDD, but not always, and there always seem to be parts of applications left over that are untested and uncovered. Then there are the cases when you start with legacy code that has very few tests and very little coverage. Please say what your situation is and what has worked that at ...

What's the best CRLF handling strategy with git?

I tried committing files with CRLF-ending lines but it failed. I spent a whole work day on my Windows computer trying different strategies, and was almost drawn to stop trying to use git and instead try mercurial. Please share only one best practice per answer. ...

Close point of approch detection

I have a large set of 3rd order polynomials in 3D. in matrix form [Pn](t) = [1,t,t^2,t^4]*[An] // [Pn] and [An] are matrices each function has a weight Wn. I want to, for some n, m, T and t0 find the first t where t>t0 such that Wn*Wm / |[Pn](t)-[Pm](t)|^2 > T aside from a the O(n^2) "try everything" approach I'm not even sure w...

Creating a stage environment on network with port 80 blocked

I currently use my local web server to allow costumers to preview some applications and also to allow downloads of "nightly builds" of my open source library. Problem is I changed my ISP and now my port 80 is blocked. Altough I know I could easily change the port on the Apache server, I'd like to avoid that unless there's no alternati...

Best Practices: Always return a ____, never a ____

Do you subscribe to this school of thought? Assertion: "I always return an Enum, Array, or an Iterator, never a Boolean, NULL, or an Instance." Reasoning: Code using Enums instead of Booleans. Return Empty Arrays instead of nulls, and return an Iterator even if the calling Method will only take the first value; instead o...

So - which exciting algorithms have you "discovered" recently?

I like to read about new and clever algorithms. And I like to think out of the box, so all kinds of algorithms from all fields of computation are welcome. From time to time I read research papers to keep up with the current research and expand my horizon. I also like to learn new tricks. Unfortunately I tend to concentrate only on my fi...

Calculating time diff across midnight

This is the one thing I could never get to work. My problem is to detect the end of one day and the start of the next and then splitting the diff into each day. Imagine you want to calculate a pay rate but it has to span across midnight. It also applies to calculating time to run on timed system, or time diff it should've run. ...

How often do you worry about how many if cases will need to be processed?

If you have the following: $var = 3; // we'll say it's set to 3 for this example if ($var == 4) { // do something } else if ($var == 5) { // do something } else if ($var == 2) { // do something } else if ($var == 3) { // do something } else { // do something } If say 80% of the time $var is 3, do you worry about th...

Language Maturity Lifecycle

Wikipedia describes five stages of technology lifecycle: Bleeding edge - any technology that shows high potential but hasn't demonstrated its value or settled down into any kind of consensus. Early adopters may win big, or may be stuck with a white elephant. Leading edge - a technology that has proven itself in the marketplace...

Book Recommendation: Source Control / Build Process

I'm looking for a good book that describes how small to medium sized development teams utilize version control, and best practices in terms of development and build processes. If the book relates specifically to .NET, that's a plus, but it can be language agnostic. Any recommendations? ...

In which layer are you putting your REST api?

Our application is structured something like: UI <--> REST API <--> Workflow <--> Business Logic <--> DAL <--> DB However, I am seeing a few examples where it looks like people are doing UI <--> Workflow <--> REST API <--> Business Logic <--> DAL <--> DB Is this my imagination? Or is the second option considered a viable alternativ...

Codify a measure in a database field name

Hello, I've got a question concerning fields in databases wich are measures that might be displayed in different units but are stored only in one, such as "height", for example. Where should the "pattern unit" be stated?. Of course, in the documentation, etc... But we all know nobody reads the documentation and that self-docummented th...

How many parameters are too many?

Routines can have parameters, that's no news. You can define as many parameters as you may need, but too many of them will make your routine difficult to understand and maintain. Of course, you could use a structured variable as a workaround: putting all those variables in a single struct and passing it to the routine. In fact, using st...

How to convert milliseconds into human readable form?

I need to convert an arbitrary amount of milliseconds into Days, Hours, Minutes Second. For example: 10 Days, 5 hours, 13 minutes, 1 second. I'm pretty sure that the trick is fairly simple, but I'm slammed today so I thought I'd reach out to SO's geniuses for a quick fix. Thanks :) EDIT: The language I'm using does not have this bui...