Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-4041-8081-

Bad Programming Practices

Name: Anonymous 2010-10-19 0:35

Each post must contain one bad programming practice to add to the list. I'll start:

In C++, overload library functions by using #define. That way it looks like you are using a familiar library function where in actuality you are using something totally different.

Name: Anonymous 2010-10-19 0:42

putting a { on the same line that a function is declared

Name: Anonymous 2010-10-19 0:43

Coding in C++

Name: Anonymous 2010-10-19 0:46

Posting on this board.

Name: Anonymous 2010-10-19 0:47

Never write comments - good code (that is *my* code) explains itself

Name: Anonymous 2010-10-19 0:49

>>5
good programmers should be able to trace through a program no problem and discover what it's doing without comments, now if you're learning the language then the examples should have them, but unless you're a retad you probably don't need comments k

Name: Anonymous 2010-10-19 0:53

Everything >>6-chan codes.

Name: Anonymous 2010-10-19 3:54

Using a language other than C++, C#, Java, or Visual Basic.Net.

Name: Anonymous 2010-10-19 3:56

Hax my anus.

Name: Anonymous 2010-10-19 5:00

>>2
Wait really?
Why? I'm not good at this and I've been doing it.

Name: Anonymous 2010-10-19 5:08

>>10
Doing that increases the velocidensity of the sector of your hard drive where the file is stored, which in turn means that there will be less velocidensity available for your music files. If you use lossy compression you won't notice the difference, but your FLAC files will gradually lose information.

Name: Anonymous 2010-10-19 5:15

void.h

Name: Anonymous 2010-10-19 5:25

>>11
Oh that makes sense.

Name: Anonymous 2010-10-19 5:30


Type *p = (Type *)malloc(n * sizeof (Type));

Name: Anonymous 2010-10-19 6:01

sub show_post($$$$$$$$$$$){
  my($num,$thread,$time,$name,$trip,$link,$comment,$ip,$file,$filename,$deleted)=@_;
  if($deleted){

%>

  <div class="post">
   <p class="deleted"><%= S_DELETEDPOST %></p>
  </div>

<% }else{ %>

   <div class="post">
    <p class="postheader">
     <span class="postnum"><%= $num %></span>
     <%= S_NAME %>

<% if($link){ %>

     <a href="<%= $link %>">

<% } %>

      <span class="postername"><%= $name %></span>
      <span class="postertrip"><%= $trip %></span>

<% if($link){ %>

     </a>

<% } %>

     : <span class="posttime"><%= $time %></span>
     <%= S_ID %><span class="id"><%= $link=~/sage/?'Heaven':make_id($thread.$ip) %></span>
    </p>
    <div class="postbody">

<%

    if($file){
     my @fileparts=split /\./,$file;
     my $ext=pop @fileparts;
     my $file=join '.',@fileparts;

%>

     <div class="image">
      <a href="<%= expand_filename("src/$file.$ext") %>">

<% if($ext =~ /^(?:jpg|gif|png|svg)$/){ %>

       <img src="<%= expand_filename("thumb/$file.gif") %>" alt="<%= $filename %>" title="<%= $filename %>" />

<% } else { %>

       <span class="nothumb"><%= S_NOTHUMB %>:<br /><%= $filename %></span>

<% } %>

      </a>
     </div>

<%

    }

%>

     <div class="commenttext">
      <%= $comment %>
     </div>
    </div>
   </div>

<%

  }
 }

Name: Anonymous 2010-10-19 7:41

Using + for string concatenation

Name: Anonymous 2010-10-19 8:07

Using anything but Scheme

Name: Anonymous 2010-10-19 8:11

int RandomInt(int r){
     return 4;
}

Name: Anonymous 2010-10-19 8:13

>>18
Go away.

Name: Anonymous 2010-10-19 8:15

>>16
Would you say that the + operator is a bad practice in base1 as well then?

Name: Anonymous 2010-10-19 8:28

>>16
Please learn about monoids, thank you.
(+) is a natural candidate for the monoidal operation because it is always associative and usually commutative.

Name: Anonymous 2010-10-19 8:31

>>18
Fuck off ``Randall.''

Name: Anonymous 2010-10-19 8:36

Overloading operators.

Name: Anonymous 2010-10-19 8:39

>>21
You're just an idiot who read the definition of a monoid and thinks his babbling is relevant to the problem of str1 + str2. You make me so angry.

Name: Anonymous 2010-10-19 8:52

It is relevant, fucktard.
Fuck off.

Name: Anonymous 2010-10-19 8:53

Doing stupid Code Golf tricks like: using the ternary operator inline where an if/else would make the flow easier to follow.

Name: Anonymous 2010-10-19 9:01

Singleton and Factory design patterns. In fact, most 6design patterns9.

Name: Anonymous 2010-10-19 9:04

perl

Name: Anonymous 2010-10-19 9:30

>>16
get out.

Name: Anonymous 2010-10-19 9:58

>>3,17,27,28
These men speak the truth

>>2
DIE FAGGOT DIE

Name: Anonymous 2010-10-19 10:22

>>22
CHOSEN BY A FAIR DICE ROLL

HAHAHA FUCK YOU NIGGER

HAVE YOU READ YOUR XKCD TODAY

Name: Anonymous 2010-10-19 10:36

>>31
The exit is on your left. Do not enter this establishment again.

Name: Anonymous 2010-10-19 11:04

>>32
Fuck you I won't do what you tell me.

Read xkcd everyday -- it makes the /prog/fags more annoying.

Name: Anonymous 2010-10-19 11:05

Perl 5 is pigu disugasutingu.

Using it is a programming error.

Why is
sub proc{my @arr=('a','b','c');return @arr};print( (proc())[1] );,
possible, but not
sub proc{my %h=('a'=>'b','c'=>'d');return %h};print( (proc()){'a'} );

UNLIMITED IRRITATION WORKS

Name: Anonymous 2010-10-19 11:16

>>34
Because you touch yourself at night.

Name: Anonymous 2010-10-19 11:28

>>34
Because fuck you that's why

Name: Anonymous 2010-10-19 11:58

>>34
Because perl only has scalar and list contexts.
Use return \%h; and proc()->{a}, no True Programmer uses anything but references.

Name: Anonymous 2010-10-19 11:59

>>35
>>36
butthurt perl ``faggots''

Name: Anonymous 2010-10-19 13:02

>>34
I was going to say what >>37 did.

Also, it works exactly as you have it in Perl 6. Try it: http://try.rakudo.org/

>>37
no True Programmer uses anything but references.
Refs are a pain in perl5. It's the only time sigil variance causes problems (indirectly) for me. OTOH in Perl 6 refs are implicit most of the time, and during assignment you use the binding operator instead of taking a ref and assigning that.

Name: Anonymous 2010-10-19 15:28

magic numbers

Name: Anonymous 2010-10-19 17:19

A function taking no parameters and returning no value.

void perform_side_effects(void);

Name: Anonymous 2010-10-19 17:23

>>41
putting void in a parameter list to signify no parameters

Name: Anonymous 2010-10-19 17:24

>>42
Using Java

Name: Anonymous 2010-10-19 17:25

>>43
winner

Name: Anonymous 2010-10-19 18:03

Using PHP

Name: Anonymous 2010-10-19 18:06

Using anus

Name: Anonymous 2010-10-19 18:31

Using namespace std;

Name: Anonymous 2010-10-19 20:34

Single character variable names. I can't believe academics encourage this practice still.

I can think of a lot of Python-specific ones, but I'll limit myself to one case.


class SomeObject (object):
    member = OtherObject() #This will hurt you.

Name: Anonymous 2010-10-19 20:48

Using opiates

Name: Anonymous 2010-10-19 20:53

>>48
There's nothing wrong with using i or j as loop variables. It's a widely understood convention, and trying to be clever by calling them something like index will only confuse/piss off other people who have to read your code.

Name: Anonymous 2010-10-19 21:08

EVERYTHING HAS ALREADY BEEN ANSWERED IN >>9
THREAD OVER

Name: Anonymous 2010-10-19 21:26

>>50
No. It will only confuse you if can't handle the extra readability.

Name: Anonymous 2010-10-19 21:49

>>52
You don't understand what readability is.

Name: Anonymous 2010-10-19 22:01

>>52
Your code should convey its semantics as clearly as possible. That means choosing familiar idioms whenever you can. The extra 200ms it takes your maintenance programmer to figure out that by int counter you really meant int i are better spent elsewhere.

Name: Anonymous 2010-10-20 0:05

>>53-54
yhbt lol

Name: Anonymous 2010-10-20 0:10

index is also a standard function, however deprecated. Don't call anything index, it just makes compiling with -Wshadow annoying.

Name: Anonymous 2010-10-20 2:31

Writing an HTTP client library and making it impossible to do a simple GET request and put the result into a string in less than 15 lines of code.
I'm looking at you, Java.

Name: Anonymous 2010-10-20 2:44

>>57
You have to be kidding me. I've never used Java, but it can't possibly be that bad!

Name: Anonymous 2010-10-20 3:04

>>58
It really is that bad. Hopefully now that I've got MonoDroid set up I can ditch that pile of crap and write the app in C#.

Name: Anonymous 2010-10-20 9:12

Using Microsoft Security-Enhanced CRT

Name: Anonymous 2010-10-20 9:45

UML diagrams.

Name: Anonymous 2010-10-20 12:06

In C/C++, using #ifdef rather than if.

Name: Anonymous 2010-10-20 12:12

>>62
4/10

Name: Anonymous 2010-10-20 12:22

>>62

if def(__WIN32__)
{
    #include <windows.h>
}

int main()
{
}

stdin:1: declaration expected

Name: Anonymous 2010-10-20 12:25

Writing programs for "mobile devices"

Name: Anonymous 2010-10-20 12:50

Not cleaning the cappuccino tube in the coffee machine after yourself.  It irritates other programmers in your team and impairs your overall performance.

Name: Anonymous 2010-10-20 13:02

Not working from home

Name: Anonymous 2010-10-20 15:25

>>66
this
says everything

Name: Anonymous 2010-10-20 17:15

>>62
wat

Name: Anonymous 2010-10-20 23:56

ALWAYS invert indentation.

Name: Anonymous 2010-10-21 0:36

Emply the YHBT operator extensively.

Name: Anonymous 2010-10-21 1:25

>>71
You can't spell for shit.

Name: Anonymous 2010-10-21 1:52

>>71
Thus, you cannot conjure the spirits of the computer with your spells.

Name: Anonymous 2010-10-21 6:43

>>21
it is always associative and usually commutative.
+ is commutative on every ring. If you're doing calculations on non-ring environtments, you are utterly doomed.

Name: Anonymous 2010-10-22 13:46

>>74
RING MY ANUS

Name: Anonymous 2010-10-22 13:58

Using C++, C#, Java, or Visual Basic.Net.

Name: Anonymous 2010-10-22 13:58

Using C++, C#, Java, or Visual Basic.Net.

Name: >>76-77 2010-10-22 13:58

I hope I've made my point quite clearly.

Name: Anonymous 2010-10-22 13:59

>>75
+5 Funny

Name: Anonymous 2010-10-22 16:36

overloading operators

Name: Anonymous 2010-10-22 16:56

When comments are larger than the code. Perl is the only exception to this.

Name: Anonymous 2010-10-22 17:13

h

Name: Anonymous 2010-10-22 17:13

a

Name: Anonymous 2010-10-22 17:13

x

Name: Anonymous 2010-10-22 17:14

m

Name: Anonymous 2010-10-22 17:14

y

Name: Anonymous 2010-10-22 17:14

a

Name: Anonymous 2010-10-22 17:14

n

Name: Anonymous 2010-10-22 17:14

u

Name: Anonymous 2010-10-22 17:14

s

Name: Anonymous 2010-10-22 18:17

[spoiler]EPIC WIN OP[/spoiler

Name: Anonymous 2010-10-22 19:00

>>79
Thank you! Thank you so much! Oh god, I'm so unprepared. I'd just like to thank The Sussman, HMA meme fan, and of course my anus for all the love and support they've given me over the years. I love you all!

>>75

Name: Anonymous 2010-10-23 3:32

In memcpy() like functions, putting the source pointers before the destination pointers.

Name: Anonymous 2010-10-23 4:29

>>93
not bad[i]![/b]

Name: Anonymous 2010-10-23 5:05

[b]BBCode [i]failures[u][/i][/b]

Name: Anonymous 2010-10-23 5:07

FUQUE, my [b][i]FIBONACCI BUTT SORT[o][/i][/b] algorithm is broken.

Name: Anonymous 2010-10-24 4:29

>>50
I was speaking of something like the following:


for x in elements:
    for y in subelements:
        ...


Or perhaps:

x = y.method_call()

if x > z:
   ...


I wouldn't mind seeing them used as names for indexes in a C-style for loop. Another good place is in a language construct like a Python generator expression, where names are only used to describe how something should be generated in a single line. SQL aliases are also a good place for names of a very short length.

Name: Anonymous 2010-10-24 4:31

>>97
This is probably closer to what I mean.:


for x in elements:
    for y in x:
        ...


I do apologise.

Name: Anonymous 2010-10-24 4:58

>>97
Funny, I tend to use i and j in for(;;) loops, but in foreach loops it's usually a (possibly abbreviated) singular form of the name of the array, i.e. for elem in elements.

Name: Anonymous 2010-10-24 5:13

Oh, you poor non-nomadic people and you lack of [elem:elems] convention. :(

Name: Anonymous 2010-10-24 11:34

I once wrote a language where >> and << were the input and output operators.  Why the hell are people still using it?

Name: Anonymous 2010-10-24 18:22

>>101
Hello, Bjarne.

Name: Anonymous 2010-10-24 20:22

>>102
Hello Captain Obvious.

Name: Anonymous 2010-10-24 22:22

>>102
Hello, SUSSMAN

Name: Anonymous 2010-10-25 13:10

>>102-104
Hello, World.

Name: Anonymous 2010-10-25 22:59

>>105
Hello, opiates

Name: Anonymous 2010-10-25 23:01

>>106
Hello, Kitty.

Name: Anonymous 2010-10-25 23:07

>>107
Hello, anus

Name: Anonymous 2010-10-26 0:14

>>108
Hello, successfully derailed thread.

Name: Anonymous 2010-10-26 1:59

You have all been reported for being from Reddit.

Name: Anonymous 2010-12-06 10:03

Back to /b/, ``GNAA Faggot''

Name: Anonymous 2011-02-04 13:16


Don't change these.
Name: Email:
Entire Thread Thread List