language-agnostic

What professional standards do you maintain in a side/pet project?

When working on your own side project or pet project, you are using your professional skills to develop software, but what professional standards to you stick to? Answers would largely depend on the type of project your working on. A proof of concept or quick demo program might have the worst bit of slapdash cowboy coding. Something so ...

Handling paper documentation

After every new program written a lot of paper documentation remains. Apart from the usual scribble notes from the programmers there usually is a nice heap of papers containing physical model explanations, calculations and so on (equations, tables, graphs, little pictures describing variables ...) We usually do numerically intensive ca...

What is a good definition of a "userdata pointer"?

I have searched for a good explanation but can't find one. I could try to write one myself but I'd prefer if someone with better english could help me explain this for Zan Lynx in the comment here. ...and it seems like there should be a good explanation somewhere, why not here? ...

What's the most efficient way to find the length of the longest item in a list?

Given a list of assorted length words, what is the best way to find the maximum length of any words? For example, the following should return 6 findMaxLen("a,set,of,random,words") Of course, it's fairly trivial to do this... <cffunction name="findMaxLen" returntype="Numeric"> <cfset var CurMax = 0 /> <cfset var CurItem = 0...

Programming exercises to learn a new language

I can not seem to find this exactly as a post, but what I am looking for is a list of exercises to help me get better at programming. Like Fibonacci sequences, temperature conversions, etc. A website would be great. Thanks for any help. ...

Can you list all the funny laws you can apply to computing ?

We all know the common laws that (seem to) rule computing like Moore's law, etc. But there are the funky ones : Murphy's law : Something that can go wrong, will. That's why your if you cover 99 % of your code with unit tests, the 1% breaks during the marketting presentation, the day your mother in law comes for diner while you have a h...

How to get your code ready for Loadbalancing

As we did this in the past, i'd like to gather useful information for everyone moving to loadbalancing, as there are issues which your code must be aware of. We moved from one apache server to squid as reverse proxy/loadbalancer with three apache servers behind. We are using PHP/MySQL, so issues may differ. Things we had to solve: Se...

Most expensive bug/defect you've seen.

What is the most expensive software bug / defect you've seen in practice. There are some famous cases like the Therac 25, but I'm interested to know what issues you've seen yourself or heard of directly. We all have "a friend who used to work at an old company" and would never admit to accidently charging peoples credit cards ourselves...

Does Wirth's law still hold true?

Adage made by Niklaus Wirth in 1995: «Software is getting slower more rapidly than hardware becomes faster» Do you think it's actually true? How should you measure "speed" of software? By CPU cycles or rather by time you need to complete some task? What about software that is actually getting faster and leaner (measured by CPU cycle...

Safely store credentials between website visits

I'm building a website which allows users to create accounts and access the site's content. I don't want users to log in each time they visit the site, so I'm planning on storing the username and password in a cookie -- however, I've heard this is bad practice, even if the password is hashed in the cookie. What "best practices" should I...

Alternatives to Web-Application?

Suppose you've got a customer who wants an application that has its data centralized stored and maintained, users can connect to it (but can also have data locally stored) and work with it and not using a browser to view and modify the data. Furthermore the application itself should also be centralized maintained. So no traditional web-...

Where do we draw the line with vocabulary when naming?

The other day I was looking through our code and I came across a class name IdempotentObject I didn't know what this meant at the time so I questioned whether it was a poorly chosen name. I found out who wrote it and asked the developer why he had named it so confusingly. He was surprised that I didn't know what it meant and told me tha...

Studying standard library sources

How does one study open-source libraries code, particularly standard libraries? The code base is often vast and hard to navigate. How to find some function or class definition? Do I search through downloaded source files? Do I need cvs/svn for that? Maybe web-search? Should I just know the structure of the standard library? Is there...

Magic numbers vs named constants

When writing code, especially when dealing with dates and times, you have to work with a lot of specific numbers, eg: 60 seconds in a minute, 3600 = seconds in an hour. Some people stick to using the raw values for many of these, whereas others put them into constants to increase readability. eg: $x = time() + 3600; $y = time() + 8640...

Should you test an external system prior to using it?

Note: This is not for unit testing or integration testing. This is for when the application is running. I am working on a system which communicates to multiple back end systems, which can be grouped into three types Relational database SOAP or WCF service File system (network share) Due to the environment this will run in, the...

Counting with an Integer Divide-based routine - Is there a formulaic approach?

Consider a routine that counts by successive divide w/ remainder operations. Starting with a 64-bit dividend, the routine divides by a constant divisor. If the remainder is 0, the routine returns. Otherwise, a new dividend is constructed by multiplying the remainder by 2^32 and adding the integer quotient. In code: /// ULong ...

How many lines of code should a function/procedure/method have?

I've recently been given the unenviable task of reviewing poor code written by another developer and documenting the bad practices. (This is all for the purposes of getting out of paying for the developer's work rather than any altruistic reason, of course!) The reviewed code has several procedures that are many lines of code - the long...

Web automation

I'm developing an interface between an old web based application and another one. That old web-based application works fine but there no exists any API to communicate with. There is any programmatic way to say a web-form something like: enter this value on this field, this one ins other and submit form? UPDATE: I looking for something ...

Should I use an interface like IEnumerable, or a concrete class like List<>

I recently expressed my view about this elsewhere* , but I think it deserves further analysis so I'm posting this as its own question. Let's say that I need to create and pass around a container in my program. I probably don't have a strong opinion about one kind of container versus another, at least at this stage, but I do pick one; fo...

Enums and Constants. Which to use when?

Hi all, Okay this may seem like a silly question but I'm fairly new to all this. I was doing some reading on enums and find them very similar to declaring constants. How would I know when to use a constant rather than an enum or vice versa. What are some of the advantages of using enums? I never used them before. I'm working with c#. ...