Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Nuluvius

Bad, terrible or simply funny code examples

Recommended Posts

Cause the way you code it is horrendous. Has almost no logical order or sense to it.

 

Each language has it's use and advantages over others.

 

If you don't use the language correctly then ofcourse you're doing it wrong and the results won't be as neat.

You probably were using it wrong and that's why it didn't work. The same way if you were to use vb.net for game development, it just won't work out that well you probably did the same thing with java and used it in a complete wrong way you shouldn't have.

It's not the language that's at fault, it's you who is at fault for using it in that certain way.

 

You cannot say that java sucks but you can say that java should not be used in a certain way and the results won't be the same as expected when doing so.

Link to post
Share on other sites

Each language has it's use and advantages over others.

 

If you don't use the language correctly then ofcourse you're doing it wrong and the results won't be as neat.

You probably were using it wrong and that's why it didn't work. The same way if you were to use vb.net for game development, it just won't work out that well you probably did the same thing with java and used it in a complete wrong way you shouldn't have.

It's not the language that's at fault, it's you who is at fault for using it in that certain way.

 

You cannot say that java sucks but you can say that java should not be used in a certain way and the results won't be the same as expected when doing so.

I never used it. I have just heard from a lot of professional coders that they dislike the way they have to code it.

Also the fact that it is difficult just makes it harder to learn for someone who is starting to code. Which is why it is never recommended for beginners.


My sound system costs more than my PC.        Check out my S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Intel i7 4790k | AMD Vega 64 | ASUS Sabertooth Z97 Mark S | Corsair Vengeance Pro 32GB | NZXT S340 | Seasonic Platinum 760 | modded H100i | Coolermaster SK630 White | Logitech MX Master 2S | 2x Samsung 850 Pro 512GB | WD Red 4TB Samsung 58" 4k TV | 2x Behringer NEKKST K8 | BIC Acoustech H-100II | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

I never used it. I have just heard from a lot of professional coders that they dislike the way they have to code it.

Also the fact that it is difficult just makes it harder to learn for someone who is starting to code. Which is why it is never recommended for beginners.

 

There's nothing wrong with it.

It is VERY Object Oriented and heavily depends upon that paradigm... And I guess maybe that puts some people off. Not everyone is into that sort of thing.

It's not all that difficult. Java is what I mostly learnt with. I would have no problems recommending it to a beginner.

And I am a professional "coder".

Link to post
Share on other sites

I never used it. I have just heard from a lot of professional coders that they dislike the way they have to code it.

Also the fact that it is difficult just makes it harder to learn for someone who is starting to code. Which is why it is never recommended for beginners.

java was my 2nd language after vb.net (I know, I know it's not the greatest but hey it was my first! I don't use it anymore of course unless if I need simple things done)  I actually believe that java is one of the simplest C based languages out there. If you find Java being a hard language and you can't use its syntax's then you'd struggle with any sort of software development. The UX/UI devs over at where I work can even use the syntax's and understand it's basics. If you were to use any other common language then you should be able to understand the basics of java.

 

java is actually recommended as a starter language to learn its syntax's since they are used in many other languages.

Link to post
Share on other sites

There's nothing wrong with it.

It is VERY Object Oriented and heavily depends upon that paradigm... And I guess maybe that puts some people off. Not everyone is into that sort of thing.

It's not all that difficult. Java is what I mostly learnt with. I would have no problems recommending it to a beginner.

And I am a professional "coder".

Well I have heard from more than a couple sources that it is by far not the best language for beginners.

My sources include a proper programming teacher, one of his students which is one of the best programmers in the world, and hundreds of pages on the internet that recommend python over java for beginners any day.


My sound system costs more than my PC.        Check out my S340 build log "White Heaven"        The "LIGHTCANON" flashlight build log        Project AntiRoll (prototype)        Custom speaker project

Spoiler

Intel i7 4790k | AMD Vega 64 | ASUS Sabertooth Z97 Mark S | Corsair Vengeance Pro 32GB | NZXT S340 | Seasonic Platinum 760 | modded H100i | Coolermaster SK630 White | Logitech MX Master 2S | 2x Samsung 850 Pro 512GB | WD Red 4TB Samsung 58" 4k TV | 2x Behringer NEKKST K8 | BIC Acoustech H-100II | Scarlett 2i4 | 2x AT2020

 

Link to post
Share on other sites

Well I have heard from more than a couple sources that it is by far not the best language for beginners.

My sources include a proper programming teacher, one of his students which is one of the best programmers in the world, and hundreds of pages on the internet that recommend python over java for beginners any day.

 

I never said it was the best for beginners. I just said there's nothing wrong with starting out with it.

Link to post
Share on other sites

layout.setVerticalGroup(      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)      .addGroup(layout.createSequentialGroup()            .addComponent(jLabel3)            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)            .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)            .addGap(11, 11, 11)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jLabel4)            .addComponent(jLabel5))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEAD​ING)            .addComponent(jField2Up, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addGroup(layout.createSequentialGroup()            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEAD​ING)            .addGroup(layout.createSequentialGroup()            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jLabel6)            .addComponent(jField1Up, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1Down, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel7))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1Left, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel8))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1Right, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel9)            .addComponent(jField2Right, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1A, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel10)            .addComponent(jField2A, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))            .addGroup(layout.createSequentialGroup()            .addGap(31, 31, 31)            .addComponent(jField2Down, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addComponent(jField2Left, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1B, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel11)            .addComponent(jField2B, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1Select, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel12)            .addComponent(jField2Select, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1Start, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel13)            .addComponent(jField2Start, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)            .addComponent(jLabel1)            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jLabelCtrl1)            .addComponent(jButton2))            .addGap(12, 12, 12)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jLabelCtrl2)            .addComponent(jButton1))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jButtonOK)            .addComponent(jButtonCancel))            .addGap(0, 8, Short.MAX_VALUE))      );

One line in a Java NES emulator.

I myself am a Java developer and can say that this developer is one of the worst I've ever seen. How can someone like this even create a working emulator.

That piece of code can be found at https://github.com/andrew-hoffman/halfnes/blob/master/src/com/grapeshot/halfnes/ui/ControlsDialog.java

Link to post
Share on other sites
layout.setVerticalGroup(      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)      .addGroup(layout.createSequentialGroup()            .addComponent(jLabel3)            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)            .addComponent(jLabel16, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)            .addGap(11, 11, 11)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jLabel4)            .addComponent(jLabel5))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEAD​ING)            .addComponent(jField2Up, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addGroup(layout.createSequentialGroup()            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEAD​ING)            .addGroup(layout.createSequentialGroup()            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jLabel6)            .addComponent(jField1Up, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1Down, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel7))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1Left, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel8))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1Right, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel9)            .addComponent(jField2Right, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1A, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel10)            .addComponent(jField2A, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))            .addGroup(layout.createSequentialGroup()            .addGap(31, 31, 31)            .addComponent(jField2Down, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addComponent(jField2Left, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1B, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel11)            .addComponent(jField2B, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1Select, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel12)            .addComponent(jField2Select, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jField1Start, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)            .addComponent(jLabel13)            .addComponent(jField2Start, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)            .addComponent(jLabel1)            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jLabelCtrl1)            .addComponent(jButton2))            .addGap(12, 12, 12)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jLabelCtrl2)            .addComponent(jButton1))            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASE​LINE)            .addComponent(jButtonOK)            .addComponent(jButtonCancel))            .addGap(0, 8, Short.MAX_VALUE))      );

One line in a Java NES emulator.

I myself am a Java developer and can say that this developer is one of the worst I've ever seen. How can someone like this even create a working emulator.

That piece of code can be found at https://github.com/andrew-hoffman/halfnes/blob/master/src/com/grapeshot/halfnes/ui/ControlsDialog.java

 

 

Looking through that code tells me that this guy has never heard of an Array...

        jLabel3 = new javax.swing.JLabel();        jLabel4 = new javax.swing.JLabel();        jLabel5 = new javax.swing.JLabel();        jLabel6 = new javax.swing.JLabel();        jLabel7 = new javax.swing.JLabel();        jLabel8 = new javax.swing.JLabel();        jLabel9 = new javax.swing.JLabel();        jLabel10 = new javax.swing.JLabel();        jLabel11 = new javax.swing.JLabel();        jLabel12 = new javax.swing.JLabel();        jLabel13 = new javax.swing.JLabel();        jField1Up = new javax.swing.JTextField();        jField1Down = new javax.swing.JTextField();        jField1Right = new javax.swing.JTextField();        jField1Left = new javax.swing.JTextField();        jField1Start = new javax.swing.JTextField();        jField1Select = new javax.swing.JTextField();        jField1B = new javax.swing.JTextField();        jField1A = new javax.swing.JTextField();        jField2Up = new javax.swing.JTextField();        jField2Down = new javax.swing.JTextField();        jField2Left = new javax.swing.JTextField();        jField2Right = new javax.swing.JTextField();        jField2A = new javax.swing.JTextField();        jField2B = new javax.swing.JTextField();        jField2Select = new javax.swing.JTextField();        jField2Start = new javax.swing.JTextField();        jButtonCancel = new javax.swing.JButton();        jButtonOK = new javax.swing.JButton();        jLabel16 = new javax.swing.JLabel();        jLabel1 = new javax.swing.JLabel();        jLabelCtrl1 = new javax.swing.JLabel();        jButton1 = new javax.swing.JButton();        jButton2 = new javax.swing.JButton();        jLabelCtrl2 = new javax.swing.JLabel();
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×