Skip to content

seanpm2001/Bad-Code-Collection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

94 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

All Contributors


Bad code collection

This is my collection for bad code. Code I classify as bad code will be added here when I have time. If there is an example that needs to go here, please raise an issue.

I am currently unsure whether markup languages (such as HTML or Markdown) should count.

What is bad code?

Bad code is source code that works poorly, uses lots of unnecessary space, or [other reason(s)]. Please note that just because source code may be hard to read/unclean does NOT mean it is bad code. If you are using a thousand lines of code to calculate 2+2, that is DEFINITELY bad code, and you should actually reconsider your career (unless this was done as a joke)

Search project

Section C

[Bad code written in C]

Section P

[Bad code written in Python]

Questions

For I: iterate

I have been trying to figure something out for a while now, I finally have a place to talk about it:

The following source code example is functional, and works across various programming languages, including C, C++, C#, Java, Go, etc. (it works under most imperative programming languages that use curly brackets and semicolons)

for (i = 1;
	i < 10;
	i++;
	)

However, the programming community seems to loathe this, and I can't figure out why. Is this really bad code?

See also:

[Stop calling it bad code] - Blog.pragmaticengineer

[Shotgun surgery] - en.wikipedia


File info

Click/tap here to expand/collapse this section

File type: Markdown (*.md *.mkd *.mdown *.markdown)

File version: 2 (Monday, 2022 March 14th at 2:52 pm)

Line count (including blank lines and compiler line): 72

Current article language: English (EN_US) / Markdown (CommonMark) / HTML5 (HyperText Markup Language 5.3)

Encoding: UTF-8 (Emoji 12.0 or higher recommended)

All times are UTC-7 (PDT/Pacific Time) (Please also account for DST (Daylight Savings Time) for older/newer entries up until it is abolished/no longer followed)

Note that on 2022, Sunday, March 13th at 2:00 am PST, the time jumped ahead 1 hour to 3:00 am.

You may need special rendering support for the <details> HTML tag being used in this document


Contributors ✨

Thanks goes to these wonderful people (emoji key):


Sean P. Myrick V19.1.7.2

πŸ’» πŸ“– πŸ“† πŸ›‘οΈ πŸ”£ πŸ–‹ 🎨 🚧 πŸ€”

All Contributors

πŸ“–

This project follows the all-contributors specification. Contributions of any kind welcome!