language-agnostic

With MVC, do interactions with autonomous peripherals belong in the Model or the Controller?

Using MVC with an observer pattern, if a user action requires polling a device (such as a camera) for data, should the polling be done in the Controller and the result passed off the Model or should a request be sent to the Model and the Model itself performs the polling. This question is my attempt to reconcile everything I am reading ...

Test loops at the top or bottom? (while vs. do while)

When I was taking CS in college (mid 80's), one of the ideas that was constantly repeated was to always write loops which test at the top (while...) rather than at the bottom (do ... while) of the loop. These notions were often backed up with references to studies which showed that loops which tested at the top were statistically much mo...

What programming language do you wish would quietly retire?

This is the inverse of the "What programming language do you wish would catch on?" question. I was a Delphi programmer for many years, and I still appreciate its power, but I dislike verbose programming languages. So I would love to see Pascal put out to pasture. The same goes for BASIC in any form, despite the fact that it's the langu...

Implementing xunit in a new programming language

Some of us still "live" in a programming environment where unit testing has not yet been embraced. To get started, the obvious first step would be to try to implement a decent framework for unit testing, and I guess xUnit is the "standard". So what is a good starting point for implementing xUnit in a new programming language? BTW, sinc...

Scheduled Report(task) Monitor

I have to develop a system to monitor the generation/transmission of reports. System data will be stored in database tables (Sybase) Reports will be generated with different schedules ("mon-fri 10pm", "sat 5am", "1st day of the month", etc.) System will just monitor that the reports were created. It will not create the reports itself....

What is the exact problem with multiple inheritance?

I can see people asking all the time whether multiple inheritance should be included into the next version of C# or Java. C++ folks, who are fortunate enough to have this ability, say that this is like giving someone a rope to eventually hang themselves. What’s the matter with multiple inheritance? Are there any concrete samples? ...

Best practices for version information?

I am currently working on automating/improving the release process for packaging my shop's entire product. Currently the product is a combination of: Java server-side codebase XML configuration and application files Shell and batch scripts for administrators Statically served HTML pages and some other stuff, but that's most of it ...

What is "loose coupling?" Please provide examples.

I can't seem to grok the concept of "loose coupling." I suppose it doesn't help that the word "loose" usually has a negative connotation, so I always forget that loose coupling is a good thing. Will somebody please show some "before" and "after" code (or pseudocode) that illustrates this concept? ...

Solving an inequality for minimum value

I'm working on a programming problem which boils down to a set of an equation and inequality: x[0]*a[0] + x[1]*a[1] + ... x[n]*a[n] >= D x[0]*b[0] + x[1]*b[1] + ... x[n]*b[n] = C I want to solve for the values of X that will give the absolute minimum of C, given the input D and lists and A and B consisting of a[0 - n] and b[0 - n ]. ...

How smoothly does a website launch usually go for you?

My coworkers and I were having a discussion about this yesterday. It seems that no matter how well we prepare and no matter how much we test and no matter what the client says immediately before the site becomes public, initial site launches almost always seem to be somewhat rocky. Some clients are better than others, but often things th...

How to avoid Anemic Domain Models and maintain Separation of Concerns?

It seems that the decision to make your objects fully cognizant of their roles within the system, and still avoid having too many dependencies within the domain model on the database, and service layers? For example: Say that I've got an entity with a revision history, and several "lookup tables" that the data references, your entity ob...

How does Yegge's prototype pattern example handle instance variables?

I like Steve Yegge's Prototype Pattern example and decided to whip up a quick proof of concept example. However, I didn't really think things through. While it is great for dynamically specifying the behaviour of objects and is an easy solution to Steve's opinionated elf example, I'm still trying to work out the best way to handle inst...

A "regex for words" (semantic replacement) - any example syntax and libraries?

I'm looking for syntatic examples or common techniques for doing regular expression style transformations on words instead of characters, given a procedural language. For example, to trace copying, one would want to create a document with similar meaning but with different word choices. I'd like to be able to concisely define these po...

What to cache when 99.9% of your data changes frequently?

Okay I know I asked about this before, and the answer was basically cache data that doesn't change often. Well what does one do when at least 99.9% of the data changes? In my project the only tables that doesn't get updated or won't get updated frequently would be the member profile info (name/address, and settings) So how does one st...

Correct order for control structure logic (true/false, false/true)?

I am new to programming, and am wondering if there is a correct way to order your control structure logic. It seems more natural to check for the most likely case first, but I have the feeling that some control structures won't work unless they check everything that's false to arrive at something that's true (logical deduction?) It wou...

Where can I find information about business logic patterns?

What I am looking for is some overview of "design patterns", but not on the coding level (factory, singleton, mvc, ...) but on the business logic level. In other words: The layer between coding logic and domain logic. I don't know if that is understandable, so here are some typical business logic pattern questions for an ERP applicati...

Explaining refactoring

Question My question is how can you teach the methods and importance of tidying-up and refactoring code? Background I was recently working on a code review for a colleague. They had made some modifications to a long-gone colleagues work. During the new changes, my colleague had tried to refactor items but gave up as soon as they hit a...

Automated acronym creation

Is there any easy way to create an acronym from a string? First_name Middle_name Last_name => FML first_name middle_name last_name => FML First_name-Middle_name Last_name => F-ML first_name-middle_name last_name => F-ML ...

Applications using Decimal versus double . . .

I wanted to see if folks were using decimal for financial applications instead of double. I have seen lots of folks using double all over the place with unintended consequences . . Do you see others making this mistake . . . ...

Fibonacci Code Golf

Generate the Fibonacci sequence in the fewest amount of characters possible. Any language is OK, except for one that you define with one operator, f, which prints the Fibonacci numbers. Starting point: 25 characters in Haskell: f=0:1:zipWith(+)f(tail f) ...