|
CDP1802 wrote: but does anybody know what a pflohneos, a finach or a fidel is?
Pfl ohne os, FileInfo nach, and a well known cuban dictator.
|
|
|
|
|
You are right. As if DD's CCC had been turned into a convention for variable names
Pf = Pfad (Path)
l = ???
ohne = without
os = operating system (Does that make any sense at all? Sounds just like 'Purple dog over the moon')
fi = file info
nach = after (after what, exactly)?
I have marked the printout on the wall with color markers and also added some notes. At that place I also wrote 'Castro?'
Ah, I got it! He's deleting files!
fi = file (please note that he has galantly switched to English now)
del = delete
Here's another good one: danapfl
dana = Dateiname (filename, first I thought he started to name things after his daughters)
pf = Pfad (path)
l = ???
What form of insanity is this and how is it treated?
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
Is the nutcase an old git that learned programming when bytes were expensive? I'm thinking about classic unix folder names like 'USR' here.
It could be fun decrypting this, but I think I would need to see more of the spaghetti monster to have a fair chance.
|
|
|
|
|
He definitely is. Decoding his stuff is fun as long as the code gives you some hints to what is going on. Here he's messing around with files. By trying to kill running executables he also gives me the impression that this is supposed to be some kind of DIY deployment and updating mechanism. It really gets funny when it comes to updating the obviously running program itself.
If you really want to have a challenge, then you should look at how he works with relational data. First everything is 'imported'. That means a lot of files are copied from somewhere in the network into a folder of the mobile device. The stuff is not XML or CSV, of which he usually is very fond. It's some creation of his own with fixed record and field lengths. And then he does not actually import anything. The program searches through those files to find and display data and changes are made to copies in another folder. Those changes are then sent off into the network again once the device is docked.
That's what I call retro! A 'database' in the style of 1960 and a DIY DBMS that relies heavily on the file system and 'database files' which must be named after the primary keys of the content. All that in a mobile application that has been finished last week
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
I'm one of those old gits. Honestly, I don't see what the problem is with the code except for the variable names. The programmer set all the files to read-only as a precaution. Probably not necessary now with the fast drives and IO buses, but in the 90's, it would have been a good precaution.
As for the term spaghetti monster, the term doesn't fit the example. At no time does the code jump out of scope, unless the definition has changed to include bad variable naming.
|
|
|
|
|
Can't answer the part about spaghetti code or the other errors as I haven't seen more of the code than anyone else on the forum.
But empty catch blocks is a coding horror in my book. And those abbreviated variable names are just plainly unnecessary today.
|
|
|
|
|
Cryptic variable names would have been a prrogramming crime 20 years back too. It was the binaries where bytes were expensive, not the source code.
|
|
|
|
|
Florin Jurcovici wrote: Cryptic variable names would have been a prrogramming crime 20 years back too
Indeed, I was thinking more like 40-50 years back in time when harddrives were a novelty.
|
|
|
|
|
Maybe he's using a technique of a friend I used to program with. His style was that all variables names must be 8 characters long. He would take 8 divided by the number of words you would normally use to describe the function/variable name to arrive at the number of letters to use from each word.
So "Print Spooler" would become "PRINSPOO" (not so bad, but note all caps), but "Shipping Station Control Loop" would become "SHSTCOLO".
Maybe as you suspect "dana" means "date in name", so "finach" may be "File Name Change"?
Psychosis at 10
Film at 11
Those who do not remember the past, are doomed to repeat it.
Those who do not remember the past, cannot build upon it.
|
|
|
|
|
Dateiname = Datei Name = file name. Datei is German word for file.
|
|
|
|
|
The real horror is that mess should never have gone out the door and into the customer's hands.
The customer needs to be given proper replacement ASAP and, of course the original programmer should not touch the replacement program. And tar and feathers is to good for the individual who wrote that mess.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
That's what I have rcommended. It will not be sufficient to refactor a little, as my bosses hope. I have inherited all his projects from the last eight years. They all are such a mess. At least I'm honored that my bosses call me every time they think that all hope is lost
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
Well, it is good to feel needed, but that is a really nasty mess to have to clean up.
Yes, bosses always want a quick, inexpensive fix, but I agree with you that there is no simple quick fix for this.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
My guess is that there's a good chance that this mess got to be delivered because the customer is a cheapskate. That's what you get when you contract to script kiddies instead of serious, qualified and more expensive programmers. And when you insist on things to be delivered yesterday, but never have time to discuss the actual requirements with your service provider.
|
|
|
|
|
Yep, SOP is to provide little time, little money, little information, then blame the programmers when the software isn't perfect.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
The sad thing is that it is beautifully indented, follows code formatting standards and probably passes all sorts of automated metrics (though empty catch blocks should trip up any of those). And yet it's completely, irredeemably awful.
|
|
|
|
|
True, pretty code does not guarantee good code. See my sig.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
CDP1802 wrote: pflohneos, a finach or a fidel is?
That's quite elementary my dear Watson!
pfl = pathfile
ohne = without
os = OS
finach and fidel are variable containing FileInfo objects so the first part (fi) shoult be easy.
nach = after (so be on the lookout for a variable like fivor)
del = delete
To f*** things really up for my cow-workers I'd have preferred variables named after whiskeys. Or better yet random text strings.
Cheers!
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
How about hexadecimal?
F87AB986DEADC0DE and E87AB986DEADC0DE
At least artificial intelligence already is superior to natural stupidity
modified 4-May-12 4:13am.
|
|
|
|
|
Did he move from VB and miss the On Error Resume Next statement?
Ideological Purity is no substitute for being able to stick your thumb down a pipe to stop the water
|
|
|
|
|
I think he was already around when the abacus was invented. But now that you mention it: VB is the only horror I have never seen him commit.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
'Nuff said.
public class SysAdmin : Employee
{
public override void DoWork(IWorkItem workItem)
{
if (workItem.User.Type == UserType.NoLearn){
throw new NoIWillNotFixYourComputerException(new Luser(workItem.User));
}else{
base.DoWork(workItem);
}
}
}
|
|
|
|
|
ok, this makes me question some of my code. I am pretty much self taught and don't have a lot of resources available other than online and within the help features. I comment quite a bit and try to use easy to understand variables (because otherwise a few months down the road when I need to add an update, I need to look back and know what I was doing).
However, I do use empty catch blocks fairly often. Typically what I will do is set a variable to a default, then use a DB query to populate the variable with in a try/catch block (if the query returns no record it throws an exception). Then after the catch block, I'll check if the variable is the default value or not and execute code accordingly.
Is there a better way or a standard practice that would be better? (see my sample snippet below, I use the prefix lowercase L to indicate the scope of variables that I reuse often)NOTE: This is a Windows Form app not a web site
int HCID = -1;
try
{
lSQL = "Select HCID from HistoricalConversion where CoNum = '" + HCCoNum.Text + "'";
lAccessCmd.CommandText = lSQL;
HCID = (int)lAccessCmd.ExecuteScalar();
}
catch (Exception ex)
{
}
if (HCID > 0)
{
}
|
|
|
|
|
What you are doing there is controlling the program flow by catching the exception and doing nothing else with it. That's not very good because exception handling is very slow. A simple 'if' to check wether you have gotten any rows would suffice and your code would be faster and besides that easier to read and understand. ExecuteScalar() is a bit ugly because it returns an object if I remember right, so you must check for a null reference and after that use an adequate type cast.
Besides that, just take exceptions by their name. They point out unexpected or unusual events. Don't use them for anything you expect. I usually take care of three cases:
Some exceptions are avoidable. They are just cases which I did not consider in my code. This would be the NullReferenceException for example. Checking for null at the proper places is easy enough, but once in a while you simply forget it or did not expect a null value at that location. To prevent the program from terminating there should be a 'line of defense' where all exceptions are caught and at least are logged in some way, together with a stack trace and, if possible, any other relevant parameters. If you go through the trouble to read the log and then eliminating the causes of the exceptions, then you have a mechanism that's worth more than many unit tests and you will eventually get a very robust program.
Then there are correctable exceptions. Obviously it's then a good idea to do whatever needs to be done to correct the problem in the catch block. Again, avoid the exception if you can. This is only for those cases you can't handle in any other way. And log it. When using your last option shows up too often in the log, it's time to consider improving the code.
And then there are exceptions you cannot foresee, like calling a web service and getting a timeout because the server does not respond. Nothing much you can do about that except trying again later (or taking a look at the server if you can). Anyway, whatever you wanted to do is impossible for now and the exception then should be caught so that the following now futile steps are omitted.
At least artificial intelligence already is superior to natural stupidity
|
|
|
|
|
Yes that is exactly what I am doing. I'm using the try/catch to handle the null reference exception that is thrown if there is no value. Is there a better way to do it?
|
|
|
|