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

Pages: 1-

Writing code out by hand

Name: Anonymous 2009-11-01 2:13

I started teaching myself programming and I fucking love it.. So I decided well I might aswell take a course at university so that I have a really strong foundation to build on myself. It's such bullshit. They keep taking points off my assignment and giving me comments like "recursion hasn't been covered in class yet". SO fucking what? Now they want me to write an exam and write my code out by hand? Is that even possible? Are there ever any 'real world' scenarios where you would ever need to do that?

Name: Anonymous 2009-11-01 2:17

I do it all the time, but I'm crazy like that.

Name: Anonymous 2009-11-01 2:28

>>1
If you're a srs business senior software engineer guy or whatever then maybe you'll design shit by hand.  But writing out a lot of code by hand before you type the same shit into the computer anyway?  No, it's more bullshit from the wonderful educational system.

Name: Anonymous 2009-11-01 2:46

I write tons of code by hand, but it is usually psuedocode.

Name: Anonymous 2009-11-01 2:55

Maybe I'm being pissed off for nothing, but srsly I find it so unnatural.. I mean when I type my code it's not line by line.. I always insert things above existing lines and ofcourse all the lines below will move down, so I'm just don't know how I will be able to write the way I do by hand.

Another question:

I really like doing mathematical programming problems like the ones on project euler. Is programming in the industry anything like that? If I enjoy finding prime numbers would I probably enjoy the stuff that you guys do?

Name: Anonymous 2009-11-01 3:30

>>1 , I took a course and the exams where similar. If you already know it, just stick it out for the credit [or audit out? is that the correct term?]

The paper nonsense kind of makes sense, it simplifies testing, and there's a physical record. There's plenty of games to be played in .edu, I don't think this is the worse. bit of a mindfuck though.

Name: Anonymous 2009-11-01 4:38

i write psuedo-code out by hand when i'm having a difficult time solving a problem.
well, actually it's real code. but it gives me an excuse to write things that don't compile

Name: Anonymous 2009-11-01 4:52

>>1
While I do all my coding on the computer, I do the system planning and design on paper.

>>7
Hand written psuedo-code is still real code. While it may not correctly follow the rules of a grammar, the point of doing it will always be to plan out the logic before committing the logic electronically.

Name: Anonymous 2009-11-01 4:54

>>8
writing something on paper makes it more correct that writing it on a computer
sage

Name: Anonymous 2009-11-01 4:58

>>9
The point is about planning without distractions, it is nothing about the magical properties of paper

Name: Anonymous 2009-11-01 5:06

You can test some ideas on paper, but you can also do that on a computer.
I think everyone prefers to write code on a computer, but it's not that hard to write imperative code on paper, but writing something like Lisp on paper could be a mess, especially for those used to structured editing.

Name: Anonymous 2009-11-01 5:41

I write code by hand when I don't have access to a computer - it's a massive mess, though.

Name: Anonymous 2009-11-01 6:10

sometimes stepping away from the computer for a moment and writing with a pen and paper gives you a new perspective on a problem.

Name: Anonymous 2009-11-01 8:26

How many spaces should I indent if I write my code on paper?

Name: Anonymous 2009-11-01 8:49

>>14
( ≖‿≖)

Name: Haxus the Forced Indenter 2009-11-01 9:04

>>14
Just use Python so you won't have to think about it.

Name: Anonymous 2009-11-01 9:11

>>16
U MENA HASKAL, so you won't have to think about it, except when indention is stupid.

Name: Anonymous 2009-11-01 9:51

>>1
Maybe because no one uses recursion in the real world.  You're aren't just writing code for you to understand, other people have to waddle through your shit and if it was me the last thing I would want to see is recursion.

Name: Anonymous 2009-11-01 9:52

>>1
Now they want me to write an exam and write my code out by hand? Is that even possible?
I guess you're just stupid. I heard the retards in my programming class complaining about this. If you find writing code on paper slightly difficult, you should just quit.

Name: Anonymous 2009-11-01 9:54

>>18
A lot of problems are much easily explained and written recursively than having to transform it into an iterative version. If someone is too stupid to understand some simple recursion, maybe they shouldn't be programming at all?

Name: Anonymous 2009-11-01 11:23

>>18,20
If seen this guy before.  He isn't use recursion to solve the problem, he is doing it to show he can.  He probably turned in his first assignment like this:

static int repeat = 0;

int main(int argc, char *argv[])
{
    if (argv != NULL)
        main ('H', NULL);
        return 0;
    else
    {
        printf ("%c", (char)argc);
        switch (argc)
        {
            case 'H: return main('e', NULL);
            case 'e': return main('l', NULL);
            case 'l':
                if (repeat == 0)
                {
                    repeat = 1;
                    return main('l', NULL);
                }
                else if (repeat == 1)
                    return main('o', NULL);
                else
                    return main('d', NULL);
            case 'o':
                if (repeat == 1)
                {
                    repeat = 2;
                    return main('  ', NULL);
                }
                else
                    return main('r', NULL);
            case '  ': return main('W', NULL);
            case 'W': return main('o', NULL);
            case 'r': return main('l', NULL);
            case 'd': return main('!', NULL);
            case '!': return 0;
        }
    }
}

Name: Anonymous 2009-11-01 11:34

>>21
It was a mistake to type that solely into the /prog/ field.

using*

#include <stdio.h>

static int repeat = 0;

int main(int argc, char *argv[])
{
    if (argv != NULL)
    {
        main ('H', NULL);
        return 0;
    }
    else
    {
        printf ("%c", (char)argc);
        switch (argc)
        {
            case 'H': return main('e', NULL);
            case 'e': return main('l', NULL);
            case 'l':
                  if (repeat == 0)
                  {
                      repeat = 1;
                      return main('l', NULL);
                  }
                  else if (repeat == 1)
                      return main('o', NULL);
                  else
                      return main('d', NULL);
            case 'o':
                  if (repeat == 1)
                  {
                      repeat = 2;
                      return main(' ', NULL);
                  }
                  else
                      return main('r', NULL);
            case ' ': return main('W', NULL);
            case 'W': return main('o', NULL);
            case 'r': return main('l', NULL);
            case 'd': return main('!', NULL);
            case '!': return main('\n', NULL);
            case '\n': return 0;
        }
    }
}

Name: Anonymous 2009-11-01 11:41

>>22
Lol'd

Name: >>20 2009-11-01 11:48

>>21
Well, that's kind of stupid. What I meant is that a lot of algorithms are easier to express recursively: traversing/searching/modifying trees/graphs, backtracking and other search algorithms. While I understand that some people like to use recursion for looping in languages supporting TCO(as shown in SICP), I'm not one to use it like that too often if the language has good iteration constructs. Bottom line is that recursion should be used when it's the most clear way to express an algorithm. Using (tail) recursion for iteration  in languages with decent iteration constructs is usually mental masturbation. Using non-tail recursive versions for iteration is even worse since you're using stack space.

tl;dr: Use whatever fits your problem best.

Name: Anonymous 2009-11-01 11:57

>>24
When GvR finally understands this, he will know why I'm disgusted at him.

Name: Anonymous 2009-11-01 12:01

>>25
I should clarify, I meant this
tl;dr: Use whatever fits your problem best.
not tail recursion for iteration

Name: Anonymous 2009-11-01 12:10

>>25
He should add TCO anyway to his language. There are enough cases where it happens that have nothing to do with using tail-recursion for iterative purposes

Name: Anonymous 2009-11-01 12:18

>>27
tail-end-recursion is NEVER the right answer.

Name: Anonymous 2009-11-01 12:22

>>28
3/10

Name: Anonymous 2009-11-01 12:38

>>22
YES, YES, YES!

Name: Anonymous 2009-11-01 12:45

>>27
Didn't the python guys say it would require too much overhaul to support (supposing Guido gave his blessing), in much the same way as I hear it's impossible for Java to support TCO

Name: Anonymous 2009-11-01 13:10

>>5
I really like doing mathematical programming problems like the ones on project euler. Is programming in the industry anything like that? If I enjoy finding prime numbers would I probably enjoy the stuff that you guys do?
It's not common, but there are fields in the industry where you do lots of algorithm-heavy work. You can probably get a relatively high salary if you're good at these things, cause most programmers aren't.

Name: Anonymous 2009-11-01 15:38

They keep taking points off my assignment and giving me comments like "recursion hasn't been covered in class yet".
I had a similar thing happen. They gave back the points after I spent some time convincing the instructor that teaching students knowledge and limiting it to that needed to pass the course is useless in the real world, unscientific, and ultimately destructive (yes, I actually used that line. He didn't get the reference so I assume he doesn't read /prog/.)

Name: Anonymous 2009-11-01 17:10

Why doesn't Java support Total Cost of Ownership?

Name: Anonymous 2009-11-01 17:15

>>34
So that Sun could cheat on their taxes and lie on their advertisements

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