Author Topic: If I wanted to learn code?  (Read 14988 times)

Drauger9

  • Elite Boss
  • *****
  • Posts: 344
    • My gaming blog
If I wanted to learn code?
« on: December 22, 2013, 05:05:32 AM »
I've been thinking about this a lot since I joined the forums. I've often found myself wanting to help out in some way but I don't have any real skills to offer. So I thought maybe I could learn code?

Which could be a great benefit to not only the community but to myself as well (something to do when I get bored. LOL). So I was wondering, If I wanted to learn code which would be the best one to learn? C++, java, HTML ect...?

Which do you think would be more useful to know in the long term, say 10 years from now? Seems C++ has stuck around for awhile?

Is there a certain one that's more universal than the others? More widely used, more adaptable than others ect?

Not sure if I'd be able to offer any help in the near future but in the distant future if I did learn some code then I could.

Anyways, any suggestions would be great as always. :)

Take care. :)

ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #1 on: December 23, 2013, 04:09:51 PM »
It doesn't really matter what language you start out with, since all programming languages are fundamentally the same. Usually by the time you start on your third language, it becomes just a matter of remapping syntactic symbols and learning the libraries.

That said, there are some languages you do not want to tackle as a beginner. They can overwhelm you and introduce bad habits for years to come. I'm looking at you, C and C++. (Also, HTML is not a programming language. It's just markup.)

For a disciplined start, I recommend you start out with the ebook How to Design Programs and learn Scheme. It will teach you a lot of good habits and expose you to the elegance of Lisp early on.

After you're done with HtDP, I suggest moving on to either Java or C# to learn modern object-oriented programming. Since C# started out as a Java-clone, the two languages are almost functionally identical. C# has more bells and whistles, but you won't notice any huge difference until later on.

Once you're comfortable with Java and/or C#, you can consider getting your hands dirty with C (not C++!). You will find all the hard discipline HtDP forced you through with Scheme coming in handy at this stage.

Only after all that will I recommend learning C++.
Have you played with a KiTTY today?

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #2 on: December 23, 2013, 04:37:31 PM »
I can teach you to program, but my regimen isn't for the faint of heart. (-:

What I do is start with the basics of how a computer architecture works (in very simple terms), then proceed to the best beginner language I've ever come across... QBasic. From there, fundamental concepts are taught, then further academics proceed to C (not C++ or C#). And then, after C concepts are covered, I delve into assembly and describe the low-level functions of the machine code and CPU operations.

I very strongly believe that you can't be a good programmer without understanding what your code ultimately becomes by the time the computer gets to it. Not that you can't use abstract languages like Java or .NET, but I've seen way too many programs that were written poorly for the fact that the programmer didn't know any better. I want to make the world a better place by laying everything out in the open!

ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #3 on: December 24, 2013, 02:16:10 AM »
I don't think there's anything wrong with starting low-level, but I think it can be a bit offputting for people who grew up with GUIs and modern computers. Unless you're programming an Arduino or other microcontrollers, you're going to have a hard time making something shiny and fun by modern standards, which can be frustrating.

What I like about the HtDP curriculum is that it balances discipline with instant gratification. Despite using a dynamically-typed language, it drills a reverence for type safety into your head while teaching some pretty fundamental concepts, notably those you don't typically learn from using C-family languages (e.g. building structures with cons, tail recursion, functional programming, etc).
Have you played with a KiTTY today?

Codewalker

  • Hero of the City
  • Titan Network Admin
  • Elite Boss
  • *****
  • Posts: 2,740
  • Moar Dots!
Re: If I wanted to learn code?
« Reply #4 on: December 24, 2013, 02:43:35 AM »
The biggest problem using with languages like Lisp and Scheme for learning is that they teach you how a theoretical machine functions -- one that works NOTHING like actual computers.

Procedural first, since that's what's going on under the hood and if you don't know that you're doomed to think that O(1) is the end-all-be-all of efficiency. Then you can graduate to more advanced concepts like object oriented and functional programming, as well as theoretical concepts such as lambda calculus that are a useful mode of thinking for specific problems, but certainly not all of them.

ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #5 on: December 24, 2013, 02:38:39 PM »
Scheme is a procedural language though. It's functional-friendly, but not quite as extreme as Haskell.

I think HtDP addresses most of the bad habits self-taught hackers tend to pick up. Starting low level without learning the requisite discipline that higher-level thinking instills is IMO pretty dangerous.
Have you played with a KiTTY today?

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #6 on: December 24, 2013, 03:23:15 PM »
Would you mind elaborating on these cryptic "bad habits" you're referring to? (-:

In my experience, something low-level like C is perfect for avoiding bad habits. Strings aren't treated like a data type, the only way to pass variable references is with pointers, and you get to do your own memory allocation manually. And all of that is very close to how it all runs on the bare metal, so I definitely hold C in high regard when it comes to learning to program well.

ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #7 on: December 24, 2013, 06:12:29 PM »
With a good teacher/curriculum, bad habits can be avoided, but nonetheless...

1. Lack of universal code documentation/commenting standards.

Flower boxes? Wherever you feel like it? Everyone seems to prefer a different style.

Scheme (with HtDP) has its set of commenting conventions that force the beginner to document functions, constants, types, etc. Java has Javadoc. C# has XML documentation comments.

2. Type assumptions

C is weakly typed, and its types and typedeffed types also tend to differ from platform to platform. The compiler will also quite happily cast things silently for you. Is a plain char signed or unsigned? size_t, time_t, ptrdff_t? Can you safely assume sizeof(size_t) == sizeof(ptrdff_t) when the standard does not guarantee it? If time_t is a typedeffed long, is it only 32-bit wide and will thus break in 2038?

Should a beginner learn to worry about these things? I think so, if they're going to interact with these types, but that might be overwhelming.

3. Bit twiddling

Bit twiddling seems unavoidable to me when you use C libraries. This requires a beginner to learn and apply boolean algebra in a dry and error-prone manner. HtDP also teaches boolean algebra, but without bit twiddling. Bit twiddling in 2013 just screams premature optimization to me.

I like C and all, but IMO it's a bit much for a beginner.
Have you played with a KiTTY today?

The Fifth Horseman

  • Elite Boss
  • *****
  • Posts: 961
  • Outside known realities.
Re: If I wanted to learn code?
« Reply #8 on: December 24, 2013, 08:06:56 PM »
Something to consider is that programming demands a strong grasp of logic and at least a decent one of math.
A good imagination coupled with the ability to visualize the way your code works goes a LONG way to being a good developer.
We were heroes. We were villains. At the end of the world we all fought as one. It's what we did that defines us.
The end occurred pretty much as we predicted: all servers redlining until midnight... and then no servers to go around.

Somewhere beyond time and space, if you look hard you might find a flash of silver trailing crimson: a lone lost Spartan on his way home.

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #9 on: December 24, 2013, 08:29:46 PM »

Drauger9

  • Elite Boss
  • *****
  • Posts: 344
    • My gaming blog
Re: If I wanted to learn code?
« Reply #10 on: December 25, 2013, 06:25:29 AM »
Thanks for the replies everyone.

Robokitty, I've saved that Ebook and I'll look at it with in the next couple of days.

GuyPerfect, I've actually messed with Qbasic but that was around 1997ish? So it's been awhile LOL! I had a how to book that I made it about half way threw in my teenage years. Then summer, friends and parties happened. LOL! So I didn't get beyond that. :P

Thanks for offering to teach me but my schedual is so chaotic I couldn't dedicate anything more that what little free time I have here and there to it right now..... and I'm scared you might break me :P

The Fifth Horseman. I'm decent at math and modest at logic LOL! I'm not going to lie I'm alittle slow when it comes to learning new things but when I get it. I really get it and tend to be very good at it once I've grasped it.  It's the dedication that I'm weighing now. Is it something that I'd really stick with? Seems like it could be a huge undertaking just to learn the basics. So I'll read the Ebook mentioned, poke around some more and see if I can snag some cheap used books off Amazon. LOL!

Ty again and take care. :)

ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #11 on: December 25, 2013, 06:52:46 AM »
The following is my two cents; I don't mean to be contradictory. (-:

Not at all. I like the discussion. ;D

I'm in favor of support for willy-nilly comments, personally. Sometimes you want a comment in a place that would be awkward in all other contexts, and sometimes you don't want one where one normally would go.

I feel it's the programmer's responsibility to appropriately comment his code. Sure, everyone has their own style for doing it, but as long as the documentation is there, that's what matters. Besides, the best library designers will document their functions in entirely different places than in the source code. I can't see a compelling reason for some enforced/standardized comment setup built right into the compiler.

Well, I don't think any of the languages mentioned actually enforces a comment setup, but they do encourage a standard. I don't know if a self-taught programmer will on their own pick up good commenting and naming habits. It's too easy to give in to the temptation to name things "i" and "j" or introduce magic numbers into code without saying what they're for, but a good standard will force you to think about every function parameter and constant you put into the code, even if the language is by itself lax about it.


By definition, you've got it backwards. A strongly-typed language prohibits operations on a value of inappropriate type. While it's true that C will automatically promote types within expressions (where applicable), it's still particularly anal when it comes to things like passing the wrong type to a function (even so far as to complain when you try to pass in a const array to a function that doesn't specify const for its argument).

This leads me to one of my minor gripes about C. You cannot cast a void * into a function pointer... but you can cast a void ** into a function pointer pointer.

Ruleslawyering has never been so ugly. As they say about C, when in doubt, add another layer of indirection.

On the other hand, there's the bitwise approach:

Code: [Select]
x = x + 3 & -4;
<snip>

This is the reason I teach C and machine code after introducing programming concepts with BASIC. Call it premature optimization if you will, but I've seen many programmers do some ludicrously inefficient things just because they weren't fully aware of the impact it would have on program execution.

I do think that's premature optimization in 2013. :o

On the other hand, I think it's a good thing to teach some manual memory management, if only to demonstrate the techniques that have been developed over the years to make it less bug-prone, like scope-bound resource management and reference-counting smart pointers. C isn't so great for teaching those.
Have you played with a KiTTY today?

The Fifth Horseman

  • Elite Boss
  • *****
  • Posts: 961
  • Outside known realities.
Re: If I wanted to learn code?
« Reply #12 on: December 25, 2013, 02:32:25 PM »
The Fifth Horseman. I'm decent at math and modest at logic LOL! I'm not going to lie I'm alittle slow when it comes to learning new things but when I get it. I really get it and tend to be very good at it once I've grasped it.  It's the dedication that I'm weighing now. Is it something that I'd really stick with? Seems like it could be a huge undertaking just to learn the basics.
The opposite: It's easy to get your foot in the door, but becoming competent at it takes a while.

BTW, you'll want to grab some literature on algorithms and read a bit about computational complexity. Those are two items that will come in handy no matter what language you use. (CC at least as far as recognizing the complexity class of a given part of your program - trust me that it may matter a lot)

On a side note, the 2nd edition of Numerical Recipes in C is free and might come in handy some time (certainly did for me): http://www.nrbook.com/a/bookcpdf.php
I do think that's premature optimization in 2013. :o
I do think that would depend on how often that particular operation is performed. :p
Also, some of us enjoy tuning our products for top performance. It's an addiction. :)
« Last Edit: December 25, 2013, 02:39:42 PM by The Fifth Horseman »
We were heroes. We were villains. At the end of the world we all fought as one. It's what we did that defines us.
The end occurred pretty much as we predicted: all servers redlining until midnight... and then no servers to go around.

Somewhere beyond time and space, if you look hard you might find a flash of silver trailing crimson: a lone lost Spartan on his way home.

therain93

  • Elite Boss
  • *****
  • Posts: 574
Re: If I wanted to learn code?
« Reply #13 on: December 25, 2013, 02:38:50 PM »
My own 2 cents as a non-professional programmer with a CS background who has to work with programmers in different situations -- there's no such thing as learning optimization prematurely.  Sloppy, brute force coding is simply awful to review and modify, and lack of efficiency stacks up -- I see it frequently from some of the old-school mainframe guys who self-taught themselves to stay "relevant".
 
And, from the way your conversation has evolved, I think you all have collectively proven the point that (generally speaking) better coders come from having good mentors who can push back and advise on proper conventions and efficiencies that someone teaching him/herself just won't necessarily be aware of.
@Texarkana - March 5, 2004 - December 1, 2012 -- Imageshack |-| Youtube
---------------------------------------------------------------------------------------

You don't know what it's like.... |-| Book One. Chapter one...

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #14 on: December 25, 2013, 05:25:18 PM »
This leads me to one of my minor gripes about C. You cannot cast a void * into a function pointer... but you can cast a void ** into a function pointer pointer.

Eh? This works just fine:

Code: [Select]
#include <stdio.h>

int MrFunc(int a, int b) {
    printf("I'm MrFunc with arguments %d and %d\r\n", a, b);
    return a + b;
}

int main() {
    void *MrVoid = (void *) &MrFunc;

    printf("MrVoid got %d and %d, and returned %d\r\n",
        5, 8,
        ((int (*)(int, int)) MrVoid)(5, 8)
    );

    return 0;
}

I do think that's premature optimization in 2013. :o

Really? I'd say one should use the right operator for the job if one's available. I mean, you don't use a for loop with an addition in it to perform multiplication, do you? (-:

Drauger9

  • Elite Boss
  • *****
  • Posts: 344
    • My gaming blog
Re: If I wanted to learn code?
« Reply #15 on: December 25, 2013, 06:38:59 PM »
Thanks Horseman, I saved that book into my favorites folder as well. :)

Take care. :)

ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #16 on: December 25, 2013, 06:52:41 PM »
What I mean is this:

Code: [Select]
void *someFunc();
//...
typedef int (*FuncPtr)(void);

FunctPtr fp;
fp = someFunc; //nope
*(void **)(&fp) = someFunc; //okay

//or I do a union hack and do my penance
union {
    int (*FuncPtr)(void);
    void *ptr;
} forgiveMeGcc;
_STATIC_ASSERT(sizeof(forgiveMeGcc.FuncPtr) == sizeof(forgiveMeGcc.ptr));
forgiveMeGcc.ptr = someFunc;
« Last Edit: December 25, 2013, 07:39:56 PM by ROBOKiTTY »
Have you played with a KiTTY today?

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #17 on: December 25, 2013, 07:48:35 PM »
I think I see where you're going with this. Let's take a look...

Code: [Select]
void *someFunc();
someFunc() is a function that returns a value of type void *. This is a function that returns a pointer.

Code: [Select]
typedef int (*FuncPtr)(void);
FuncPtr fp;

This is a type declared as FuncPtr that serves as a function pointer for a function with prototype int (void).

Variable fp is declared as such a pointer.

Code: [Select]
fp = someFunc; //nope
I'm not sure what the C spec says about attempting to evaluate functions directly by name, but I just tried it in gcc and it used the function's address. So basically, this line is the same thing as saying "fp = &someFunc;"

The reason this doesn't work is because of a type mismatch, what with C being strongly-typed and all. (-:

fp is of type int (*)(void), whereas &someFunc is of type void * (*)(void). These are incompatible types and therefore one cannot be assigned to the other.

Code: [Select]
*(void **)(&fp) = someFunc; //okay
&fp is of type int (**)(void), meaning a pointer to a function pointer. That's being cast to type void **, which is also a pointer to a pointer.

The expression is further dereferenced with that * on the far left, effectively saying "the value of fp if it were of type void *".

Since someFunc evaluates to a function pointer (again, I'm not sure if that's in the C spec), it can be assigned to a void *.

You'd have an easier time if you did this:

Code: [Select]
typedef void * (*FuncPtr)(void);
FuncPtr fp = &someFunc;

Since fp and someFunc represent the same prototype this way, the compiler won't get all indignant and ask "What's-a-matta you!?"
« Last Edit: December 25, 2013, 08:51:20 PM by GuyPerfect »

Twisted Toon

  • New Efforts # 13,000!
  • Elite Boss
  • *****
  • Posts: 830
Re: If I wanted to learn code?
« Reply #18 on: December 26, 2013, 12:38:33 AM »
It has been about 8 years since I did any programming (at college) in C. Forgive me if my eye glaze over...  :o
Hope never abandons you, you abandon it. - George Weinberg

Hope ... is not a feeling; it is something you do. - Katherine Paterson

Nobody really cares if you're miserable, so you might as well be happy. - Cynthia Nelms

Second Chances

  • Minion
  • **
  • Posts: 34
Re: If I wanted to learn code?
« Reply #19 on: December 26, 2013, 01:41:52 AM »
Meanwhile, I have found it very interesting. Two of my kids are getting into programming, so I have been pondering if there is some guidance I can give them. I got into programming in a pretty idiosyncratic way back in the 80's, so duplicating my journey would be weird... hearing the various perspectives here is handy.

ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #20 on: December 26, 2013, 02:43:07 AM »
yeah, putting just the function name there is valid. The standard guarantees that it's converted to the address of the function.

The conversion problem I'm referring to is casting between data pointers and function pointers, which the standard doesn't allow because the sizes of data pointers and function pointers differ on some platforms. Occasionally though, it's necessary to do such a cast where there is no difference, hence the circuitous/union hack.
Have you played with a KiTTY today?

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #21 on: December 26, 2013, 02:56:17 AM »
The conversion problem I'm referring to is casting between data pointers and function pointers, which the standard doesn't allow because the sizes of data pointers and function pointers differ on some platforms.

So my example of doing just that doesn't exist? (-:

I can't speak for the C spec, which uses the word "undefined" nearly as frequently as the letter E, but every pointer I've ever seen in the history of ever has been the same size as the memory bus width on the target architecture (by definition, based on how pointers are processed by machine code). And since functions and variables alike come in through the same nozzle--to the point where you can build and run program code in RAM--I'm going to have to say that it's universally the case that function pointers and data pointers are always the same size.

A bold assertion, perhaps, but I welcome a contradicting example. (-:
« Last Edit: December 26, 2013, 03:02:21 AM by GuyPerfect »

Blondeshell

  • Elite Boss
  • *****
  • Posts: 808
Re: If I wanted to learn code?
« Reply #22 on: December 26, 2013, 03:38:47 AM »
It has been about 8 years since I did any programming (at college) in C. Forgive me if my eye glaze over...  :o

I'm in the same boat. The last real programming I did was in high school using COBOL in the late 80s.

Carnildo

  • Lieutenant
  • ***
  • Posts: 72
Re: If I wanted to learn code?
« Reply #23 on: December 26, 2013, 06:19:50 AM »
I can't speak for the C spec, which uses the word "undefined" nearly as frequently as the letter E, but every pointer I've ever seen in the history of ever has been the same size as the memory bus width on the target architecture (by definition, based on how pointers are processed by machine code).

That's because you've never programmed on a pure Harvard Architecture machine, and have probably never programmed an x86 running in real mode using the "medium" or "compact" memory models.  Yes, modern systems almost universally use a unified flat memory setup, but back when C was being standardized, handling these systems was a real concern.

Twisted Toon

  • New Efforts # 13,000!
  • Elite Boss
  • *****
  • Posts: 830
Re: If I wanted to learn code?
« Reply #24 on: December 26, 2013, 06:53:04 AM »
I'm in the same boat. The last real programming I did was in high school using COBOL in the late 80s.
I took Basic A and Pascal in high school (late 80s). Then Qbasic in Community college a few years later. Then when I went to "university" (University of Pheonix) in early 2002, I took C, and Java. I understand all the basics to programming, I just don't really have the creativity to do what the game programmers do. I can do simple stuff though.
Hope never abandons you, you abandon it. - George Weinberg

Hope ... is not a feeling; it is something you do. - Katherine Paterson

Nobody really cares if you're miserable, so you might as well be happy. - Cynthia Nelms

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #25 on: December 26, 2013, 03:20:52 PM »
Yes, modern systems almost universally use a unified flat memory setup, but back when C was being standardized, handling these systems was a real concern.

What impact did that have on the relative sizes of function pointers and non-function pointers?

ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #26 on: December 26, 2013, 04:08:57 PM »
issa Carnildo~
Have you played with a KiTTY today?

Zombie Man

  • Elite Boss
  • *****
  • Posts: 296
Re: If I wanted to learn code?
« Reply #27 on: December 29, 2013, 06:24:30 AM »
As a result of this thread, I've reclassified coding language as a religion along side Enterprise Captain and OS.

 :P

Carnildo

  • Lieutenant
  • ***
  • Posts: 72
Re: If I wanted to learn code?
« Reply #28 on: December 29, 2013, 09:29:08 AM »
What impact did that have on the relative sizes of function pointers and non-function pointers?
On a Harvard architecture system, there's no relation between function pointers and data pointers -- they don't even refer to the same hardware.  With x86 real mode, the memory models in question would have function pointers of 16 bits and data pointers of 32 (sort of -- 16-bit pointers use the default segment for their type, while 32-bit pointers contain both a segment and offset; both types of pointer access memory using a 20-bit address bus), or vice-versa.

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #29 on: December 29, 2013, 03:03:39 PM »
As a result of this thread, I've reclassified coding language as a religion along side Enterprise Captain and OS.

C the way. C the future.


ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #30 on: December 29, 2013, 05:26:02 PM »
My favourite programming languages, objectively speaking, are C# and Xtend. C# would be near perfect if it weren't owned by Microsoft, and Xtend if it weren't constrained by the limits of Java.

Subjectively, LOLCODE KiTTYDialect and Lisp are the best languages evar.
Have you played with a KiTTY today?

thunderforce

  • Elite Boss
  • *****
  • Posts: 264
Re: If I wanted to learn code?
« Reply #31 on: January 07, 2014, 11:20:50 AM »
Which could be a great benefit to not only the community but to myself as well (something to do when I get bored. LOL). So I was wondering, If I wanted to learn code which would be the best one to learn? C++, java, HTML ect...?

Learn a programming language that is suitable for scratching an itch that you want to scratch.

Unless you are astonishingly disciplined, you won't learn much without a motivation or project in mind.

For example, if you are enough of a fan of some existing free software project to want to improve it, learn the language that one is written in. I once had a need to slurp in a lot of automatically generated text and process it, so I became a Perl programmer. And so forth.

Heroette

  • Elite Boss
  • *****
  • Posts: 319
  • Penelope Pistol lives forever in my heart.
Re: If I wanted to learn code?
« Reply #32 on: January 07, 2014, 08:39:21 PM »
Hmmm, about 1/3 page down on the first page, I knew that I did not want to learn code at all.  I will let all those who like that stuff to do it.  I just want my computer to work when I turn it on.

Arcana

  • Sultaness of Stats
  • Elite Boss
  • *****
  • Posts: 3,672
Re: If I wanted to learn code?
« Reply #33 on: January 11, 2014, 01:50:43 AM »
On a Harvard architecture system, there's no relation between function pointers and data pointers -- they don't even refer to the same hardware.  With x86 real mode, the memory models in question would have function pointers of 16 bits and data pointers of 32 (sort of -- 16-bit pointers use the default segment for their type, while 32-bit pointers contain both a segment and offset; both types of pointer access memory using a 20-bit address bus), or vice-versa.
Boy, get hit by a car, miss an entire C gospel.

Just to stick my own two thousandths of a Bitcoin in, the "medium" model used near pointers for data and far pointers for code, while the "compact" model used far pointers for data and near pointers for code.  So in the medium model function pointers were larger than data pointers (more precisely, function pointers had a larger range) while in the compact model it was vice versa.

By standard, C allows you to attempt to cast between them but doesn't guarantee they have the same range, because of things like Harvard or x86-style segment/offset memory (mis)management.  But POSIX implicitly requires function and data pointers have the same size because of its casting rules, so any C program on a POSIX-compliant platform will never see different sized function and data pointers.

As to learning to code, for me it depends on why you're learning.  Learning for fun?  Learn a scripting language like python.  Learning because you're thinking of making programming a significant component of your profession?  Learn C.  Step one: buy a really thick C reference book and whenever someone tells you to switch to Java strike them in the head with it.

As to the notion that the right language teaches good programming habits?  In my experience I've found that to be about as true as the statement that buying the right goldfish teaches people to be Aquaman.

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #34 on: January 12, 2014, 01:31:29 AM »
Sounds like someone never bought the right goldfish.

Drauger9

  • Elite Boss
  • *****
  • Posts: 344
    • My gaming blog
Re: If I wanted to learn code?
« Reply #35 on: January 12, 2014, 01:57:56 AM »
Quote
Hmmm, about 1/3 page down on the first page, I knew that I did not want to learn code at all.  I will let all those who like that stuff to do it.  I just want my computer to work when I turn it on

Agreed, lol. I looked at some of the material and my head started spinning. For the ones that are good at it, your awesome. LOL! Cause I don't think I could and if I did it'd take more free time. Than I have at the moment.

Thanks again and take care. :)

dwturducken

  • Elite Boss
  • *****
  • Posts: 2,152
  • Now available in stereo
Re: If I wanted to learn code?
« Reply #36 on: January 13, 2014, 02:10:05 AM »
Having "learned programming" in two different generations, I'm of the mind that the right "starter language" is entirely subjective to the instructor or the person designing the curriculum. Where I am, it's Java, but the guy teaching that class was fortunate enough to be at the Oracle conference in 1995 (or whatever) when it was introduced. I'm not doing very well with it on my own, but my trouble mostly stems from not "getting" object oriented concepts. I did stumble across a really helpful book for standards and technique, though. There are a few, so I'll leave you to check those out for yourself, but think of them as an informal code version of a style book, like MLA or ASA. There are formal standards for each language, but, according to that instructor, they're about as rigidly followed "in the real world" as print writers adhere to their style guides.

But that's just a fellow student's perspective.

Oh, and:

    Our Program who are in Memory.
    Hello by thy Name.
    Thy Operating System come.
    Thy Commands be done at the Printer as it is on the Screen.
    Give us this day our daily Data,
    And forgive us our I/O errors
    As we forgive those whose logic circuits are faulty.
    Lead us not into frustration, and deliver us from Power Surges.
    For Thine is the Algorithm,
    The Application,
    And the Solution
    Looping forever and ever.
    Return.
I wouldn't use the word "replace," but there's no word for "take over for you and make everything better almost immediately," so we just say "replace."

ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #37 on: January 13, 2014, 07:22:03 AM »
As to the notion that the right language teaches good programming habits?  In my experience I've found that to be about as true as the statement that buying the right goldfish teaches people to be Aquaman.

You misunderstand me. My supposition is that the right curricula teach good habits. My favoured curriculum could be rewritten to use C. It would be very clunky to teach functional programming with, but it could be done with GCC.
Have you played with a KiTTY today?

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #38 on: January 14, 2014, 03:51:38 AM »
C provides ways to do object-oriented programming. I've seen a lot of people make the assumption that some languages are "procedural languages" while others are "object-oriented languages", but that's a misrepresentation of what a paradigm is. (-:

Although C doesn't implement the popular "class" approach, you can still create and manipulate objects in memory.

Arcana

  • Sultaness of Stats
  • Elite Boss
  • *****
  • Posts: 3,672
Re: If I wanted to learn code?
« Reply #39 on: January 14, 2014, 05:41:14 AM »
You misunderstand me. My supposition is that the right curricula teach good habits. My favoured curriculum could be rewritten to use C. It would be very clunky to teach functional programming with, but it could be done with GCC.
Well, you mentioned that you'd avoid C because it promotes bad habits, which is a statement about the language itself.  Its also a statement I would disagree with.

Separately, How to Design Programs appears to me, to be honest, to be Data Structures and Algorithms, Scheme edition.  It talks about how Scheme specifically implements specific data processing algorithms, and while it would be possible to convert it into C its honestly very strongly bent towards functional programming style: a conversion would effectively be a rewrite.  Its also not really genuinely a guide to designing programs per se: it focuses on the how of basic algorithms but not the why, and the why is the critical bit to turning coding into designing.

Also, not to get too deep into the delarative/imperative debate and why Lisp is the greatest language in the world, but anyone who thinks this is the perfectly normal way to create a list:

Quote
We can also make lists of numbers. As before, empty is the list without any items. Here is a list with 10 numbers:

(cons 0
  (cons 1
    (cons 2
      (cons 3
        (cons 4
          (cons 5
            (cons 6
              (cons 7
                (cons 8
                  (cons 9 empty))))))))))

Is batsh*t insane.  My final project in advanced programming in college was an expert reasoner in LISP, and today I would sooner set my own feet on fire than write anything more sophisticated than Hello World in that lunatic language or any of its offspring.  Inflicting that on beginners is a crime against humanity.

Arcana

  • Sultaness of Stats
  • Elite Boss
  • *****
  • Posts: 3,672
Re: If I wanted to learn code?
« Reply #40 on: January 14, 2014, 05:52:26 AM »
C provides ways to do object-oriented programming. I've seen a lot of people make the assumption that some languages are "procedural languages" while others are "object-oriented languages", but that's a misrepresentation of what a paradigm is. (-:

Although C doesn't implement the popular "class" approach, you can still create and manipulate objects in memory.
Technically speaking, the ability to manipulate object-like data like C structs only make a language "object based" or really "supports objects."  "Object oriented" normally refers to languages that support some means of class-like inheritance and associative methods or message passing.  And to be honest I still consider ObjC to be more in keeping with the original spirit of object-oriented programming than C++ (and really the only reason that debate died out is C++ became the VHS to ObjC's Betamax).

You can recreate the paradigm in C, just like you can recreate anything in assembly, but it is fair to say some languages are designed to directly support certain paradigms.  There's no question that Scheme and COBOL and RPG support three different programming paradigms.  C doesn't really "support" any one programming paradigm strongly in my opinion, but it tends to be considered procedural by default, because it doesn't directly implement the restrictions that functional programming demands.  Modern CPUs are basically imperative systems intrinsically (except for that crazy LISP system, assuming anyone still runs it).

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #41 on: January 14, 2014, 05:29:58 PM »
"Object oriented" normally refers to languages that support some means of class-like inheritance and associative methods or message passing.

That's the part I take issue with. The "class" approach so nicely couples the ideas of objects and the code that processes them, that people started to talk about the object-oriented technique as though the class is the only context in which it's even possible. And that's certainly not the case.

Back in the days when Microsoft was trying to make ActiveX a thing, they introduced what they (true to form) called the bland and overly-technical name of Component Object Model, which was only intended to be used by languages (primarily C++) that intrinsically support object↔code mechanisms. DirectX is built on COM, and I've had the pleasure of working with DirectX through C in one project. I may have been a pioneer in the field, since using DirectX in C is something that, as far as Google would have me believe, is not possible. (-:

What's the point? Well, the way the COM actually works, and what code gets produced by C++ compilers, is that whenever you say "interface->method(args)", it winds up becoming "method(interface, args)". It's exactly the same thing as passing a struct reference in vanilla C, which is exactly how I implemented those interfaces in C.

DirectX is decidedly object-oriented, and you can do it in C. C doesn't support interfaces or classes, yet it can still use DirectX. Therefore, object-oriented programming isn't about interfaces and classes. (-:

Arcana

  • Sultaness of Stats
  • Elite Boss
  • *****
  • Posts: 3,672
Re: If I wanted to learn code?
« Reply #42 on: January 14, 2014, 06:02:05 PM »
That's the part I take issue with. The "class" approach so nicely couples the ideas of objects and the code that processes them, that people started to talk about the object-oriented technique as though the class is the only context in which it's even possible. And that's certainly not the case.
Well, that's certainly true, although what people call a "class" isn't uniformly the same thing either.  The class terminology is so ingrained that there's a tendency to refer to any new object implementation as classes simply for conformity, which blurs this distinction quite a bit.

Quote
DirectX is decidedly object-oriented, and you can do it in C. C doesn't support interfaces or classes, yet it can still use DirectX. Therefore, object-oriented programming isn't about interfaces and classes. (-:
Waitaminute.  That doesn't logically follow to me.  Being able to *call* libraries that implement object-oriented programming methodologies from a language doesn't seem to me to be sufficient to describe the language itself as supporting object oriented programming, because the object-oriented stuff isn't being constructed strictly speaking with the language itself.  There's a difference between generating object-oriented behavior with code, and the language itself directly supporting such behaviors. 

I do agree in this sense.  Can you, the programmer, use object-oriented techniques with C?  Absolutely, that's not in dispute I don't think.  So if you mean object oriented programming doesn't absolutely require using an object oriented language, I think that's true.  But is C itself an object-oriented language, I'd say no, because the language itself doesn't directly support the primitives necessary to support that style of programming.  You can implement them yourself in your code, or interface to external libraries or systems that themselves support it, but that's not the same thing as the language itself supporting you. 

ObjC is definitely object-oriented, and its effectively written entirely in C.  Moreover, the language itself is a strict extension of vanilla C.  So of course anyone starting from vanilla C could implement and then use all the object oriented syntax of ObjC.  But I don't consider that a case of C supporting object oriented programming, I consider that a case of C being capable of implementing almost anything at a low level.

ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #43 on: January 15, 2014, 02:15:04 AM »
Also, not to get too deep into the delarative/imperative debate and why Lisp is the greatest language in the world, but anyone who thinks this is the perfectly normal way to create a list:

Is batsh*t insane.  My final project in advanced programming in college was an expert reasoner in LISP, and today I would sooner set my own feet on fire than write anything more sophisticated than Hello World in that lunatic language or any of its offspring.  Inflicting that on beginners is a crime against humanity.

I used to think that way about Lisp, too, and then I had a mentor who truly opened my eyes to the wonders of Lisp. It was a wonder-filled moment of awe and feelings of oneness with the universe. And why would you build a list like that and not defining a recursive function to tell the list to build itself? Using that as an example of ugly Lisp code would be like me saying the following is characteristic of C:

Code: [Select]
/* build an array of size 10 and set every element to 1 */
int *array = (int *) malloc(10 * sizeof(int));
/* OMG, look at how ugly C is!! O.O */
array ? array[0]
= array[1]
= array[2]
= array[3]
= array[4]
= array[5]
= array[6]
= array[7]
= array[8]
= array[9]
= 1
: (void) 0;
free(array);

To convert HtDP to C, you only need to add an extra chapter or two to talk about pointers and their management. GCC provides a lot of support for functional programming, and with nested functions, lambdas are just one macro away.

And on OOP, Lua is an excellent example of a non-object-oriented language that is nevertheless incredibly easy to do OOP with.
« Last Edit: January 15, 2014, 02:54:57 AM by ROBOKiTTY »
Have you played with a KiTTY today?

Arcana

  • Sultaness of Stats
  • Elite Boss
  • *****
  • Posts: 3,672
Re: If I wanted to learn code?
« Reply #44 on: January 15, 2014, 05:31:17 AM »
I used to think that way about Lisp, too, and then I had a mentor who truly opened my eyes to the wonders of Lisp. It was a wonder-filled moment of awe and feelings of oneness with the universe.
It is wonderful, within its own wheelhouse.  What it does well it does spectacularly well.  But it doesn't do everything well, and in my opinion it does one thing critically bad.  People are intrinsically linear thinkers.  They can be trained to be recursize thinkers, but that takes time, skill, and lots of practice.  All LISP adherents have that "eureka" moment when they seem to suddenly see the language in a different way that makes it seem suddenly more powerful.  I've been there, and I believe that moment is not a moment of enlightenment or realization or recognition.  Its the moment when all the practice in juggling suddenly starts paying off and you can juggle.  You weren't doing anything differently yesterday, but your brain's been rewired enough to overcome the primary barriers to performing the task.  It happens to people when they learn to drive as well.  At some point the brain gets rewired to intuitively see the code/data model of LISP and the eval/recursive/functional algorithms comfortably on sight.  It can be very seductive.

But not everyone tries to reach that point, and not everyone who tries gets there.  And that creates a problem for LISP that in my opinion is ultimately insurmountable.  LISP generates unreadable code.  Its not unreadable in the sense that its messy or obfuscated.  Its that its function-follows-form code expresses itself in a way that most other people can't understand.  Its Perl written in Minoan Linear B by dolphins.  That impenetrability means LISP might be great for LISP programmers, but it will never be worth a damn for most programmers as a whole.  And if you can't share your work, your work will ultimately be strictly limited.

And in terms of teaching programming, in my opinion it makes no sense to force people to overcome the sizeable learning curve that LISP and Scheme have in an *introductory* course.  That's like forcing first year students to culinary school to learn quantum physics before they are allowed to turn on a stove.

Quote
And why would you build a list like that and not defining a recursive function to tell the list to build itself?
Don't ask me: ask the author of HtDP.  Absolutely no one *ever* uses the array example you posted in any C class, ever, not even as a joke.  I'm assuming you made it up just now.  I just quoted HtDP.  Although the text (significantly) later mentions the list operator, there exists no good reason to teach students car/cons semantics constantly *except* that its critical to Scheme/LISP - but its inconsequential of a concept ("everything is a linked list") to anyone learning just about any other language outside the LISP sphere.  That makes the statement that HtDP trivial to convert into any language very difficult to concur with.  A lot of what it teaches you would not need to or even want to teach to people learning C, and vice versa.

One really critical but often overlooked difference between languages like C and LISP-like languages is that languages like C go out of their way to emphasize the distinction between code (functions) and data.  LISP explicitly, and by design, attempts to collapse that distinction.  And that becoming comfortable with that collapse is critical, I believe, to genuinely understanding LISP.  But that makes the frame of mind necessary to "think in LISP" fundamentally mutually exclusive to the frame of mind necessary to "think in C++" say.  Any programming course that could easily flip between the two languages would be, in my opinion, automatically a bad one, or a very superficial one.

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #45 on: January 15, 2014, 05:59:29 AM »
One really critical but often overlooked difference between languages like C and LISP-like languages is that languages like C go out of their way to emphasize the distinction between code (functions) and data.  LISP explicitly, and by design, attempts to collapse that distinction.  And that becoming comfortable with that collapse is critical, I believe, to genuinely understanding LISP.

Is this along the same lines as a JavaScript variable's value being a function in and of itself? While I know the language supports that, and you cay say things like "object.method = somefunc;" to assign code as though it were data, it makes a part of me feel dirty. I keep thinking about what ultimately passes through the CPU, and it makes me huddle in the corner and rock back and forth.

ROBOKiTTY

  • Boss
  • ****
  • Posts: 183
  • KiTTYRiffic
    • KiTTYLand
Re: If I wanted to learn code?
« Reply #46 on: January 15, 2014, 06:34:20 AM »
@Arcana

I agree with parts of what you said, but I think your opinion of Lisp is still exaggeratedly and unreasonably low. I will argue though that people are naturally quite good at recursive thinking, at least as good as they are at other forms of iterative thinking. For example, a lot of common problem solving skills and algorithms are naturally recursive -- binary search, data structures, etc. On the other hand, off-by-one errors in loop conditions are notoriously common, and it can take a while for people to internalize the logic behind terminating conditions.

@GuyPerfect

Why is that so bad? First-class functions are a great time saver, and one only needs to look at anonymous inner classes in Java to appreciate them. In most high-level languages, everything that isn't a primitive value type is just a pointer. It's not as though function bodies themselves get copied into data by value.
Have you played with a KiTTY today?

Arcana

  • Sultaness of Stats
  • Elite Boss
  • *****
  • Posts: 3,672
Re: If I wanted to learn code?
« Reply #47 on: January 15, 2014, 09:43:02 AM »
Is this along the same lines as a JavaScript variable's value being a function in and of itself? While I know the language supports that, and you cay say things like "object.method = somefunc;" to assign code as though it were data, it makes a part of me feel dirty. I keep thinking about what ultimately passes through the CPU, and it makes me huddle in the corner and rock back and forth.
I think the Javascript case is more like message passing, or function pointer passing, or vector dispatch.  Lisp is a bit different.  It would take a while to explain, and I'm not the best at explaining, but I can point you to an article that might help, focused specifically on two critical aspects of LISP's self-modifying code capabilities: macros and extensible (and uniform) syntax.

Macros allow programmers to extend the LISP language syntax to make programs more efficient.  Uniform syntax is why it works in LISP in ways that cause other language's macro preprocessors to gag.

Try this: http://lists.warhead.org.uk/pipermail/iwe/2005-July/000130.html

LISP "self-modifying code" is *not* like you think about self-modifying code or data execution in other languages.  Its more correct to say that LISP itself is primarily about list processing as its core syntax, and that therefore *all* LISP programs are really semantic processing of data.

FatherXmas

  • Elite Boss
  • *****
  • Posts: 1,646
  • You think the holidays are bad for you ...
Re: If I wanted to learn code?
« Reply #48 on: January 15, 2014, 09:45:39 AM »
Some are forgetting that in it's earliest days, C++ was a pre-processor that converted C++ to C so existing compiler tool chains of your choice could be used.  The output C was ... unique to look at since it was machine generated.  Just like before that I once used a C "compiler" that generated ASM source, again assuming you already had an assembler (plus this was in the days of 64KB and floppy only systems so I'm dating myself).
Tempus unum hominem manet

Twitter - AtomicSamuraiRobot@NukeSamuraiBot

Arcana

  • Sultaness of Stats
  • Elite Boss
  • *****
  • Posts: 3,672
Re: If I wanted to learn code?
« Reply #49 on: January 15, 2014, 10:06:31 AM »
@Arcana

I agree with parts of what you said, but I think your opinion of Lisp is still exaggeratedly and unreasonably low.

I actually think LISP as a language is probably the most powerful language in terms of algorithmic expressiveness.  I'm not sure how you could possibly characterize my opinion of LISP as unreasonably low.  My criticism of the language centers on the meatbags that have to learn and master it.  In spite of every article I've written that talks about how easy it is to learn LISP, not only has that been completely contrary to my direct experience, its also been contrary to the direct experience of Planet Earth.  *Most* people who approach the language point to its difficulty in learning.  Why that's true is often debated, whether its due to poor teaching environments or pre-exposure to other languages or programmatic cultural skews, but that's irrelevant.  The primary problem with LISP is that you're unlikely to find yourself in an environment that encourages its use, and even less likely to convert a pre-existing environment to it, because its hard to teach and hard to learn purely on a statistical basis.

Its other limitations are acknowledged even by the strongest LISP evangelists: as powerful as the language is, its unlikely to outperform (in terms of programming speed) languages optimized for specific domains with extensive support libraries for same: starting from scratch you might be able to write a complex program faster in LISP than I can in python, say, starting from zero.  But if I'm not starting from zero: if we're writing glue scripts for cloud provisioning automation and I already have most of the heavy lifting done with standard libraries, you're going to lose.  That's not a knock on LISP itself, but rather a recognition that language is only part of the equation, and no amount of language superiority can overcome a sufficient advantage in other areas.  Also, if you have to integrate with other programs on a closely coupled level, using languages similar to the target environment also tend to have strong advantages LISP can't always overcome.  You're not going to write kernel modules for linux in anything but C for that reason no matter how good LISP is.

Quote
I will argue though that people are naturally quite good at recursive thinking, at least as good as they are at other forms of iterative thinking. For example, a lot of common problem solving skills and algorithms are naturally recursive -- binary search, data structures, etc. On the other hand, off-by-one errors in loop conditions are notoriously common, and it can take a while for people to internalize the logic behind terminating conditions.
Honestly, that's a bet I would take on any terms.  The number of people I've met, programmers and otherwise, that are naturally good recursive thinkers is sufficiently low that to a first order approximation the number is zero.  If people were naturally better at recursion than iteration, functional programming classes wouldn't spend so much time teaching recursion while iterative language classes spend almost no time explaining how iteration works beyond teaching the syntax to implement it.  Nobody spends days of class time teaching students to become familiar with step by step iteration.

Ironwolf

  • Stubborn as a
  • Elite Boss
  • *****
  • Posts: 1,503
Re: If I wanted to learn code?
« Reply #50 on: January 15, 2014, 03:29:39 PM »
Following this thread makes me absolutely sure there are aliens among us.

http://www.ancient-code.com/aliens-among-us/

GuyPerfect

  • Mary Poppins
  • Titan Staff
  • Elite Boss
  • ****
  • Posts: 1,740
Re: If I wanted to learn code?
« Reply #51 on: January 15, 2014, 03:46:40 PM »
Why is that so bad? First-class functions are a great time saver, and one only needs to look at anonymous inner classes in Java to appreciate them. In most high-level languages, everything that isn't a primitive value type is just a pointer. It's not as though function bodies themselves get copied into data by value.

The more abstract a language is, the more complex it necessarily becomes to compile/execute/interpret code written in that language. The CPU/core only performs one simple operation at a time, and even something as simple as variable-sized array allocation is quite involved at that level.

I'm the kind of guy who rounds up to the next nearest multiple of 4 by saying "x + 3 & -4" (-: Throw something like loose types or garbage collection at me and I go into anaphylactic shock.

Arcana

  • Sultaness of Stats
  • Elite Boss
  • *****
  • Posts: 3,672
Re: If I wanted to learn code?
« Reply #52 on: January 15, 2014, 06:36:34 PM »
The more abstract a language is, the more complex it necessarily becomes to compile/execute/interpret code written in that language. The CPU/core only performs one simple operation at a time, and even something as simple as variable-sized array allocation is quite involved at that level.

I'm the kind of guy who rounds up to the next nearest multiple of 4 by saying "x + 3 & -4" (-: Throw something like loose types or garbage collection at me and I go into anaphylactic shock.
LISP doesn't have that kind of abstractness.  Because everything is a prefix expression, there's no way to mangle LISP code in a way that makes it difficult to compile or interpret.  At least for compilers and interpreters.  Human beings are another story: because LISP supports and encourages meta-syntax, LISP code tends to be abstract in a very specific way.  In C, you tend to read source code as a bunch of functions written in C and then blocks of code also written in C that invoke those functions.  But in LISP you tend to read source code as a bunch of syntax-defining expressions and then blocks of code written in that defined syntax.  So LISP tends to be meta: as more than one person has put it, C source is the code that does the thing, but LISP code tends to be the code that writes the code that does the thing.

Neither the compilers nor the interpreters have any problem with that, because macro resolution is itself performed strictly through the rules of LISP expression evaluation.  Now, there are complexities to the runtime environment of some versions of LISP such as the allocator and GC.  But those aren't things the interpreter itself has to worry about.  The compiler sometimes does, but in exchange for having to worry about those things there are things LISP compilers don't have to worry about, like side effects or undefined behaviors.  They don't exist in LISP, which opens the door to optimizations that are much trickier or dangerous in other languages (including C).

Which is really what I ultimately don't like about LISP: its syntactic neutrality.  Because every LISP program tends to implement meta-syntax, it causes long-term headaches when it comes to readability and reusability.  I haven't done a major (>5000 lines) project in C in over a decade.  But when I had questions about ZFS, I went to the source code.  I first learned C in 1985, and I can still read it today.  What's more, I can read virtually *everyone's* C.  True, some C is prettier, some C is messier, some C is stone-cold stupid.  But its all dialects of C I can understand.  The same is true for Fortran, COBOL, RPG, Python, even shell script.  Unless its an entry into the OCCC, chances are pretty good that at a glance I can tell what the code does.  Learn once, transparent forever.

That's not true with LISP.  No matter how much LISP I wrote, it did not make me particularly good at reading other people's LISP code, because of meta-syntax.  In fact, I had trouble reading my own code after enough time had passed that I no longer had the same mindset and way of doing things.  In C, style is style.  In LISP, style is substance.  To read someone's code, you have to absorb the mindset of the person who wrote it, so that their metacode becomes transparent.  And you have to do this over and over and over again.

Its that kind of abstraction that ultimately just doesn't work for me.  I need a language I can pick up, work on, put down, come back whenever, steal code from different places, work some more, put down, forget about, and then return later as if it was yesterday.  For me, LISP is not that language.  LISP itself at its core is easy to remember and easy to read, but no one programs in LISP.  They program in their own JohnDoe language that LISP compiles for them.  And I don't have enough free space in my brain to keep a functioning LISP compiler in there for when I might need it. 

Joshex

  • [citation needed]
  • Elite Boss
  • *****
  • Posts: 1,027
    • my talk page
Re: If I wanted to learn code?
« Reply #53 on: January 16, 2014, 01:11:01 AM »
I can teach you to program, but my regimen isn't for the faint of heart. (-:

What I do is start with the basics of how a computer architecture works (in very simple terms), then proceed to the best beginner language I've ever come across... QBasic. From there, fundamental concepts are taught, then further academics proceed to C (not C++ or C#). And then, after C concepts are covered, I delve into assembly and describe the low-level functions of the machine code and CPU operations.

I very strongly believe that you can't be a good programmer without understanding what your code ultimately becomes by the time the computer gets to it. Not that you can't use abstract languages like Java or .NET, but I've seen way too many programs that were written poorly for the fact that the programmer didn't know any better. I want to make the world a better place by laying everything out in the open!

I just passed a college course on computer system arch with an 'A'. had to learn alot, it was a bit mind numbing but already I have applied a few things I learned to my coding techniques in python.
There is always another way. But it might not work exactly like you may desire.

A wise old rabbit once told me "Never give-up!, Trust your instincts!" granted the advice at the time led me on a tripped-out voyage out of an asteroid belt, but hey it was more impressive than a bunch of rocks and space monkies.

Arcana

  • Sultaness of Stats
  • Elite Boss
  • *****
  • Posts: 3,672
Re: If I wanted to learn code?
« Reply #54 on: January 16, 2014, 01:19:55 AM »
I just passed a college course on computer system arch with an 'A'. had to learn alot, it was a bit mind numbing but already I have applied a few things I learned to my coding techniques in python.
When I was in college, circa 1,000,000 BC, "Computer System Architecture" was usually "evolution of CPUs."  I think its good to know for C programmers in the sense that when you're programming in C that's usually the view out the window, so to speak.  I'm curious to hear what specific things your courseware taught that you're making good use of in your python technique.

OzonePrime

  • Elite Boss
  • *****
  • Posts: 376
  • Never Give Up! Never Surrender!
Re: If I wanted to learn code?
« Reply #55 on: January 16, 2014, 12:46:01 PM »
I can teach you to program, but my regimen isn't for the faint of heart. (-:

What I do is start with the basics of how a computer architecture works (in very simple terms), then proceed to the best beginner language I've ever come across... QBasic. From there, fundamental concepts are taught, then further academics proceed to C (not C++ or C#). And then, after C concepts are covered, I delve into assembly and describe the low-level functions of the machine code and CPU operations.


Do you use the "99c computer"?



I very strongly believe that you can't be a good programmer without understanding what your code ultimately becomes by the time the computer gets to it. Not that you can't use abstract languages like Java or .NET, but I've seen way too many programs that were written poorly for the fact that the programmer didn't know any better. I want to make the world a better place by laying everything out in the open!

Ironwolf

  • Stubborn as a
  • Elite Boss
  • *****
  • Posts: 1,503
Re: If I wanted to learn code?
« Reply #56 on: January 16, 2014, 07:32:00 PM »
Ok Codemaster I am starting using this tutorial:
http://lua.gts-stolberg.de/en/Variablen.php

I will be ordering the book http://store.feistyduck.com/products/programming-in-lua  as soon as I get home tonight.

Would it be helpful to take a course in Corona SDK? http://www.otis.edu/ce-course?crs=606&dsc=2

Can you give me any ideas as to what specific parts would be most helpful to a hypothetical emulator in the future?

Arcana

  • Sultaness of Stats
  • Elite Boss
  • *****
  • Posts: 3,672
Re: If I wanted to learn code?
« Reply #57 on: January 17, 2014, 06:43:55 AM »
Can you give me any ideas as to what specific parts would be most helpful to a hypothetical emulator in the future?
True story: Paragon was working on an embedded Lua engine in City of Heroes itself.  In fact, it was working in the I24 server build.  They were just starting to stick their toes into using it for mission scripting.

Not speaking for Codewalker, but what specifically do you mean by "helpful?"

Ironwolf

  • Stubborn as a
  • Elite Boss
  • *****
  • Posts: 1,503
Re: If I wanted to learn code?
« Reply #58 on: January 17, 2014, 11:36:01 AM »
Programming has many various parts - graphics, game control (pathing, hits and other movement) - database structure and of course many other things.

I don't imagine in a short time I can become expert at everything. If however I spend more time on the things that would be needed - in a Score effort - then I could be of more use, faster.

Codewalker

  • Hero of the City
  • Titan Network Admin
  • Elite Boss
  • *****
  • Posts: 2,740
  • Moar Dots!
Re: If I wanted to learn code?
« Reply #59 on: January 17, 2014, 02:45:26 PM »
True story: Paragon was working on an embedded Lua engine in City of Heroes itself.  In fact, it was working in the I24 server build.  They were just starting to stick their toes into using it for mission scripting.

I got to play with it a little bit on the beta server just before the shutdown. The lua integration was still pretty early and mostly only had hooks into the "old" mission script infrastructure, so what you could do with it was somewhat limited. Less limited than nothing at all, of course, but not a magic bullet that can do anything.

Lua was used by a redname after Arcana's event to grant everyone all the badges, though there are so many that it almost crashed the zone again. Using Lua I also managed to make it snow (sort of, kind of a hack by making the instant snowstorm FX play on everyone in the zone), and make NPCs say various things on a timer.

Presumably more and more hooks would have been added as time went on, adding even more ability to do cool things.

In a hyptothetical future secret server implementation, I would expect Lua to be much more fully integrated, possibly forming the backbone of the mission system itself so ALL missions would effectively be driven by Lua scripts, even if they were just a single line to call a DefeatAll() premade function.

Arcana

  • Sultaness of Stats
  • Elite Boss
  • *****
  • Posts: 3,672
Re: If I wanted to learn code?
« Reply #60 on: January 17, 2014, 05:54:26 PM »
Programming has many various parts - graphics, game control (pathing, hits and other movement) - database structure and of course many other things.

I don't imagine in a short time I can become expert at everything. If however I spend more time on the things that would be needed - in a Score effort - then I could be of more use, faster.
It sounds like you mean "what would be most helpful if I wanted to contribute to a hypothetical project to create an emulator?"  If that's the case, Lua is probably not the best place to start there in general.  But if you want to contribute, and a hypothetical project were to materialize, and you specifically wanted to work on something Lua-based within the engine itself, I would imagine the proper place to focus your attention would be on studying Lua embedding techniques and Lua/C callbacks.

Alternatively, if you're thinking about contributing to such a hypothetical project by contributing Lua scripts themselves as part of the engine content I'd suggest looking at how another game (like WoW, say) exposes its Lua engine for practice.

Ironwolf

  • Stubborn as a
  • Elite Boss
  • *****
  • Posts: 1,503
Re: If I wanted to learn code?
« Reply #61 on: January 17, 2014, 06:17:56 PM »
Thanks! I obviously will want to start at basic general scripts and work up to more heavily weighting towards those specific uses.

Now I need to just spend a few months cranking out stuff.