guide-to-trash-code

The ultimate guide to writing Trash Code

View the Project on GitHub hello-world-404/guide-to-trash-code

Go back to home page

Unit 1

The start of writing trash code

In this unit, you will learn the basics of writing trash code.

Things to do before writing trash code

See Unit 0 - What you need to do before writing trash code

Writing the Code

After you have done the things done above, you are ready to write Trash Code!

Remember, the first thing writing trash code is to be complicated.

Let’s say that you are writing a program that receives the input as the radius and outputs the perimeter and area.

**ALL CODE SEGMENTS ARE WRITTEN IN JAVA, USE YOUR CLEVER BRAIN TO CHANGE IT TO THE LANGUAGE YOU WRITE, THAT MAKES IT EVEN TRASH. **

  1. First thing you have to do is to declare the base class and method of your code. Let’s first rename our file by a wrong spelling name which starts with lower cases(so that we will not be able to recognize them from methods). Since the file name was changed, let’s change our class name, too.
    public class area{
     public static void main(String[] args){
    
     }
    }
    
  2. Declare the variables you need with meaningless variable names, or write meaningful variable names and assign them with the wrong values.
    public class area{
     public static void main(String[] args){
           Double i =  888.0;
           Double e = 666.0;
    
           Double radius = 2 * 3.14 *
     }
    }
    
  3. Write equations for computing the area and perimeter and put set them to other variables.
    public class Area{
     public static void main(String[] args){
           Double i =  888.0;
           Double e = 666.0;
    
           Double radius = 2 * 3.14 * i;
           Double perimeter = 3.14 * i * i;
     }
    }
    
  4. Print random stuff out!
    public class Area{
     public static void main(String[] args){
           Double i =  888.0;
           Double e = 666.0;
    
           Double radius = 2 * 3.14 * i;
           Double perimeter = 3.14 * i * i;
    
           System.out.println(i);
           System.out.println(e);
           System.out.println(i);
           System.out.println(perimeter);
     }
    }
    
  5. Oh Yeah! What messy code!