# How to be a better programmer



## bydand (Dec 2, 2006)

*Want to be a good programmer ? If so, follow these programming practices and guidelines:*

1) Never write a line of code that someone else can understand.

 2) Make the simplest line of code appear complex. Use long counter intuitive names. 
Don't ever code "a=b", rather do something like this : 
 AlphaNodeSemaphore=*(int)(&(unsigned long)(BetaFrameNodeFarm)); 

3) Type fast, think slow.

 4) Never use direct references to anything ever. 
Bury everything in macros. 
Bury the macros in include files. 
Reference those include files indirectly from other include files. 
Use macros to reference those include files.

 5) Never include a comment that will help someone else understand your code. 
If they understand it, they don't need you.

 6) Never generate new sources. Always ifdef the old ones. Every binary in the world should be generated from the same sources.

 7) Never archive all the sources necessary to build a binary. Always hide on our own disk. If they can build your binary, they don't need you.

 8) Never code a function to return a value. All functions must return a pointer to a structure which contains a pointer to a value.

 9) Never discuss things in concrete terms. Always speak in abstract. If they can understand you, they don't need you.

 10) Never complete a project on time. If you do, they will think it was easy and anyone can do it and they don't need you.

 11) When someone stops by your office to ask a question, talk forever, but don't answer the question. If they get their questions answered, they don't need you.

 12) Load all sentences either written or spoken with alphabet soup. When someone asks you out to lunch, reply: 
"I can't because I've almost got my RISC-based OSI/TCP/IP client connected by BIBUS VMS VAX using SMTP over TCP sending SNMP inquiry results to be encapsulated in UDP packets for transmission to a SUN 4/280 NFS 4.3 BSD with release 3.6 of RPC/XDR supporting our ONC effort working."

 13) Never clean your office. Absolutely never throw away an old listing. 

 14) Never say hello to someone in the hallway. Absolutely never address someone by name. If you must address someone by name, mumble or use the wrong name. 
Always maintain the mystique of being spaced out from concentrating on complex logic.

 15) Never wear a shirt that matches your pants. Wear a wrinkled shirt whenever possible. 
Your shirt must never be tucked in completely. Button the top button without wearing a tie. This will maximize your mystique.​


----------



## FearlessFreep (Dec 2, 2006)

_
4) Never use direct references to anything ever. 
Bury everything in macros. 
Bury the macros in include files. 
Reference those include files indirectly from other include files. 
Use macros to reference those include files.
_

I've spent way too much of my life reading code written like that...


----------



## mantis (Dec 2, 2006)

ur describing the programmer 5 people worked so hard for 6 months to fix his code! it's still not fixed


----------



## exile (Dec 2, 2006)

bydand said:


> *Want to be a good programmer ? If so, follow these programming practices and guidelines:*
> 
> 1) Never write a line of code that someone else can understand.
> 
> ...



In other words, program in C++!


----------



## mrhnau (Dec 2, 2006)

exile said:


> In other words, program in C++!



Nah... try some things w/ SED. Or get really cryptic w/ Assembly. I really enjoyed learning that 

 1) Never write a line of code that someone else can understand.


----------



## exile (Dec 2, 2006)

mrhnau said:


> Or get really cryptic w/ Assembly. I really enjoyed learning that
> 
> 1) Never write a line of code that someone else can understand.



C++ can get mightily opaque... but yeah, Assembly, that's just not an Earthling language! When did you have to program in Assembly... and who was the sadist who made you do that??


----------



## FearlessFreep (Dec 2, 2006)

I went from Atari BASIC to 6502 Assembler.   Now I do mostly Smalltalk with some Java and some hobbying around with C, Python, and whatever else I need to.

Most annoying and incomprehenisble to read languages: Perl and TCL


----------



## mrhnau (Dec 2, 2006)

exile said:


> C++ can get mightily opaque... but yeah, Assembly, that's just not an Earthling language! When did you have to program in Assembly... and who was the sadist who made you do that??



LOL

I took it for a computer science minor in college. I actually enjoyed it! I got to be friends with the teacher. He let me design a project for the class. We wrote a few cool viruses  nothing harmful, but it was sure fun!


----------



## terryl965 (Dec 2, 2006)

How about letting your three old do the progamming since he is smarter than me ith it anyway


----------



## mrhnau (Dec 2, 2006)

FearlessFreep said:


> I went from Atari BASIC to 6502 Assembler.   Now I do mostly Smalltalk with some Java and some hobbying around with C, Python, and whatever else I need to.
> 
> Most annoying and incomprehenisble to read languages: Perl and TCL



Over the past few years almost all I do is Perl and shell scripting. I need to pick up Java one of these days...


----------



## bydand (Dec 3, 2006)

Figured some of you could relate to this.  I found it while stumbling about the net and had to post it.  Personally I know almost nothing about programming.


----------



## exile (Dec 3, 2006)

mrhnau said:


> LOL
> 
> I took it for a computer science minor in college. I actually enjoyed it! I got to be friends with the teacher. He let me design a project for the class. We wrote a few cool viruses  nothing harmful, but it was sure fun!



The thing with Assembly-level languages is, if you try explaining what they are to the current 16 year old database builders programming stuff in Perl (or the AI types writing stuff up in Prolog) they probably will have no clue---none, zip---what you're talking about. Every Lisp or Prolog command corresponds to an assembly level macro the size of a small book...  assembly makes  these high-level languages look practically wysiwyg... you say this was _fun??_


----------



## mrhnau (Dec 4, 2006)

exile said:


> The thing with Assembly-level languages is, if you try explaining what they are to the current 16 year old database builders programming stuff in Perl (or the AI types writing stuff up in Prolog) they probably will have no clue---none, zip---what you're talking about. Every Lisp or Prolog command corresponds to an assembly level macro the size of a small book...  assembly makes  these high-level languages look practically wysiwyg... you say this was _fun??_



Its control man! You don't have some unknown performing functions for you. YOU are the one flipping bits, pushing things into registers, all that jazz...

the problem is it takes about 5 years to program your computer to print "hello world". Also, if you don't know what you are doing, you can mess things up pretty easy...

I also enjoy trying to figure out the logic of things. exactly -how- do you print "hello world".... with higher level languages its kind of trivial.


----------



## HKphooey (Dec 4, 2006)

Program in mixed code.  That way it is tougher to be replaced.


----------



## CoryKS (Dec 4, 2006)

Follow them?  Man, I've _lived_ them.


----------



## Bigshadow (Dec 4, 2006)

exile said:


> The thing with Assembly-level languages is, if you try explaining what they are to the current 16 year old database builders programming stuff in Perl (or the AI types writing stuff up in Prolog) they probably will have no clue---none, zip---what you're talking about. Every Lisp or Prolog command corresponds to an assembly level macro the size of a small book...  assembly makes  these high-level languages look practically wysiwyg... you say this was _fun??_




No pops, stacks, or registers for me!    I looked at it once and decided it was way to tedious and took too long to get things done.

I prefer Visual Studios .NET either VB.NET, ASP.NET, or C#.  C++ takes too long now to roll out an app.


----------



## Bigshadow (Dec 4, 2006)

HKphooey said:


> Program in mixed code.  That way it is tougher to be replaced.



Yeah really!  Build middle teir objects in C++ and have all your VB and ASP use it.  They love that.


----------



## CoryKS (Dec 4, 2006)

Bigshadow said:


> Yeah really! Build middle teir objects in C++ and have all your VB and ASP use it. They love that.


 
Don't forget to write that one crucial procedure, upon which all others depend, in ASM to be called by the C++ code.  For "speed considerations".  Yeah, that's it.


----------



## Rich Parsons (Dec 4, 2006)

I once had to get 8 bytes to add in a "BEEP" sound feedback for a button for the Chrysler DRBIII tech tool. When I took over the code there was no room in the stand alone portion, and this request came in, and so I tried to find a way inbetween the C++ using OOD and classes, and the assembly generated. 

I realized a couple of instructions with the classes were repeated at the end of a session but were proper coding techniques. So, I commented out the first two and got my 8 bytes and verified that the third line I modified worked just like the old implementation worked. I then wrote three full pages single space of comments to explain why I did it and how I did it, and why it works even though it looks like it should not. 

I left the company for a permanent position at my current employer, and a couple of months after I left I got a call from the original guy who wrote the code, and he was first mad that I had messed up his OOD and hacked his code. He was also mad because before he left he told them that it was impossible to execute. He then told me he was impressed that I was able to find a way.


----------



## exile (Dec 4, 2006)

Rich Parsons said:


> he was first mad that I had messed up his OOD and hacked his code. He was also mad because before he left he told them that it was impossible to execute. He then told me he was impressed that I was able to find a way.



I hope you reminded him that in the progamming world, there are no problems, only solutions!


----------



## FearlessFreep (Dec 4, 2006)

HKphooey said:


> Program in mixed code.  That way it is tougher to be replaced.



Store code as strings in a database and load and execute at runtime.  Lot's of fun to debug


----------



## FearlessFreep (Dec 4, 2006)

Bigshadow said:


> No pops, stacks, or registers for me!    I looked at it once and decided it was way to tedious and took too long to get things done.
> 
> I prefer Visual Studios .NET either VB.NET, ASP.NET, or C#.  C++ takes too long now to roll out an app.



Bah...VisualStudio is up to mid-90s level Smalltalk productivity and usefullness.  Nothing I've found yet will touch VisualWorks Smalltalk for productivity for seroiusly big projects


----------



## mantis (Dec 5, 2006)

for those who are looking into .NET STAY OUT OF MY MARKET!
yes, keep working with smalltalk, java, cpp, and assembly... it's the best!


----------



## Ping898 (Dec 5, 2006)

I've always loved the joke about the program that wrote a very important piece of code and it worked perfectly for years and then one day he was fired and about a week later the code stopped working...a later code analysis revealed that into his code he had programmed a check to payroll, that only if he was on the payroll should the code work :-D....


----------



## Bigshadow (Dec 5, 2006)

FearlessFreep said:


> Bah...VisualStudio is up to mid-90s level Smalltalk productivity and usefullness.  Nothing I've found yet will touch VisualWorks Smalltalk for productivity for seroiusly big projects



eh!  My market is bigger.   I was reading the wiki on Smalltalk.  It sounds similar to Python.  It sounds interesting though, but I am tired of learning new programming languages.   I am ready to retire!   I am almost ready for a change in careers.  A jeep mechanic career is sounding really good right now, if only it would pay the bills.


----------



## Bigshadow (Dec 5, 2006)

mantis said:


> for those who are looking into .NET STAY OUT OF MY MARKET!
> yes, keep working with smalltalk, java, cpp, and assembly... it's the best!



You can have it when I am finished with it!


----------



## Bigshadow (Dec 5, 2006)

Ping898 said:


> I've always loved the joke about the program that wrote a very important piece of code and it worked perfectly for years and then one day he was fired and about a week later the code stopped working...a later code analysis revealed that into his code he had programmed a check to payroll, that only if he was on the payroll should the code work :-D....



Yeah, I have heard that too.  I believe it was a urban legend.   Cool idea though.


----------



## rutherford (Dec 5, 2006)

I once formatted the hard drive of a laptop in the couple seconds I had to clear out my desk after being fired.  The security guy watching me wasn't doing his job.

It's not something I'm proud of, but I had a lot of work done for them that I wasn't going to be able to bill them for, so I wasn't about to hand over anything I hadn't had a chance to finish and check in.

Honestly, if I had the job of looking over another programmer's work who'd just been fired, I'd probably do the whole thing over again anyways.  It's safer.


----------



## Bigshadow (Dec 5, 2006)

rutherford said:


> I once formatted the hard drive of a laptop in the couple seconds I had to clear out my desk after being fired.  The security guy watching me wasn't doing his job.
> 
> It's not something I'm proud of, but I had a lot of work done for them that I wasn't going to be able to bill them for, so I wasn't about to hand over anything I hadn't had a chance to finish and check in.
> 
> Honestly, if I had the job of looking over another programmer's work who'd just been fired, I'd probably do the whole thing over again anyways.  It's safer.



They weren't following standard IT security measures for dismissing an   employee.  Thankfully for you.


----------



## Rich Parsons (Dec 5, 2006)

exile said:


> I hope you reminded him that in the progamming world, there are no problems, only solutions!


 

True, and the final solution was that he was back where he started because he did not like his other job, and I left as I was contract and they would not hire directly.  

He was more worried about his ego, as it took a beating when someone else was able to do something he could not. I got over that a long time ago.


----------



## Phadrus00 (Dec 5, 2006)

mrhnau said:


> Nah... try some things w/ SED. Or get really cryptic w/ Assembly. I really enjoyed learning that
> 
> 1) Never write a line of code that someone else can understand.


 
Nahhhh.. REALLY freak 'em out...  Solve the whole thing with XSLT and XML... *evil chortle*   Even YOU will not be able to figure it out when you are done!  *lol*

PS.. I'm Back...  sorry for the hiatus....


----------

