cancel
Showing results for 
Search instead for 
Did you mean: 

over reliant on clueless computers

magnetism2772
Grafter
Posts: 983
Registered: 06-06-2010

over reliant on clueless computers

ie looking into some computing programming
i saw this line;
y= y;    /well of course it does
here are codelines written by a programmmer with lots  experience , who knows how dumb computers are ,and wants to make sure , as in this line
let x = 209;
let x = 209;
some decide they need to program a function to answer a multi choice question
as in the following code lines below,

int val;
get(val);
if  val == 1 | 2 | 3 /* multichoice*/
do convert_Intoi(val);
else
return 0;
int convert_Intoi(val)
{
if (convert_Intoi(val))== 1 return 1;
if (convert_Intoi(val))== 2 return 2;
       if (convert_Intoi(val))== 3 return 3;
else(return 0);
}
   return  0;
what the  hell ....?
another stupid case where computers create redundancies
72 REPLIES
Community Veteran
Posts: 6,735
Thanks: 12
Registered: 02-02-2008

Re: over reliant on clueless computers

Hmmmmm, what language are they?
Most could easily be correct, validating an uncontrolled/unvalidated keyboard input for example and delivering a well-defined set of internal numeric values.
As an ex-programmer it never ceased to amaze me how many lazy programmers didn't properly validate data, wrote rather brief code and frequently got the wrong answers.
magnetism2772
Grafter
Posts: 983
Registered: 06-06-2010

Re: over reliant on clueless computers

Hmmmmm, what language are they?
if I asked I'd likely be told its  'english'
and probably its children during an  IT lesson at school Grin
Moderator
Moderator
Posts: 25,789
Thanks: 1,134
Fixes: 47
Registered: 14-04-2007

Re: over reliant on clueless computers

Programming time = 30% coding....70% idiot proofing Roll eyes
Customer and Forum Moderator.
Product of the Tyrell Corporation
magnetism2772
Grafter
Posts: 983
Registered: 06-06-2010

Re: over reliant on clueless computers

yes Strat
very true

for any input any  of the idea of the output ?
the whole section of code  appears  redundant
input = output in this case
ie input 1  the output is  1 etc
magnetism2772
Grafter
Posts: 983
Registered: 06-06-2010

Re: over reliant on clueless computers

as Its the work of some children at IT class
magnetism2772
Grafter
Posts: 983
Registered: 06-06-2010

Re: over reliant on clueless computers

edited: code 
Community Veteran
Posts: 3,826
Thanks: 44
Fixes: 1
Registered: 24-09-2008

Re: over reliant on clueless computers

Quote from: Strat
Programming time = 30% coding....70% idiot proofing Roll eyes

I work on 10:90 ratio, then often find I've missed something obvious.  Shocked
magnetism2772
Grafter
Posts: 983
Registered: 06-06-2010

Re: over reliant on clueless computers

its written in C
anyone is welcome to create a  program to test the function convert_Intoi()
and test its  output  for inputs of 1 or 2 or 3
Cool
itsme
Grafter
Posts: 5,924
Thanks: 1
Registered: 07-04-2007

Re: over reliant on clueless computers

Quote from: Strat
Programming time = 20% coding....50% idiot proofing Roll eyes

As a hardware designer Programmers use to wind me up with their attitude of 'If there's a bug we can update it later'. No you can't if it's firmware.
So to me it should be.
Programming time = 20% coding....50% idiot proofing and 30% Verify and Validating
Community Veteran
Posts: 6,586
Thanks: 206
Fixes: 14
Registered: 16-02-2009

Re: over reliant on clueless computers

Quote
int convert_Intoi(int val)
{
  if (convert_Intoi(val))== 1 return 1;
  if (convert_Intoi(val))== 2 return 2;
        if (convert_Intoi(val))== 3 return 3;
  else(return 0);
}

My C us a bit rusty, but this seems to be an endless recursive loop. It is calling itself then calling itself ...
itsme
Grafter
Posts: 5,924
Thanks: 1
Registered: 07-04-2007

Re: over reliant on clueless computers

Don't think so but I need to get the books out to confirm  Grin I think it's an If else statement.
magnetism2772
Grafter
Posts: 983
Registered: 06-06-2010

Re: over reliant on clueless computers

==  this is the 'equal too sign' and  not the make it  equal sign  and  the function will return 1 or 2 or 3  only if the  value is equal to an input of 1 or 2 or 3
=    this is the  equal sign 
magnetism2772
Grafter
Posts: 983
Registered: 06-06-2010

Re: over reliant on clueless computers

as a little exercise perhaps a c programmer who reads the post
could make a (simple ?) test program
to check the convert_Intoi() function  and test it for input of 1 or 2 or 3

Lurker
Grafter
Posts: 1,867
Registered: 23-10-2008

Re: over reliant on clueless computers

Presumably there are 4 possible outcomes.
1,2,3 or 0
Dunno why it seems like a strange thing to write - there are lots of uses (and places where identical logic is used)