Click here to Skip to main content
15,915,083 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
AnswerRe: What to call array indexing starting at 0 vs. 1 ? Pin
CPallini19-Sep-13 7:33
mveCPallini19-Sep-13 7:33 
AnswerRe: What to call array indexing starting at 0 vs. 1 ? Pin
BillWoodruff19-Sep-13 20:13
professionalBillWoodruff19-Sep-13 20:13 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
pkfox19-Sep-13 20:52
professionalpkfox19-Sep-13 20:52 
AnswerRe: What to call array indexing starting at 0 vs. 1 ? Pin
ExcellentOrg19-Sep-13 21:14
ExcellentOrg19-Sep-13 21:14 
AnswerRe: What to call array indexing starting at 0 vs. 1 ? Pin
daniel_bingamon20-Sep-13 0:59
daniel_bingamon20-Sep-13 0:59 
AnswerRe: What to call array indexing starting at 0 vs. 1 ? Pin
kalberts20-Sep-13 1:36
kalberts20-Sep-13 1:36 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
Sentenryu20-Sep-13 2:24
Sentenryu20-Sep-13 2:24 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
kalberts20-Sep-13 3:22
kalberts20-Sep-13 3:22 
Sentenryu wrote:
If you hardcode that, you're doing it wrong.

We all (I assume) have laughed at that old Xerox Fortran manual (yes, Xerox did make computers, long time ago), describing how the PARAMETER statement (roughly equivalent to a C #define) could be used to give a symbolic name to a numeric constant, so that you can write PI instead of 3.14159....

This will reduce typing, improve readability, and ease program maintenance, according to the manual, in case the value of PI changes.

Making software general is a good principle, but it can go too far. Say, if you create a highly specialized program for processing some data related to WW2, and your array of events is indexed by years 1939 to 1945, you could ride your principles so that this program can be adapted to changing conditions, such as starting in 1952 and lasting until 1966. Sure, from an academic point of view, you gain a lot of flexibility; you then have a program system that can handle a lot of different WW2s, not only the real one, but any number of counterfactual ones. Which is valuable from an (information technology) academic point of view.

I guess the historican who uses this program to manage information from the factual WW2 could care less about the counterfactual ones. He would rather relate to "1939" than to "FirstYearOfWar" - is it the first year the US was involved? Or the first year of buildup of the military forces? Or the first full year of war, not counting years which were peaceful for the first months?

Super-generality may be destructive both to readability and understanding. And it might complicate code, both for the programmer and compiler, as the generality opens for a large number of exceptional (and non-exceptional) cases possible in the generalized model, but which will never occur in the factual domain that you are modelling.
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
Sentenryu20-Sep-13 3:41
Sentenryu20-Sep-13 3:41 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
kalberts20-Sep-13 4:12
kalberts20-Sep-13 4:12 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
englebart20-Sep-13 3:18
professionalenglebart20-Sep-13 3:18 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
kalberts20-Sep-13 3:25
kalberts20-Sep-13 3:25 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
PIEBALDconsult23-Sep-13 4:03
mvePIEBALDconsult23-Sep-13 4:03 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
Michael Waters23-Sep-13 5:39
Michael Waters23-Sep-13 5:39 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
kalberts24-Sep-13 23:05
kalberts24-Sep-13 23:05 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
Michael Waters25-Sep-13 3:28
Michael Waters25-Sep-13 3:28 
AnswerRe: What to call array indexing starting at 0 vs. 1 ? Pin
englebart20-Sep-13 3:34
professionalenglebart20-Sep-13 3:34 
AnswerRe: What to call array indexing starting at 0 vs. 1 ? Pin
etkid8420-Sep-13 4:03
etkid8420-Sep-13 4:03 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
Michael Waters23-Sep-13 5:41
Michael Waters23-Sep-13 5:41 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
kalberts25-Sep-13 1:25
kalberts25-Sep-13 1:25 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
Michael Waters25-Sep-13 3:37
Michael Waters25-Sep-13 3:37 
AnswerRe: What to call array indexing starting at 0 vs. 1 ? Pin
RefugeeFromSlashDot20-Sep-13 5:21
RefugeeFromSlashDot20-Sep-13 5:21 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
kalberts25-Sep-13 0:44
kalberts25-Sep-13 0:44 
GeneralRe: What to call array indexing starting at 0 vs. 1 ? Pin
RefugeeFromSlashDot25-Sep-13 2:56
RefugeeFromSlashDot25-Sep-13 2:56 
GeneralFor the racing car fans Pin
vonb19-Sep-13 3:17
vonb19-Sep-13 3:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.