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

What stirs your rage, /prog/?

Name: Anonymous 2013-09-14 1:07

Mine are people who do this on C-like languages:
if(numbers==NULL)
{
numbers=temp;
numbers->next=NULL;
}
else
{
temp2=numbers;
while(temp2!=NULL)
{
var=temp2;
temp2=temp2->next;
}
temp2=temp;
var->next=temp2;
temp2->next=NULL;
}


No spaces between operators.
Opening brace on lines by themselve.
Else statement not a continuation of the if-statement it belongs to
Terse variable.
camelCase

Name: Anonymous 2013-11-13 6:41

The use of the term ``code smell'' is usually an anus smell. A sweet sweet anus smell.

Name: Anonymous 2013-11-13 8:12

oh wow ur guyses maymays and jokes are so unqiue and clever and orginial and always fresh and relvaent right at the right time i mean wow how do i do those special qutation marks u guys do so i can be a part of u all ;)?

Name: Anonymous 2013-11-17 8:10

I hate putting comments. Read the fucking source, faggot. I've already made my identifiers as clear as day!

Name: Anonymous 2013-11-17 9:41

>>83
It's not always obvious why you've gone your particular way. You're supposed to write comments that deal with background or design decisions that aren't obvious.

Name: Anonymous 2013-11-17 11:06

>>84
Really now? Isn't LinkedList or HashTable object names not obvious to you?

Name: Anonymous 2013-11-17 21:02

>>85
Because all solutions to all problems always use obvious implementations of obvious data structures, right?

Name: Anonymous 2013-11-17 21:06

>>86
Yes.

Name: Anonymous 2013-11-17 22:39

>>87
Implement a double ended priority queue using linked lists. Removal of both ends must be O(1).

Tsk.

Name: Anonymous 2013-11-17 23:00

>>88
Nigger.

Name: Anonymous 2013-11-17 23:08

>>88
HIBT?

Name: Anonymous 2013-11-17 23:35

>>90
Not really, you implied you could make anything with just the simplest data structures at hand.

Name: Anonymous 2013-11-17 23:39

>>91
No, I stated it rather explicitly, because it's true. Implications belong on the image-gag-subreddit-combinators.

Name: Anonymous 2013-11-17 23:43

>>92
It's an implication, not an explicit statement. You didn't say ``i could make a file system using linked lists and still make it O(1)'', but it can be inferred from your statement.

I'm not using the imagereddits maymay, why do you work under such assumption? I thought we trusted each other.

Now that you said you really meant that, go ahead and implement that priority deque using just cars and cudders. It would better be fast, nigger.

Name: Anonymous 2013-11-17 23:51

>>93
You didn't say ``i could make a file system using linked lists and still make it O(1)'', but it can be inferred from your statement.

obvious implementations of obvious data structures makes no mention of linked lists.
If your only constraints are that it be made of linked lists and removal of either end be in constant time, I suggest you read up on doubly-linked lists.

Name: Anonymous 2013-11-17 23:56

>>94
It's a priority queue. O(n) insertions are not acceptable. Maybe O(log n) insertions are.

Try again.

Name: Anonymous 2013-11-18 0:17

>>95
the heap version of the priority queue has a tree implementation which can done with cars and cdrs.

Name: Anonymous 2013-11-18 0:24

>>95
Yes but a priority queue already falls under the purview of obvious implementations of obvious data structures So I'm not sure what you're trying to prove.

Name: Anonymous 2013-11-18 0:50

>>96-97
I'm sorry, I meant a priority deque as I said in >>88,93.

The only implementations I know are using a min heap and a max heap with some additional housekeeping, the other one is a min-max heap which could be considered non-trivial.

Both implementation have O(1) delete_min and delete_max and O(log n) insertions. If you can do better with linked lists and your code is absolutely obvious (with no ``useless'' comments), then I'll shut up.

Name: Anonymous 2013-11-18 1:08

>>98
oh ok, so it's a priority queue that can fetch both the min and the max efficiently. The approach you described would work well. There's a similar approach for the purely functional double sided-queue, which can be implemented with two singly linked list, where one is the reverse of the other. Or am I thinking of zippers, which work kind of well. Nevermind. In some cases sorted lists work ok as priority queues. If the new priorities of inserted elements are close to one extreme in priority, and if changed priorities are known to not cross across too many other elements they can work. Or if the size of the queue just stays really small.

But back to the original discussion (which is less interesting imo) data structures have a natural hierarchal structure for documentation, where it is often sufficient to document it's interface and the invariants that are to be maintained by its methods. I don't agree that comments are never necessary, but they can be used more or less effectively and commented code doesn't always give you the information you need to understand it, or what invariants you need to maintain to keep correctness if you were to add onto it.

Name: Anonymous 2013-11-18 3:03

What stirs your rage?
not getting dubs.

Name: Anonymous 2013-11-18 5:20

>>99
You're describing a priority deque with lots of particularities. ``It's fine as long as it's not big'', ``maybe sorting it would be okay'' (O(n log n)[i]![/i]), ``zippers kind of work''.

My point is, it's not always possible to use the simplest data structure and still get good performance. When you simply can't use linked lists, then you explain your choice of data structures in the code using comments. Why is that so bad? It's not like I'm telling you to make /* Increments i by one */ comments.

It also helps when you're drunk/high/any other ``state'' considered lolsocoolXD by normies.

I don't agree that comments are never necessary
I agree.

commented code doesn't always give you the information you need to understand it, or what invariants you need to maintain to keep correctness if you were to add onto it.
Then you're reading some shitty comments, because IMO that's the whole point of comments. Make some good comments, Anon-kun.

Name: Anonymous 2013-11-18 5:47

>>101
I'm a non-``normie'' marijuana user and I resent that.

Name: Anonymous 2013-11-18 16:23

I hate languages where square brackets are overloaded to mean "linked list." There's a reason they have that notation. It's not to hide unnecessary pointer indirections.

Name: Anonymous 2013-11-18 22:09

>>103
Fuck you. I love languages where square brackets mean ``list''.

Name: Anonymous 2013-11-19 22:33

>>104
Can't we just agree to disagree and get along despite our syntax preferences?

Name: Anonymous 2013-11-19 23:18

>>105
No.

Name: Anonymous 2013-12-09 19:48

This, stunts like these stir my rage:
https://www.youtube.com/watch?v=6XvmhE1J9PY
The comments are worse.

Name: Anonymous 2016-10-24 16:38

TRIPS INCOMING!

Name: Anonymous 2016-10-25 6:20

>>107
I wish everybody would learn computer science. However, it's too bad that their definition of computer science is "computer programming" and not the theory that underpins the subject of computation.

Name: Anonymous 2016-10-25 6:30

How do you do your elses?

A:
}
else
{


B:
}
else {


C (faggot):
} else {

Name: Anonymous 2016-10-25 6:40

CHECK MY FUCKING TRIPS!!

Name: Anonymous 2016-10-25 8:31

>>111 Diagnosis:Autism

Name: Anonymous 2016-10-25 15:24

>>110

else:
# INDENT

Name: Anonymous 2016-10-25 16:10

>>35
I am pretty sure that you can use a beautifier for that as well.

Name: Anonymous 2016-10-25 17:14

>>113
ONE WORD
THE FORCED INDENTATION OF THREAD
CODE OVER

Name: Anonymous 2016-10-26 2:05

People who use if/else blocks instead of early returns.

i.e. instead of writing all your fucking code in the else block like this:

if (foo) {
x += 1;
} else if (bar) {
x += 3;
} else {
/* huge pile of shit */
}


Write it like this

if (foo) {
x += 1;
return;
} else if (bar) {
x += 3;
return;
}

/* huge pile of shit */


Now the trivial cases are dealt with early, the main body of the function isn't indented at all, and your coworkers are less pissed off at you. Everybody wins.

Name: Anonymous 2016-10-26 2:29

>>1
Way to bloat up your codebase by 50%!

Name: Anonymous 2016-10-26 5:13

>>116 I write it like this
if (foo) {x += 1;return;}
if (bar) {x += 3;return;}
Much easier to read and conserves screen space

Name: Anonymous 2016-10-26 6:30

if(predicate)
{ something()
;
} else
{ something_else()
;
}

Name: Anonymous 2016-10-26 7:04

if(x==0) and if(x!=0) triggers me

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