I am probably going to get a lot of criticism for asking this...

I am probably going to get a lot of criticism for asking this, but what are some ways to make your code more difficult for others to maintain, and make yourself less replaceable? I'm not talking about malicious obfuscation, but writing code in a way that makes if hard for others to read while also improving your code in certain aspects.

Below are some ideas I have so far. Some of these, such as the first one, won't work if everyone you work with is a programming wiz or computer science major, but most people who write/maintain code at my company aren't (we are scientists/engineers).

* Make use of every feature of your programming language. For example, if you are writing in C++, make heavy use of templates, polymorphism, overloaded functions, inheritance. I hear people bitch about templated C++ a lot.

* Make heavy use of the Boost library

* Never make a regular Makefile. Only use obscure build tools that only you know how to use

* Make your code have external dependencies which are difficult for a novice to learn to install

* If you are a foreigner, then write comments in your native language. I know a french guy who did this and after he left it was really tough for my company to find another french guy to replace him.

Any others?

Other urls found in this thread:

se.rit.edu/~tabeec/RIT_441/Resources_files/How To Write Unmaintainable Code.pdf
twitter.com/NSFWRedditGif

Are you so terrible at your job that you have to sabotage your own work and go against the unix philosophies just to secure your job?

Why won't you just be a better programmer and developer instead, so they choose not to replace you for the right reasons?

write your own tools in lisp

it's what I do, not even a programmer but sometimes I have to do something and it btfo our actual programmers who have to spend ten years with retarded C++ syntax while I just rewrite the compiler and reader to solve my problem, making inscrutable but truly amazing programs

I would recognise this immediately and have your arse kicked out. If it's unnecessarily complicated be prepared to explain yourself. And if you're not lazy that will also raise questions.

Also, although some of these might work, function overloading is nothing difficult. Like, you learn that in the first month of programming 101

I-I'm going to try this.

I recommend racket. making your own #lang languages and the syntax-parse library are pretty fucking amazing. But lisp macros have their own charm.

>I'm not talking about malicious obfuscation, but writing code in a way that makes if hard for others to read while also improving your code in certain aspects
>I'm not talking about x but about x

>Make use of every feature of your programming language. For example, if you are writing in C++, make heavy use of templates, polymorphism, overloaded functions, inheritance. I hear people bitch about templated C++ a lot.
Fucking brainlets

why do people bash C++ syntax? i don't get this. do you have anything even remotely similar to openVDB?

Code in APL

templates are a good thing to learn and use for legitimate purposes, I highly suggest it, plus I guess it is somewhat opaque to someone inexperienced with them

Make minor changes to stdio.h and other files that are supposed to come with the compiler and assumed to be the same for every developer. Write code that requires those changes. The project will now only work properly when you compile it.

If you don't want to be replaced, you have to take over a new project.

What would happen when you leave the company on your own?

People wrote amazing stuff in machine code too.

wow you must be so smart whats your IQ man?

>6 figure starting IQ
>Any job I want

I think you're doing it the wrong way. Obviously you want to keep documentation to a minimum, but more important than 'how' you write your code is 'what' code you're writing. If all you're doing is write text file parsers, any monkey could re-write that. You want to get to a position where no-one understands what your code was meant to do in the first place, and then write obscure code.

Use Lisp.

Code in Perl!

(O, was already mentioned.)

ITT people who don't have code reviews

> I just rewrite the compiler and reader to solve my problem

kekwut?

Learn lisp.

...

Most of the time when I have to take over someone else's process I just write my own version anyway, which will probably be especially easy for programmers at your company to do since you're so bad at programming you feel the need to try to protect your job with retard code.

Lisp programs are run essentially by

evaluate(expand-syntax(read some-file)))

The reader is programmable, and you can write your own custom syntax. Thus it's quite practical to write a programming language in which you can solve your problem directly. When used responsibly it's elegant and concise. When used maliciously it's extremely obfuscated code.

Neither science or math

Nor*
Ftfy you greasy STEMlord

Why should he have loyalty to a company that can get rid of him at any moment?

Operator overload especially if you make the side effects something completely unrelated to the functionality of the overloaded operator.

Which book should i read to learn lisp. I am an experienced programmer but never programmed in a functional language, so i would appreciate some theory.

git gud

This

se.rit.edu/~tabeec/RIT_441/Resources_files/How To Write Unmaintainable Code.pdf

>smallbrainwojack.png
How can you be this bad at reading?

Who said anything about loyalty? It's about being a good worker for the company that is paying you a salary. It's called being responsible. They hire people expecting them to be both competent at what they do and good at working in a team, not 'loyal'.

Vectorize everything. Use things like tensor products to do common matrix operations very compactly.

>I'm not talking about malicious obfuscation, but writing code in a way that makes if hard for others to read while also improving your code in certain aspects.

Write code that works very efficiently but only under the exact circumstances provided for the original purpose.

Lambda calculus, OP. Normans literally cannot into even though its simple as shit.

Haskell is great if you want to write an airtight side effect free program that has no practical value.

OP, overuse all the design patterns and you are safe

>does't do code reviews for himself

I learned scheme using SICP and The Little Schemer after having experience with C, C++, Python, and Lua. Though it wasn't 100% compatible I used PLT Scheme with it, which eventually became too different from Scheme and they switched the name to Racket and I've stuck with it ever since.

Because they'll replave him with an indian anyway you naive fuck

If you're replaced by an H1B immigrant you either weren't a very good programmer or your company is making bad decisions and you wouldn't want to continue working there anyway.

>Who said anything about loyalty? It's about being a good worker for the company that is paying you a salary. It's called being responsible. They hire people expecting them to be both competent at what they do and good at working in a team, not 'loyal'.

I agree with that and when you are hired you have an obligation to be responsible in your work. You are not fulfilling your obligation by creating obfuscated code on purpose, in my opinion. It is not an industry standard understanding that a developer will write ofuscated code. By definition if you are not fulfilling an obligation then you are disloyal. I think maybe you have a naive definition of loyal and probably relate it to dogs or servitude. No offence.

I'm also asking why should he be loyal ( why should he fulfill his obligation of responsibility) for a company that is merely engaged in a contractual agreement? If he has no portion of a contract stating his code must be easily read or that it always undergoes peer review, then he really has no reason to not obfuscated his code if he thinks it will afford him job security.

Genius.

You become irreplaceable by being a specifically good coder. Thats the single way. get a nice skillset( e.g. COBOL) and you're fine. Usually violating style guidelines will get you in trouble regardless, because people start understanding that the first goal for code is to be read by people.

So lisp is the language used by the extremely alt right?

No, it's called responding rationally to the incentive structure.
It's not a programmer's fault if his employer offers such poor job security that his rational incentive is to obfuscate code to protect his position. It's just dispassionate self-interest.
If there is a good amount of job security, obfuscating code doesn't provide enough security to justify the investment of effort into it, and it ceases to be incentivised.

Your definitetion of loyalty is wrong. You are the only one who thinks it is defined that way. Sorry, bud.

>Your definitetion of loyalty is wrong. You are the only one who thinks it is defined that way. Sorry, bud.

How do you figure? Can you not read andictionary?

Dictionary.com gives a few definitions for loyalty:

faithful to one's oath, commitments, or obligations:to be loyal to a vow.

Definition of loyal (continued)

faithful to any leader, party, or cause, or to any person or thing conceived as deserving fidelity:a loyal friend.

characterized by or showing faithfulness to commitments, vows, allegiance, obligations, etc.:

Pretty much aligns with what he said.

>trusting (((horses)))