How To Write Unmaintainable Code
/ writes "Roedy Green of Canadian Mind Products has written an essay entitled "How To Write Unmaintainable Code". Following his 54 tips, you too can guarantee job-security by becoming irreplaceable. If that weren't good enough, it's even available in Spanish. "
That had be laughing outloud! Being a web developer, I have often had to work with code that tried to do many, many thing. One web page would try to accomplish thirty different things, based solely upon the querystring parameters passed in. Ugh. Now there's job security! :)
I could not justify my existence if I were a turkey farmer. Would I terminate myself? Undoubtably, yes.
Writing unmaintainable code for job security is a Bad Idea (TM). Cuz guess what? You might end up the victim of your own practices -- and who's going to get fired when they've failed to figure out code they wrote a year ago? You. Don't do it. Maye you should work somewhere else where they know how much you're important and valuable to them, so you don't have to take such measures as to write bad code. And if you're going to get replaced so easily then maybe you were not worth your salt in the first place.- -----
-----------------------------------------
-----------------------------------------------
Unix _is_ user friendly, it's just particular about who its friends
However, don't we, as programmers, have some sort of obligation to try our best to create nice, maintainable code? I may be getting a little too philosophical here, but we expect artists to paint to their best abilities, poets to write to their best ability. It seems like if someone in one of these professions purposefully wrote sloppy poetry, or half-assed a painting, that we would look down on them. Perhaps it is a pride thing, but you think you'd intrinsically want to write good code.
I am not trying to sound preachy, CFN, for I don't know if you wrote sloppy code because you wanted to, or, more likely, because you were rushed and your superiors favored quantity of quality.
I could not justify my existence if I were a turkey farmer. Would I terminate myself? Undoubtably, yes.
I Quote from the essay .... Maintenance programmers, if somebody ever consulted them, would demand ways to hide the housekeeping details so they could see the forest for the trees. They would demand all sorts of shortcuts so they would not have to type so much and so they could see more of the program at once on the screen. They would complain loudly about the myriad petty time-wasting tasks the compilers demand of them.
This is precisely the reason VB is so popular for business apps. You have to really work hard to confuse matters sufficiently in a VB program so that a decent maintenance programmer can't figure it out.... although I could write my own list applicicable to Vb for my current project... My favorite: Make sure you have the same variable name to reference a database in several different classes in several different programs, but have it point to three different databases depending on which variable is in scope currently :)
DO NOT DISTURB THE SE
Personally once I write some code I want it to be maintainable enough so other people can contibute for I can move on with other things. I do not feel that my life consists of solely maintaining code, why not do something challenging? Rather then babysitting one of my past accomplishments. Why not take over the world?
Back in the good old days of DOS (and thus, 80x25 page size), I had a programmer in my team who followed the "all functions must fit on one page" rule...
Man, the number of times I wanted to kill that guy. We called him Anti-Whitespace.
Scarey though, how that page gave guidelines that I myself have been guilty of following too many times in the past. Is there a counter-page to that one, that gives guidelines (general purpose) that make it easier to work with other programmers?
; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
I hate it when members of my team write unmaintainable code. Frequently, when time's short or when people need help, I have to dive in, and I've found it difficult to get my bearings in code that I did the initial design for - difficult to see the forest for the trees, even when I planned out the forest.
Good practises in programming isn't just for academics; it's the epitome of professional code writing. A manager once tried to draw the definition of a hack and a real programmer by the completeness and bug-free state of their code. I think he's wrong. I think that a real hack writes code that no one can pick up. A real programmer writes code that anyone can pick up and fix or expand - whether it's complete at any one point or not.
--
--
There is no premature anti-fascism. -Ernest Hemingway
The stuff at the end about coding environments is very similar to what I have heard Smalltalkers describe as how a good Smalltalk environment works.
And of course anyone who wants to avoid accidentally using a few of those practices could be worse advised than to buy, read, and apply the concepts in a copy of Code Complete...
Cheers,
Ben
My usual seat in the cluetrain is at A HREF="http://pub4.ezboard.com/biwethey.ht
Now I write good code. Maintainable. Well commented. Meaningful variable names. Nothing fancy. I know what it's like to revisit my code ten years later.
There is a problem, though.
Nobody else seems able to maintain my code. They just can't understand it.
Despite high-level pseudo-code algorithm descriptions, threaded comments, good up to date written documentation, they just can't wrap their tiny little heads around how I do things.
I can go back to something I wrote 15 years ago and fix problems without generating new ones. My code is robust enought that I can shovel out a few thousand lines and jam in another 10,000 lines, test it for a day or two and release it... and get no bug reports for another 5 years. I consider this to be maintainable code!
Go ahead... break all the rules suggested in the article. You may still produce code that other, lesser programmers simply can't cope with. The code is an expression from the mind of the person who wrote it... and sometimes writing to the lowest common denominator simply isn't possible.
And then they blame you for writing unmaintainable code.
-Eldurbarn
It's not a philosohpical issue, it's one of practicality:
;-)
;-)
When (not if) you end up maintaining someone else's code, if the code has been written in a clean way, it can be a sure joy to work with. If not, you'll be cursing that programmer for eons.
(Lets keep Microsoft's API out of this ok
The REASON we want good clean code is so that _we CAN_ maintain it.
I have been in the position of looking at my own code 6 months, later, and gone "WTF?", and wasted lots of time trying to figure out just what the heck I did.
If I had just spent the extra time to begin with, later on I could of been more productive instead of wasting time re-engineering the damn thing.
Pay the piper up front and save time later, or be a "saving time" grinch, and find an expensive time bill later. Seems pretty obvious what "The Right Thing" to do is
Work smarter, not harder =P
Cheers
BTW, Steve McConnel has a great book: Code Complete.
Byte had a feature entitled: "How to Fail at Software Development, Don't Communicate" it at a slightly higher level, but is just as useful.
--
"L'IT c'est moi!"
That is right. If you set out to do it in a sane way from the beginning you will very likely get the same task done more quickly than if you just hack out something on the fly and try to make it work. The maintainability and lower bug rate is a bonus on top of that.
Cheers,
Ben
My usual seat in the cluetrain is at A HREF="http://pub4.ezboard.com/biwethey.ht
They wrote a converter that digested the assembler and produced C code... about 4 lines of C for each line of assembler code.
So a math calculation that could easily be written in 1 line of C took 30 or 40 lines of assembler which converted into 120+ lines of C. (Stop screaming!)
Their converter did not put the original source line as a comment in the new source. (Now you may scream!)
Now I gotta maintain this pile of compost. I'm looking for another job.
-Eldurbarn
In naming functions, make heavy use of abstract words like it, everything, data, handle, stuff, do, routine, perform and the digits e.g. routineX48, PerformDataFunction, DoIt, HandleStuff and do_args_method.
He forgot "Thingy"! How can you forget "Thingy"? As in "Take the thingy passed in by the user, send it through the thingy, and return the thingy to the user" and "Merge the two thingies, extract the resultant thingy, discard the other thingy, you don't need it here, and then pass the thingy on to the next thingy."
I'm amused by how many posts here actually took this article seriously, seeing that it came from the "It's funny. Laugh." department. I suppose the phrase "It's funny. Laugh." should be taken in the imperative? :-)
mikre he sophia he tou Mikrosophou.
Ignore the conventions in Java for where to use upper case in variable and class names i.e. Classes start with upper case, variables with lower case, constants are all upper case, with internal words capitalised. After all, Sun does (e.g. instanceof vs isInstanceOf, Hashtable). Not to worry, the compiler won't even issue a warning to give you away. If your boss forces you to use the conventions, when there is any doubt about whether an internal word should be capitalised, avoid capitalising or make a random choice, e.g. use both inputFileName and outputfilename. You can of course drive your team members insane by inventing your own insanely complex naming conventions then berate others for not following them. The ultimate technique is to create as many variable names as possible that differ subtlely from each other only in case.
(e.g. instanceof vs isInstanceOf, Hashtable)
they are all valid w.r.t the conventions.
instanceof is an operator and a keyword hence should be all lowercase, isInstanceOf is a method name, hence should start with a lower case character and the rest of the words should be capatilized, and Hashtable is a class name hence every word should start with a capital. Hashtable is the only one you could argue, but I'd say that sun just think Hashtable is one compounded word in itself not two words that describe a class's function.
- Put all your code into a single function. (I've seen functions over 2000 lines in length.) After all, those nasty functions generate overhead on each call, and you want your code to be efficient right?
- Use hungarian notation for variables. Then instead of the overly verbose you have the nice and compact
- Don't indent your code uniformly. (This is a variation on #11 from the article.) Use Windoze or vi editors, with non-standard tab widths, for tabbing and indenting, which means that no one can see your code indented properly unless they use the same tools you use, with your same editing configuration.
- If using C or C++, don't use memory analysis tools like Purify, or its open source equivalents. After all, if you find your bugs too quickly, you might lose your job.
- On large projects with several programmers, make sure you change global header files that cause everybody else's code to break but yours. Do this late in the afternoon, so all hell breaks loose breaks right before people are going home, or late at night, so that everybody comes in fresh the next morning and wonders what the hell happened to the code that compiled perfectly when they left the day before. Either way, make sure you are not around when they find out! Otherwise you spare them the joy of figuring out what you changed, and why.
- Do really stupid stuff that you were taught from day 1 not to do, but everyone seems to do anyway: don't check for NULL, fix array sizes where you hardcode the max size everywhere, don't check for invalid or oversized input, etc.
- Use preprocessor macros. Lots of them. (I was actually on a project where someone suggested using cpp to define macros. For Java. Absolutely brilliant!) The key is to use a single macro for multiple statements, in effect using macros as function calls. Example: Notice the "hidden" use of external variables and functions. Remember, you want to avoid those expensive subroutine calls! And think of the joys of setting breakpoints and stepping through a debugger on that code!
- Don't use source code control. Or, use it, but never unlock or checkin your files. Feel free to steal locks on others, though.
And finally, one of my favorites, for all the young and aspiring hacker types out there:BONUS: With compact hungarian notation, you can become even more descriptive! So really the above becomes:
So much more descriptive information, all in the same amount of space. I've been on projects using this, and the sheer of joy of it cannot be accurately described in words.BONUS: Write extremely long lines of code, well over 80 characters per line.
BONUS: Do this right before a major deadline.
BONUS: Don't use the all uppercase convention in macro names; use the same naming convention as function calls. It's even more fun to debug when you have to spend time actually figuring out do_stuff() isn't even a function call!
MORE BONUS: Nest macro calls. Use the naming convention above.
EVEN MORE BONUS: Use macro calls as variables. Make sure the expanded macro makes function calls. Or uses other macros.
- Write code only for yourself. Assume no one will ever need to figure out how to use your code without poring through it in painstaking detail. Do not make it easy to use, interface with other code, or even compile. Include 30 caveats that would take you only a few minutes to fix, but you're just too lazy to. In other words, write as if no one will every look at or use your code, yet release it to everyone to look at and use. Defend your laziness, which is causing thousands of lost hours of work to others, by uttering useless and stupid "cool hacker" mantras like "Real Programmers don't write documentation" and "If it was hard to write, it should be hard to understand."
Phew. That little tirade made me feel good.----------
In a real emergency, we would have all fled in terror, and you would not have been notified.
Enjoy
---
This sig has been temporarily disconnected or is no longer in service
I don't know what you're smoking, but that doesn't just look like it isn't code: it isn't code.
At least it's not C code.
You can't declare variables inside of a for statement, and even if you could, I've no idea what i--> is supposed to parse as.
/peter
main(){main(fork());}
The site was slashdotted, so this might be on it. What I like to do:
Name variables a series of l's (the letter) and 1's (the number). So you'll have:
ll1l1lll1
ll11ll1l1
1ll1l1l11
ll1111lll
and so on. Sure, if they use a font that clearly shows the difference, it's no fun. But it can be!
Good evening class. I'll be your exorcizer of idealistic nonsense for the evening. Just call me Bruce.
Now... preach all you like about how hard it'll be for the next guy, but like customizing my car or my house... I don't worry about what the next guy will think about my code. Do you care if the next owner of your car might not like it if you paint it red? Do you care if the next owner of your house disapproves of you converting the garage into a pool room? Heck no. Well, it's the same with me. I work for my own benefit, pleasure, and satisfaction. And to do that I've gotta do the best damn job I can at work. Otherwise; no money; no fun. This philosophy is reflected in my code as well. I've cranked out some godawful nasty kluges that confuse even me when I look at them a year later... but I got the job done, by the deadline, while some of the junior programmers seem to wanna rewrite everything to make it clean rather than break the nice design of the code. Feh. That's why they're junior programmers. They Just Don't Get It (tm). Their plan would send the company under. Stuff's gotta be done now and ship next week or there's no profit for the company and no salary for the programmers. Junior programmers always seem to be self-delusional with grand plans of redesigning everything. It never happens. Requirements change *ALL* *THE* *TIME*. Any static plan is doomed to fail. Once they realize this they make the transition from dreaming programmer to master hacker... or they can't keep up with the pace of real world business and disappear. You've got to be able to deal with old crusty projects written by long gone staff with more bags and bells and whistles and ornaments hanging off the side and kluged into it, written by more people you've never met, and you've got to be able to quickly and successfully hack more stuff into it and hack it and rehack it and change old stuff and keep it all running. Successful, on the fly, under the gun kluging is what distunguishes the Senior Programmers driving the big smog polluting, shitty mileage, comfy luxury cars into the front, covered parking space and getting the stock options and profit sharing and 401Ks from the idealist larval dreamers driving their small car becuase "it's good for the environment". Self-spirit-lifting-and-self justification-bull. Given the Big Bucks, you'd ditch that Civic for a gas guzzling SUV or Corvette too. So forget the dream. Getting a clean slate to build on is a rare event. 99% of all programming jobs you'll ever be hired for will be holding together someone else's code. Insane deadlines, getting the jump on the competition mid project, reamping of requirements (many times over), decision reversals by management, your latest self-gratifying achievement being abandoned and dumped because it's not needed anymore. These will all eventually break your spirits. On the plus side, once you realize this, you will be able to succeed and advance within your company or find it easy to get hired at the next comapny. because quick thinking master hackers who can do the magic again and again despite laying waste to the original vision and still keep on kluging and have it keep on working are what companies want. If you can do this, you will succeed. Getting back to the original question... do I obfuscate my code? It may certainly look that way to the idealist, but not so. True brilliance is messy. Remember the famous comment preceeding the task switching code in Unix... /* You are not expected to understand this */ But if you can, you'll be a god... or root... what's the difference again? Anyway, class dismissed.
Friday:
Me: Well I'm done with that latest addition you asked for. I'm going to clean the code up a bit and then head home.
PHB: Oh that can wait, can you add -insert feature here- and have it up by the end of the day on monday?
Its so hard to get mad when they're paying you that much. And in the end, it is job security ;)
I ate my sig.
Well I'm still a staunch opponent of using goto. Maybe goto makes you feel superior because you're using Microsoft's crown jewel of BASIC programming but unless you've got employers to impress Microsoft isn't everything.
Remember the old motto...
If you can't be replaced, you can't be promoted.
Don't leave your mind so open that your brain falls out. Don't close it so much that you cut off the blood.
... if you think anyone would EVER be a victim of this practice. You think they want to rewrite the whole thing from scratch just to have the joy of firing you. I had a prof who told us his strategy when he worked as a programmer - leave the company so that they have hire you as a consultant at four times what you were making because you are the only one who can figure out your code. Brilliant! I used to write maintainable code. My boss once told me how great my coding and commenting was because anyone who came along later could figure it out. Then he retired. The next recession things slowed down, and I got cut because any newbie could read my code and build on it, while everyone else stayed around because they were invaluable - their coding was complex. I would tell people in interviews about my boss's comments on my code maintainability, AND THEY DIDN'T CARE. It's a moot point with employers, they don't have the vision to look ahead and value maintainable code, and they will throw you on the street the first chance they get if it doesn't hurt them. So I say screw them and make yourself invaluable.
It is apparent that your company is using a very ad hoc development process. It is UP TO YOU to work to change this, particularly if you're working with a lot of non-technical people. Try and convince your management to implement a formal development process. For each project, write a requirements document. Make several parties sign off on it. Make it so that any change to the requirements also has to be signed off by all parties. Whenever they requiest a new feature, simply tell them: "Adding feature x will take another 10 days. Either we can push the schedule back by 10 days, or we can remove feature y or feature z." This gives them a few choices, and if they insist that you implement both features, tell them it's impossible, and that they should know that as you've already set out the schedule and had them sign off on it.
As a responsible, professional software engineer, these are things you should be trying to do. If there is resistence to implementing a formal development process, you may have to negotiate a little bit. But ultimately, there is nothing unreasonable about doing business in a formal, well-defined manner. If they refuse to do things this way, make sure you remind them that there will be serious consequences (personally I would threaten to quit the job and work for a more reasonable employer, but that's not for everyone): bad software, missed deadlines, and maintenance hell. This gets you completely off the hook if anything goes wrong. And when things do go wrong, they'll think "he was right", and they'll realize just how good you really are.
If you want to be a successful software engineer, you need to adopt the attitude that you will NEVER be involved in a failed project (I had the chance to take an excellent course with Marshall Cline, of C++ FAQ fame, and this is one of the things he stressed most heavily and I see a lot of truth in it). You need to take a proactive approach. Take steps to ensure that management is doing things right, rather than simply sitting back and carrying out their instructions without saying a word. Of course, be diplomatic. This is part of a software engineer's job, IMHO. It is things like this that separate the men from the boys in the industry; the true software engineers from the coding monkeys. If you are a software engineer, it's your job to ensure that the company develops the best software possible, or at a more fundamental level, to minimize the time, money, and risk the company expends on the project. Doing that involves more than just coding.
I don't know that it's necessarily possible to get a "universal language", but an algorithms repository with a set of translators to other languages would be cool, to the extent it can be made to work.
That being said, there is at least one project to create a language and editor that use "structured data" like he describes, which I founded, see "http://www.box.net.au/~matty/ultra". I'm not going to claim it will be a universal language though!
Sheesh. :)
What differentiates maintainable code from spaghetti code is not just whether or not the syntax of the language allows for obfuscated code, or if all of the variables and functions are documented and clearly named, if some code conventions are followed or if it has been run through a beautifier, but whether the code was written with a clearly thought-out and documented design.
If the programmer has actually taken the time to think about the data structures, the algorithms, and the classes(or program sections if you aren't using an OO language), then the code becomes truly understandable. This is not to say that you can then ignore good programming techniques -- they are still necessary -- but that documenting every function, variable and data structure in a program that is otherwise a crufty mess is pretty much a waste of effort. Try it sometime -- look at the source code for Perl, and have the perlguts man page and Gisle Aas's wonderful illustrated guide to Perl's internals handy, and you'll get the idea.
I've seen code in lots of languages that would be considered 'maintainable' if all it took was strictly following a convention, but in fact was frustratingly difficult to maintain because the programmer didn't have a clear design for the system.
Say you're programming CGIs in Perl using modules. Whatever you do, don't install new modules in the system-wide site library, because that could cause all kinds of trouble! Better to put them all in
Always keep a sapphire in your mind
Interleave your code with as much trace code and printfs as possible. This way even the expert maintainer really can't figure out what statement does something useful.
"Don't be irreplacable. If you can't be replaced, you can't be promoted."
This works. Trust me.
-- Ever notice that fast-burning fuse looks exactly the same as slow-burning fuse? I didn't... (Edgar Montrose)
Why? Because that's what everyone's doing, at which point they bitch and moan about how their Fortran, Basic, and Cobol programmers can't understand the C++, Perl, and Java code you've written.
Funny thing.
They sometimes even have the unbridled audacity and incredible stupidity to demand that you convert your code to look like the languages that the "maintenance programmers" understand. I've never come up with a better answer than to suggest that people run very far, very fast from this all to prevalent mentality. The world is a strange place.
Actually, you can define variables at the start of any scope, for example:
if (foo)
{
int i = 0;
}
and in C++ you can define them in the for itself:
for (int i = 0; i < 100; ++i)
www.eFax.com are spammers
Vovida, OS VoIP
Beer recipe: free! #Source
Cold pints: $2 #Product
Vovida, OS VoIP
Beer recipe: free! #Source
Cold pints: $2 #Product
Most obviously obfuscated code is produced by relative newbies who don't know what all the features of a language are for (e.g. case conditionals implemented as loops etc.) It never looks professional to code this way.
And, after you've seen a few thousand modules done this way, you can pretty much burn through them; it's actually kind of fun, like doing a puzzle.
The evil done by obfuscated code is nothing compared to the evil done by obfuscated architectures. Any power you give somebody can be used for good or evil, and the power you have when designing in architectural dimensions (like class hierarchies or APIs) is both greater and more subtle. Example: DDE. Real world projects include not only bits of code, but class hierarchies, databases, file formats, external interfaces etc. You can write code as limpidly as Kernighan and Ritchie, but still end up with a system that is totally unmaintainable by anybody but you. Furthermore, it will be utterly unclear to anyone whether this was deliberate, or caused by technical constraints (i.e. things you must interface with), or is somehow tied up in the nature of the problem.
Write overly complicated code, and people will think you're an idiot. Design overly complicated systems and write beautiful code to solve the unnecessary problems you create, and they'll think you're a genius.
Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
Well I'm scared because I don't know if that is sarcasm or not. I guess I'm an idealist. I like to /design/ systems. Coding is just what you have to do to make your design concrete. A lot of people don't think this way. They think the code is the end, not the means. And hence you get nasty messy complex weak broken sorry ass systems and you need more people to support them than if you actually designed it correctly the first time. Sometimes I have to work on a project and I have to hold myself back from slapping everybody and starting from the ground up...I just have to grit my teeth and get my hands dirty so I can fix the a symptom of a much larger problem. Computing is truly going to hell if the above was /not/ satire...
It's 10 PM. Do you know if you're un-American?
My previous employer had a HUGE Dos system.
:-)
Started in BASIC, went through an interpereter to C and still had bits of assembler for certian bits. Wow, this code SUCKED.
I didn't have much to do with it, but I did have to emulate some things it was doing in a new Windows system (ewww).
The best part was when I found out that 'S' was a global void *. Depending on the part of the program it was used for a half a dozen different types. The structured programmer in me had spazmotic fits, but I couldn't have the programmer killed cause he was the owner of the company.
Oh, there was also a global 's' which was declared as an int but used as a void *.
Oh well, back to my stupid Access project. How can anyone work in a language without pointers?
-- I'm omnipotent, I just don't care.
-- IANAEG - I am not an elder god.
My first job experience was to help port some old Fortran code, from a mainframe to a workstation, and from Fortran-77 to Fortran-90. There were revisions and comments dating back to 1983 (this was in 96-97)... (Aside: There's an age/revision level past which code should NOT be maintained, it should be rewritten)
All in all it was a great learning experience. I've developed an aversion to spaghetti since then.
Imagine if you will, a 2000+ line subroutine containing many a multi-level if-else/for-do construct, from the depths of which conditional computed GOTO statements jumped into the middle of another multi-level for-do/if-else loop. Intercal was never more fun.
The true kick of the experience was that it was to be a code port. Not a rewrite. Not even a little. A straight port, so the original developers wouldn't have to figure out any new logic. Feh!
-- What you do today will cost you a day of your life.
>They asked him to do something that he was not
.]
>contractually obligated to do, that he was
>not being paid to do, and he did it anyways...
>and he's a thief?
No, he wasn't contractually obligated--at the time he was asked. Once he began the work, it modified the contract (more technically: the company offered a contract modification, and he accepted it by performance).
Once he undertook the duty, he was obligated to due so correctly.
The company did *not* try to get something for nothing. They requested a service at the rate he was already receiving. He took the money to do so. And stole the work that he was paid to perform.
[overrated? at a default? hmm . .
I think you've missed the whole point of Hungarian notation. Those examples you used were quite contrived (and if they did actually exist in code, it is the coder's errror, not the convention).
HN is a good way to indicate the kind of variable, and it does not preclude meaningfull name. What is maxTypeCode? A string? An int pointer? Pointer to a user defined type? I don't know without scrolling back up to the declaration. is numLinePayments a signed or unsigned int? On the other hand, pszMaxTypeCode tells me instantly that it's a string and iNumLinePayments is signed.
Likewise, your iNmPt example illustrates braindead programmers, not the shortcomings of HN. It should have been called iNumLinePayments.
I think too many unix coders are frightened off from HN simply because it came from Microsoft. Don't be. Try out HN, and if you don't like it properly used, then don't use it.
A Government Is a Body of People, Usually Notably Ungoverned
> What is maxTypeCode? A string? An int pointer? Pointer to a user defined type?
Unless you're writing a device driver, WHO CARES? If you stick to the functional interface used for creating, setting, and passing that value, the type of maxTypeCode is OPAQUE. It's called ABSTRACTION, something we learn when we stop having to know encode our routines for sizeof().
I've finally had it: until slashdot gets article moderation, I am not coming back.
Is that you get chained to your code. The volume of documentation on my code is bigger than my code, because I can hand it to someone, say "this is all you need to know", and leave that code behind. Forever. On to bigger and better projects.
I've finally had it: until slashdot gets article moderation, I am not coming back.
>Even if he did implicitly agree to a contract
:)
>modification
Actually, it's explicit: the modified contract is accepted by performing the action
>(he may have; IANL,
but I am
>and the law has stranger things in it...)
nothing strange here; this is no different as a legal principal than working eight hours instead of the six in your contract, and expecting an extra two hours pay.
>- did he also implicitly enter into an assumed
>modification that assigned intellectual property
>of his creation to the company?
It was work for hire. The employer is entitled to all of it.
>If not, and there was no such assignment in his
>original contract, then he owned the code, and >was free to do with it as he wished.
If for some reason there wasn't, he was stealing when he did it during time the company was paying him . . .
>Once he undertook the duty, he was obligated to
>due so correctly.
>Legally, or morally?
Legally.
>Morally, I'd agree with
>you... if he made the commitment, I think he
>should have followed through. Legally, though, I
>don't think there was a commitment, and
>he can't be held accountable for not doing work >he was never hired to do.
He was doing it on company time, for which he was paid. He then vandalized, it, and took the copy he wasn't entitled to.
In any case, your point is well taken, that Hungarian notation is not as obfuscated as my not-so-contrived example makes out. My only experience with it however was on this one project which did have such convoluted examples. Hopefully my example speaks to the broader issue of useful variable naming, not just Hungarian notation.
----------
In a real emergency, we would have all fled in terror, and you would not have been notified.
It makes all the difference in the world if you're a code *maintainer*, as this whole article is about. If you write code only for yourself, then you can use any coding standard you want. But then again, if you're only coding for yourself, why even release it :-)
A maintainer DOES NOT want to flip up to the top of the header files each and every time he runs across a variable to find out what it is. If a bug is signed versus unsigned related, "maxTypeCode" doesn't help at all. But an "uMaxTypeCode = -3" sticks out like a sore thumb.
A Government Is a Body of People, Usually Notably Ungoverned
Answers are: integer, pointer (to something), char, float, and who cares :-)
Without looking anything up, I think mps is a Microsoft/Windows/vc++ specific prefix. I do recall that "h" was for handle, and when you're using handles for *everything* in windows programming, it makes it much easier to distinguish between ints, files and handles.
But just like the guy who avoided all whitespace because he was following the rule to keep all functions one page in length, you can overdo HN. The basic idea is to use easy to remember mnemonics with prefix notation. Using "intEmployee" and "dblSalary" is equally useful.
A Government Is a Body of People, Usually Notably Ungoverned
Thanks for the discussion. I have to add that I was asked to produce something which would perform the tasks required. This involved coding, but the manager who actually set me the task did not know enought to know that it was an actual program that was required. They have a working system and that was what I was asked to produce. I don't believe I am a thief and all parties involved are happy with what they have got out of it. Perhaps: A victimless crime?
/.
Shall I go to a police station and confess?
Also note I was employed in the UK and you cannot apply US employment law to my case.
Some of the comments in this thread are actually quite surprising to me. There is the air that every employee should always bow their heads to their managers and never do things for themselves. There also seems to be the opinion that everyone should be selfless and not look out for number one.
I confess, I don't believe in this ethos. At the end of the day all I care about is myself and those that care about me, the rest are immaterial, but they needn't go to hell.
I did do other coding in this employment and did not alter the code, leaving explanatory comments and even writing a 40 page manual of how the system worked and both user and programmer references. In all the time I was employed there my salary rose by only 3% (OVER TWO YEARS). PC Support Analyst to Developer?
And it seems I still am judged by my peers as a thief, the devil incarnate perhaps?
Oh well, lets leave this one to the archives of
>Oh well, lets leave this one to the archives of
:) For the most part, that is still the law in the U.S., but were old law by the time we separated.
.
Good idea, it's beaten to death. But one little note: I'm not talking about US employment law, but the Common Law of England
hawk, esq.