GithubHelp home page GithubHelp logo

trekhleb / state-of-the-art-shitcode Goto Github PK

View Code? Open in Web Editor NEW
5.4K 49.0 307.0 64 KB

💩State-of-the-art shitcode principles your project should follow to call it a proper shitcode

License: MIT License

best-practices best-practice styleguide style-guides principles coding code-quality javascript programming

state-of-the-art-shitcode's Issues

No combined shitcode

Am I just blind, or is there no combined shitcode all in one file? I need this as an example.

Name variables in your native language

Nowadays many things support complex variable names. So why not name them in your native language? That saves your time thinking of a name, and time is important.

Good 👍

记录=提取记录(结果)

Bad 👎

processRecord = getRecord(Result)

Is it necessary to write comments in native language?

I know it's a ironical project, but I have question whether to write comments in native language.
Using Chinese will has trouble shifting input method, and it would lead to many problems between win and linux.
But using English will avoid these questions as well as practice Computer English, and it wouldn't cause any problems reading it.

Shitcode : Enterprise Edition

Just a thought, what will happen when shitcode meets EE.

There's FizzBuzzEnterpriseEdition showing us how over-engineering and cargo cult would devastate your codebase in a hurmorous way.

It comes to me that shitcode is not only about how you write the code, but also how you choose the abstraction and implement it.

More "enterprise level shitcode" examples?

Using Emoticons as Identifiers ಠ_ಠ

JavaScript allows for UTF8 variable names which allows use of some emoticons and some people even use emoji as identifiers in languages like C++ #39

Good : -

var ಠ_ಠ = 2022

Bad : -

var year = 2022

感谢👍

加个星,虽然我现在是个学生,但是以后可能会用到。

Should i use variable names in native language?

Python and JavaScript allows it, so i think using English and changing layout hundreds of times is nonsense
Also some weird characters need struggling, so replace them via #define in c and do neater functions.

Bad indenting

Don't indent, makes complex code take up more space in the editor.

Important rule missing

There should be an item regarding secrets in code:

Good practice :

  • put your API keys and SSH keys in code. You will never forget them that way 😄

Bad practice:

  • encrypt sensitive values or keep them in a secret vault

My game is very laggy

I followed all the principles of this repository, and yet my game is very laggy and uses a lot of CPU and RAM. I don't think I can optimize my code further, but maybe one of you guys can help?

Write comments using a rare language

Always write comments in languages that are rarely used among team members. So that members can identify who wrote the code easily.

For example:

  • Always use Elvish if you know how to
  • If you're the only Chinese guy, then use Chinese
  • If you don't know other languages, use family jargons if possible

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.