Domain: mindprod.com
Stories and comments across the archive that link to mindprod.com.
Comments · 111
-
But if you're going to do it wrong...
Might as well have a guide to it: http://mindprod.com/unmain.html
-
While we are on the subjectThis has probably been posted on
/. before (in fact I probably origionally found it here), but I can't resist posting this site:http://mindprod.com/unmain.html/
My favorite:
(On naming) # Bedazzling Names : Choose variable names with irrelevant emotional connotation. e.g.:
marypoppins = ( superman + starship ) / god;
This confuses the reader because they have difficulty disassociating the emotional connotations of the words from the logic they're trying to think about. -
That was really interesting
-
Re:Flame
Now hear the spoiled-child rhetoric! Perhaps it is the yankees who are overrated? Perhaps it is the yankees' lifestyle that's over-inflated? Why do the jobs go out of the US with a great sucking sound??? In the turd-world (so said because life there is nothing but shit, thanks to the yankees sucking-out all the wealth of the world), workers do not have four cars in the driveway and a swimming pool in their backyards.While India's satellite launches and outsourcing news are already covered in slashdot umpteen times, sometimes her sensible achievements should be covered too."
Her sensible acheivements should be covered too? Can we mark the article blurb as flamebait? Lets keep the bias out of the story. Please.In most of the civilized world (this is spelled E.U.R.O.P.E.), there is public transit to take the people to their jobs without FORCING them to use an expensive, gas-guzzling heap of junk on wheels which is, thanks to the inherent paranoïa that is so typical of the shitheap-puritan yankee mindset, has to be inflated beyond any semblance of reasonableness for it's owner to retain some kind of status amongst it's hare-brained sheepish co-herders.
After a while of destroying the countryside with strip-malls, the business owners are getting tired of subsidizing the heavy car usage that is so typical of the earth-trashing yankees' lifestyle and are starting to rebel. By moving the work where the workforce do not need to have a subsidized conveyance.
The great sucking sound is nothing but the sound itself of the yankees' suckitude, it's stupid dependence on foreign oil that has done so much in the last few years to alienate most of the earth's population, all thanks to the most miserable failure of all time in yankee politics.
So, mister Anonymous Coward, your sheepish flame, shot from behind your huge cowardice (see how I am NOT afraid of you unwashed barbarians by signing my name), you can roll it, and shove it up your anus so it can give you your long-overdue orgasm thar your sheepish moronic puritanism has prevented you from enjoying all that time.
Morons. (Anybody who moderates this negatively is nothing but one of those stupid spoiled Bush-voting yankees). -
Re:Ummm, there're reasons
There has to be an equilibrium point where the simplicity/ease of design (also an arguable point I'll grant) but less performance balances out the less simple, monolithic design with excellent performance.
You clearly have much to learn, grasshopper. Code should never be easy to design or maintain. It should be terse, ugly and preferably self-modifying. You may seek spiritual enlightenment here.If you insist on using some of these new-fangled languages, at least learn how to use them properly.
-
Re:Obfuscation
How to obfuscate in copious detail.
How to write unmaintainable code
-
Re:Lets talk about Jon Carmack.
As a budding (I'm not a world leader by any standards) software engineer, I feel obliged to respond.
There's an enormous difference between a "good" programmer and a "bad" programmer, especially in the gaming and graphics industries.
A "bad" programmer does this: He programs just what he has to do. He doesn't critically analyze his programs. He has no sence of programming style, and follows the General bad programming rules.
A "good" programmer strives to innovate. Not only does he have good style, optimises his work, comments his work (basically the opposite of the advice given in the link above), but he also thinks about new ways to do something. The main differences between the "good" mechanic or the "good" plumber, and a "good" programmer, is that a mechanic and plumber is taught to do everything exactly the same every time, and the more exact you have it, the better the job that's considered to be done. While there are differences between a mechanic fifty years ago and a mechanic now (mostly because of the computerization of cars now-a-days), it's still a very similar job. A good programmer constantly tries to think of new ways to do things.
John Carmack writing Laberynth figured out a new way of making games look 3D. He pioneered a new genre with a one (notably unsuccessful game). This took enormous innovative skills. In every one of his games he's done something new and creative - even in Doom 3 he made several new routines: the Z-Fail algorithm, the Carmack Mirror (I might be wrong with the name there - I'm doing this adlib), as well as a couple of geometry-reduction algorithms etc. That's what makes him a good programmer. -
Absolute bullcrap
This is unavoidable because there's no good (fast) way to do platform-independent graphics.
Fox toolkit, FLTK and the list goes on. Add WxWindows and friends if you are allowed to use the native widgets too, which those others don't. ;-)
Java is still slow.
OTOH, it is also such a badly designed language it got tons of sections praising it at Unmain. -
Job Security?
"Never ascribe to malice, that which can be explained by incompetence." Roedy Green
-
Why .NET and not Java?This may seem like flamebait, but they throw the first stone right there on From the Mono website:
If these are the best justification for ...However, the Java runtime systems commonly available on Linux lack the performance that customers demand, and Java applications do not conform to the Linux GUI look and feel. .NET over Java, then they are pretty weak.As has been pointed out ad tedium in various Java-related discussions on
/. - Java's early reputation for poor performance may have been justified in the 1.0 and 1.1 days, but modern Java VMs employ sophisticated JIT compilers which gives it comparable performance to natively compiled languages like C++, and easily matches .NET's CLR performance. Java's bytecode and .NET's bytecode are not that different, the main differences are in the APIs.Which brings us on to the second justification for
.NET over Java, native GUIs, which is even weaker. Java-Gnome does the same thing as Mono's GTK bindings, offering exactly the same GUI abilities, and SWT offers a truely cross-platform GUI API with a native look and feel on each platform it runs on. -
Source code in database
Sounds like "source code in database" a.k.a. SCID. I have a feeling smart IDEs like Eclipse are doing part of that already.
-
Re:Asking for psychiatric advice on Slashdot?
Well, I was thinking exactly the same; that's something new here
;-)
OTOH, I'm starting to believe I may also require one shortly, trying to maintain the code I received lately, if you know what I mean. If not, see this.
This way my post is at least slightly relevant... -
Re:Easy fix.
Aconymous Noward/David Syes... Well, can't they fingerprint the packets? I mean, isn't there a way the number of unique machines can be determined?
No... I suggest you Do some research on TCP/IP.Suppose you have 15 computers chewing the limit of bandwidth, not crushingly, but maybe 80%. Then, one person is shopping mstewart, another pron, and another Home Depot, another on globaldefense.org, and so on. How likely is it that just one person can type in all the URLs (talkn' 'bout by hand), respond to the information/requests, and keep surfing?
That's what they call in court "circumstantial evidence. Theres no way to prove that isn't all coming from one machine. I could have a program on my computer that sets out spidering websites looking for pages on certain subjects or just archiving them for offline use. There are probably a hundred different reasons that could explain that traffic.Can't the MAC addresses be queried at some level? thought that some bad NICs could be tricked. If it is not possible at all, the apologies. But, I am wary. Ever since the CIA and Telcos have been in bed, it's likely that even cell phones TURNED OFF can be tracked. Just embed a cell-polling chip or interrogator chip in the battery pack. Of course, I've not rigged and radio direction finding gear near my cell to test this, but I think eventually it will be in all phones "as an augmentation to 9/11 rescue assistance for the disabled motorist or stranded pedestrian...". Yep...
I think you should do some research into TCP/IP if you are seriously that wary. MAC addresses are only visible to other machines on your local switch or hub. They don't route.*snip 4 paragraphs of tin foil goodness* David Syes Citizen of Earth, resident of whatever nation.
I suggest you wrap your entire body in tin foil and dig yourself a hole to hide in ;) -
Re:Me either ...
I don't know if you are talking about invoking scripts from Java, in which case you a lot of alternatives, from beanshell to jython (the python implentation in Java) and most of them could be run through BSF to have an uniform API.
DinamicJava on the other hand is an interpreter of a superset of Java.
I don't know what you find annoying: compiling and executing. That's the norm for most programs. Java programs are Just In Time Compiled but that is done transparently by the virtual machine and is faster than interpreted. -
Re:works out?There are so many... barriers to trade,
hooray! more "barriers to trade" please!
when the ftaa was being signed there was a lot of talk about subsidies to industries and regulations on producers as being "barriers to trade". i can only presume they were talking about things like:
- public healthcare. a public system means corporations don't have to provide health insurance for employees. that's a "subsidy" to the industries in the country with public health.
- safety regulations. if my country has higher worker safety standards than another country my domestic industry can claim that local safety standards are a barrier to export and take the government to the wto.
- environmental standards. there are a lot of exceptions on this in the wto and ftaa agreements, but the bottom line is that any new environmental legislation can be construed as trade barrier. just look at the kerfuffle over mmt. is mmt bad? probably not. but sovereign nations should have the power to decide to ban it if they want, without having to get the approval of exporting nations' corporations.
so, more barriers to trade please!
-
YES YES YES!!!
I TOTALLY AGREE--100%!!! If you use Hungarian notation correctly (if you visit this link do a page search for "hung" to find the appropriate section), not only do you get the many benefits of it, you can never be fired.
(Don't just stick to that one page, go to the main page for more information on writing code "properly".)
sev
-
YES YES YES!!!
I TOTALLY AGREE--100%!!! If you use Hungarian notation correctly (if you visit this link do a page search for "hung" to find the appropriate section), not only do you get the many benefits of it, you can never be fired.
(Don't just stick to that one page, go to the main page for more information on writing code "properly".)
sev
-
Re:Why not Gandalf?
There was a modem company called Gandalf in Canada. I think they're safely defunct--unless someone aquired their trademark rights. (It would take extreme gall to try to enforce a zombie trademark name lifted from Tolkien, but the name Caldera/SCO springs to mind for some reason.)
-
Re:Nope
Sun flirted with the idea of turning the specs over to a standards body some years ago, but it soon became clear that Microsoft would try to influence any such organization and bastardize the language.
One can create standards organizations with whatever voting and membership rules one wishes. "One company, one vote" is a simple one that will minimize Microsoft's influence but also minimize Sun's. Sun actually has more allies (e.g. IBM) and would have more influence in such a body.
Finally, I'd like to know the grounds for ESR's claim that Sun's alleged control of Java is "throttling acceptance of the language in the open-source community, ceding the field (and probably the future) to scripting-language competitors like Python and Perl." Java has one of the largest development communities in the world with lively activity among open-source developers -- think of Jakarta.
Java has excellent support in the server space. But for general purpose programming, C wins and Perl (e.g. SpamAssasin, MovableType) and Python (e.g. Gentoo, Mailman, BitTorrent, PLone) come in second and third. As we move into computers with scores or hundreds of Gigahertz, the shift will be away from C but not toward Java.
Actually, I don't think that Java's unpopularity for these things is directly caused by its closed-ness. Rather it is because the very idea at the core of Java, that it is in some way wrong or deprecated to write platform specific code leads to weirdnesses like getenv being deprecated or JNI being way more complicated than it needs to be, or there being no standard build mechanism for JNI packages (like MakeMaker or distutils for Perl/Python).
Python and Perl are easier to transition to from C because their communities think that it is sometimes appropriate to write code specific to the platform. I need to do my job. Sometimes my job involves calling the win32 API. Show me something mature and easy to use that helps me get my job done and shove the ideology (open source or anti-Microsoft) up your ass.
If industry loves Java and open source programmers stick with C or shift to Python I do really think that is a long-term problem for Java. The Unix/Open source universe has a power disproportionate with its size and it size is growing. If Python inherits C's mantle as the defacto language for programming on Linux, Java could be in trouble. Also, consider these trends:
Usenet postings for comp.lang.java.programmer:
2000: up 348%
2001: up 2% (but with 18% fewer individuals participating)
2002: down 8% (and with 22% fewer individuals)
2003: down 35% (and with 24% fewer individuals)Usenet postings for comp.lang.java.c:
2000: up 406%
2001: up 7% (but 1% fewer individuals)
2002: down 10% (16% fewer individuals)
2003: down 17% (26% fewer individuals)Now look at comp.lang.python:
2000: up 779%
2001: up 41%
2002: up 8%
2003: UP 13%Of course Java and C still win in absolute post numbers.
Does this prove anything? No. But it doess suggest that Java's growth has peaked. It seems unlikely to me that Python's growth is even near its peak because it is still growing by word of mouth, it will grow up with Linux, Perl and Java programmers are still migrating in droves (Perl's 2003 Usenet figures are down 37%).
And in a lot of ways Python is very, very immature. This implies to me that when it matures it really will be a major threat to Java. It is easier to grow more performant implementations (like Psyco and Pyrex) than to fix a fatal flaw in the languages' central idea.
-
Re:Of course it isn't the end of the world!
For those who have no idea what he's talking about, see here:
http://mindprod.com/kyoto.html
It sounds like one of the most contrived schemes I have heard of yet. The cost figures parent gave don't surprise me one bit. On the bright side, maybe we'll start building some modern Nuclear Plants instead of working to simply shut down all the 1960's plants.
-
Re:Next try?
Ok, so now that Java is on the retreat they try to enter a new area?
It's probably because there's no Java user community or usefull implementations out there. And it has virtually no practical application on the desktop for that matter. Maybe because it doesn't do 3D or sound. Or is not so usefull as far as scalable RDBMS abstraction or a real application server for the enterprise. Maybe they need to move into the mobile market. What's really needed is a good Java IDE to get developers on board. Changes should be driven by the software community and making the source open would help as well. Sun should also be making improvments in Java's next(?) version.
You're right, I guess "we" should just cut our losses. -
Re:Just wait...
I think someone beat you to it.
-
m_lpstrnzCharlesSimonyi
Little known fact: This is the same Simonyi who invented hungarian notation.
Google for "the tactical nuclear weapon of code obfuscation" to receive further enlightenment
Dave -
Re:How to swear in Esperanto
Here is the article: http://mindprod.com/dirty.html
It's actually a very good introduction to the language and some of its capabilities.
Atentu al la elefantaj fekeregoj! Ili ankoraux vaporas sub la argxenta luno. -
Better site
Here is a much better article about coding practices. It also covers broad topics, not just C in specific.
-
Re:Java tutorial anyone?
And here's the link. Also Roedy Green maintains a pretty extensive Java Glossary.
-
SCID / decorator pattern
Very interesting read. Two comments:
1) SCID seems to be a similar thing.
2) From the interview: For instance, if you've got a static method that takes an object as a parameter, and it modifies that object, then somebody probably just slapped that method in there because it was easy.
I don't think that's really true. Classes with static methods seem to be very convenient to me. Much like the decorator pattern, where code (here in the static method) only deals with modifying data objects given to it. That code doesn't need any kind of memory to store some kind of state, so it can be (should be) static.
Obviously, it can happen that a developer puts a method to some particular place where it doesn't fit because he's lazy.
Anyway, it'd be great to have something like Jackpot as a basis to write your own analysis tools. -
Re:On identical comments ...This is pretty much true with all comments in code, not just those for the Linux kernel.
i++;
is less helpful then /* increment i */i++;
which tells why we are incrementing i. (crappy contrived example) /* increment our widget control counter */
With that in mind, read this. Heheh. -
ASCII magic
The "translation" is done using the ASCII charset which is used as a standard in computers, and the corresponding numbers are in hexadecimal form.
The whole message is F0AD:42494C4C. From this, we get "Fuck Off And Die: Bill". How, you ask?
F0AD == Fuck Off And Die [hacker slang]
42494C4C: break them into pairs, as we do with hex numbers. We get 42 49 4C 4C.
Now match the hex numbers with their corresponding values from the ASCII Table.
42 == B
49 == I
4C == L
4C == L -
Re:Not just a PHP problem
I'd be surprised if this hasn't been on here at least once...
How To Write Unmaintainable Code -
Re:Do not document your code
How to write unmaintainable code is written tongue in cheek, as what NOT to do with your code. Though targetted for Java, many of these "rules" can be applied everywhere.
Remember, if you can't be replaced, you also can't be promoted. -
Re:From recent experience
How To Write Unmaintainable Code never gets old.
10) Åccented Letters: Use accented characters on variable names. E.g.
typedef struct { int i; } ínt;
where the second ínt's í is actually i-acute. With only a simple text editor, it's nearly impossible to distinguish the slant of the accent mark.
and:
15) Names From Other Languages: Use foreign language dictionaries as a source for variable names. For example, use the German punkt for point. Maintenance coders, without your firm grasp of German, will enjoy the multicultural experience of deciphering the meaning. -
Inexact floating point calculations...A general question. With some programming languages... floating point is by its nature inexact. It is probably best if you imagined that after every floating point operation, a little demon came in and added or subtracted a tiny number to fuzz the low order bits of your result. (I quoted that from here).
Do any of the listed tools/languages take care of this problem for me? I understand the nature of the problem, but it is still very frustrating. What do the "pure" math programming languages do with this issue?
--sex
-
MaintenanceThe proverbial `right person', though, isn't someone who just gets something working the quickest. He or she is also the person who writes code that has fewest bugs, copes best with unforeseen circumstances, and is easiest to enhance, fix, adapt, &c. By other people.
Of course, you can write unmaintainable code in any language; but some scripting languages can make this much easier, which is why they're sometimes a poor choice. Since (IIRC) on average, something like three times as long is spent maintaining code as writing it, bashing something out quickly is often a false economy.
And of course Real Programmers care about the quality of their code. Don't we?!
-
You mean this?
http://mindprod.com/images/mskeyboard.jpg
(from http://mindprod.com/jglossdsk.html) -
How To Write Unmaintainable Code
There is a whole essay on the topic. Funny as hell a read, and good in-your-face material for co-workers, too.
How To Write Unmaintainable Code -
How to *really* become a programmer...
...Is to use this site as your programming bible
:-PIt is a *must* read for any budding or experienced programmer! (You might split your sides from laughing too much).
-
How To Write Unmaintainable Code
just read this handy guide to writing unmaintainable code and do exactly what it suggests
-
Re:Java?
1) It's big and slow. Very big. Very slow. Java apps/applets aren't usable on my P2 266
Please hold while I bang my head on my desk.
First, let me point out a few things (in numbered list format since you're into that kind of thing):
1) Applets are not Java. Indeed, Applets are written in Java, but they are just one method (arguably the silliest method) of executing Java code. You've got to think that if you wrote a bloated GUI C program (and most Java Applets are bloated GUI code), downloaded it over the internet each time you wrote it and then had to wait for a (usually out of date) runtime environment to run the code, its going to be slow.
So we agree that Applets are a bad idea. Fine, most impartial Java developers will concede that fact. But like I said, Applets are just an execution model, and one that most Java developer don't ever think about using.
2) Have you tried a well designed Java based application running in a modern Java Runtime Environment (something like Eclipse on one of IBMs JREs would be a good test). Have you done any profiling on server side Java code (i.e. a Servlet based web application?).
Guess what, it's not so slow! Sure, it's typically not as fast as native C code, but C code isn't typically as fast as optimized Assembly either, and I don't see everyone programming in that anymore. In a web application (Java's real strength) where the the run time environment is already loaded into memory and so is the Java code, request are actually downright snappy!
3) There are good Java applications, there a bad Java applications. There are good C programs, there are bad C programs. Most people seem to see one bad example of a Java app and get the "Java sucks" tunnel vision. I wish I had the kind of job where I could afford to be so ignorant. Then I'd only need to browse SourceForge for an hour before deciding that every single language sucks at everything.
2) It has the worst marketing and learning curve in the history of computer programing. All those acronyms above are real. Sun's J2EE "platform" -- platform? what the fuck is a platform? -- is used as a generic term by PHBs everywhere. To anyone that hasn't taken courses on Java, it's meaningless.
You want a little cheese with your whine?
That's like me saying "Whah whah! I don't know what C++ STL is!" without bothering to pick up a book or doing a Google search. Do some reading you lazy bastard! Not everything in life is going to be spoonfead to you! If acronyms are too hard for you, bookmark one of the many Java glossaries that are out there.
The "Java Platform" is simply a set of classes (APIs, Frameworks, whatever you want to call them) and an environment to run programs which use these classes. These provided classes do things as simple as type conversion and data structures, and as complex as network I/O and cryptography, and as useful as parsing HTTP requests and working with relational databases. Lots of good stuff in there.
So Java programming involves writing code which uses these built in classes, using the classes you wrote yourself, classes other people wrote, etc. (just like any other language).
So for example you could write code that responds to an HTTP request (such classes are known as Servlets) and stores some information in a database. You then just set up this Servlet to run in a J2EE Server (like Apache Tomcat) and point your browser to the appropriate URL and voila, it responds to the HTTP request and it can just as easily return and HTTP/HTML response back to the browser (did you notice there aren't any Applets involved here?).
"What's the point, I can do that in C?" you say? Well, aside from the general utility of all the built in classes (they really are quite rich) the advantage is that you can write your Java code on whatever machine you like (say that NT box you're forced to use at work, or your Linux box at home) and when you're done you can deploy it to whatever machine type you want (say that big Solaris server your company has laying around, or your buddies Windows 98 machine, whatever) and it works. No porting, no messing around.
That may not sound like a big deal to the average home user, but to a company with a sea of developers who are already on Windows machines and they want ot target a UNIX production environment, it's a big advantage. Is it possible to do this in C/C++? Of course it is? It's not neary as easy though, and if you give developers the chance to screw something up, you know what happens next.
Long story short, Java is a tool, and tools are always good at some things and bad at others. I wouldn't want my Kernel written in Java just like I wouldn't want a web application I have to maintain written in Assembly. Learn about the tools objectively and apply them where it makes sense.
-
It depends on which encoding you use!
Look at the table on the bottom of this page for more insight. Basically, the beginning of Unicode text (for example, in a file or webform) has a string of unambigous prefix bytes that tell you which byte order and encoding to use. There's UTF-8 (like ASCII, one byte wide), USC-2 (UTF-16) big AND little endian (those are the 16-bit ones you are talking about), and USC-4 (UTF-32) big and little endian. The USC-4 are 4 bytes per char and are often used in Asian locales for ideographic text.
In windows NT 5.x, I suspect you can assume USC-2 LE all around. -
Re:Not ironicHungarian notation is the tactical nuclear weapon of source code obfuscation. Use it!
(scroll down to #29 in the list, it's worth it)
-
Programmers
First off, I am a long-time C++ programmer (and C before that) with a recent conversion to Perl for anything involving munging text files.
It has been brought to my attention that no sane programmer would design a record keeping system that involved giving the a customer a text editor and a manual and making him enter his records in a particular format in files with a particular name and extension. Yet that's exactly what we do to ourselves with programming languages.
What we need is something that goes from UML all the way down to ASM, and more importantly, all the way back up. Editable at every level in between. Use colour, fonts, sounds and whatever else you want to indicate the age of a piece of logic (at whatever level), who last changed it and /why/. If you're mucking around at the low level and it's making your high level design look a mess, take it as a clue that your design is not clear. Sure, there are exceptions that have to be coded for. Get them in the model at the right level and save yourself some work. I know programmers who have worn out the Cs and Vs on their keyboards, they cut and paste so much (yes, Windows, sue me).
I don't imagine this is going to be easy. However, the implementation is almost certain to be easier than getting people like me to start using it. Perhaps you youngsters should just write off everyone over 22 and start again. You'll thank us when we're gone. -
Curing unmaintainable code
Roedy Green has written an excellent, humorous online article on writing unmaintainable code. This relates directly to Literate Programming, especially Roedy's points about maintaining existing code. He writes (here): "[the maintainence programmer] views your code through a toilet paper tube. He can only see a tiny piece of your program at a time. You want to make sure he can never get at the big picture from doing that. You want to make it as hard as possible for him to find the code he is looking for. But even more important, you want to make it as awkward as possible for him to safely ignore anything. "
Literate programming in general, and Leo in particular, would be the ultimate cure for this. It allows you to easily navigate between multiple levels of description of a program. This is critically important if you are coming fresh to an existing piece of code. You need to constantly cross-reference the high-level design and low-level implementations (and the various levels of description between these extremes). -
Curing unmaintainable code
Roedy Green has written an excellent, humorous online article on writing unmaintainable code. This relates directly to Literate Programming, especially Roedy's points about maintaining existing code. He writes (here): "[the maintainence programmer] views your code through a toilet paper tube. He can only see a tiny piece of your program at a time. You want to make sure he can never get at the big picture from doing that. You want to make it as hard as possible for him to find the code he is looking for. But even more important, you want to make it as awkward as possible for him to safely ignore anything. "
Literate programming in general, and Leo in particular, would be the ultimate cure for this. It allows you to easily navigate between multiple levels of description of a program. This is critically important if you are coming fresh to an existing piece of code. You need to constantly cross-reference the high-level design and low-level implementations (and the various levels of description between these extremes). -
I have assured my future in IT
Two words: code obfuscation
-
fugly
Write godawful, fugly code. If you make it hideous and incomprehensible, then NOBODY will ever submit a patch and your problem will be solved. Here is a good starting point.
-
Reminds me of a "How to write unmaint.. code"
Cut-and-pasted from How To Write Unmaintainable Code (the "Naming" section):
Obscure film references: Use constant names like LancelotsFavouriteColour instead of blue and assign it hex value of $0204FB. The color looks identical to pure blue on the screen, and a maintenance programmer would have to work out 0204FB (or use some graphic tool) to know what it looks like. Only someone intimately familiar with Monty Python and the Holy Grail would know that Lancelot's favorite color was blue. If a maintenance programmer can't quote entire Monty Python movies from memory, he or she has no business being a programmer.
-
How To Write Unmaintainable CodeHow To Write Unmaintainable Code
Intentionally hilarious, but as it says, "checking for unmaintainable design patterns is a rapid way to defend against malicious or inadvertent sloppiness."
-
Get a Style Guide
The "How to write Unmaintainable Code" article on the web is an excellent resource for documentation - much as "Web Pages that Suck is an excellent guide for web designers.
Your organisation - even if it's just 1 man and a dog - should already have a style guide in place. Don't have one? Well then it's easy, there are plenty of good ones on the Net, for Java, C++,Lisp,MATLAB, Ada and many others.
A good list of C and C++ styleguides is here. Just pick one. The important thing is to make sure everyone uses the same one, exactly which one is more a religious issue than anything else. That's an over-simplification, some really are better than others, but at least all the ones on that list have been tried, tested and peer-reviewed.
As for my own opinions, a few issues
- Make variable names meaningful. If you do this, then most of your comments will be metadata, e.g why you did something, and who and when a change was made, rather than what is being done. If you're doing something tricky or unusual, then having a pseudocode preamble can be worthwhile.
- If you can, try to use a relatively high-level language like Ada rather than a low-level one like C. But this is almost never under your control. The Javadoc auto-documentation tool is one of the biggest plusses that Java has over other languages - so if programming in Java, Use It!!
-
Evil Coder's Bible
I have found some of the tips in the Code Obfuscation Guide to be reasonably helpful if not entertaining. After all, no one else is going to ever have to look at your source code, right? (Browny points for anyone who can highlight each of the tips in this particular guide used by Microsoft.)