Author Topic: New Years Resolutions Thread  (Read 1684 times)

BROJ

  • CC:DBT Dream Team
  • Errare Explorer (+1500)
  • *
  • Posts: 1567
    • View Profile
Re: New Years Resolutions Thread
« Reply #15 on: December 30, 2008, 07:12:04 pm »
I've read that Bjarn Stroustrup recommends not learning C before C++ as to learn C++ requires "unlearning" much of what C has.
Hmm... I'll keep that in mind.

Schala Zeal

  • Radical Dreamer (+2000)
  • *
  • Posts: 2127
  • 7th Elemental Innate, and vtuber
    • View Profile
Re: New Years Resolutions Thread
« Reply #16 on: December 30, 2008, 07:14:24 pm »
Here's some reading you could do if you'd like:

http://cprogramming.com/tutorial/c-vs-c++.html

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: New Years Resolutions Thread
« Reply #17 on: December 30, 2008, 07:35:43 pm »
D'oh! My edition of Learning Python is for Python 2.5.
 :picardno

V_Translanka

  • Interim Global Moderator
  • Arbiter (+8000)
  • *
  • Posts: 8340
  • Destroyer of Worlds
    • View Profile
    • http://www.angelfire.com/weird2/v_translanka/
Re: New Years Resolutions Thread
« Reply #18 on: December 30, 2008, 07:44:35 pm »
I've got a 4~5 year running resolution (it's actually possible that it's much longer) that I've managed to keep each consecutive year without fail...It's the only resolution I need: Don't make any resolutions. You can do it, V! I believe in you! Be strong! Keep at it!

I just do what needs to be done...

Olxlinc Twilight

  • Guest
Re: New Years Resolutions Thread
« Reply #19 on: December 30, 2008, 08:11:27 pm »
Same here, but... *doesn't finish*

Daniel Krispin

  • Guest
Re: New Years Resolutions Thread
« Reply #20 on: January 01, 2009, 01:51:55 pm »
I've got a 4~5 year running resolution (it's actually possible that it's much longer) that I've managed to keep each consecutive year without fail...It's the only resolution I need: Don't make any resolutions. You can do it, V! I believe in you! Be strong! Keep at it!

I just do what needs to be done...

V, I'm totally with you on that one.

Ramsus

  • Guest
Re: New Years Resolutions Thread
« Reply #21 on: January 01, 2009, 04:00:32 pm »
I suggest if you'll be learning Python, learn 3.0, since it is incompatible with 2.x and is the latest. Better learn something new than learn something old and have to learn it again once deprecated.

I don't mind Python but it lacks stuff like multiple inheritance, templates, typecasting... C++ is pretty much my choice.

That's because templates/generics and typecasting are only needed by strong, statically typed languages like C++. They're more like kludges than features. The right way to implement a strongly typed language is to have the compiler figure out what type everything is based on context, a feature called "type inference" and found in languages like Haskell and ML. Then you don't need kludges like templates to write generic functions and data types.

Also, Python does support multiple inheritance, albeit not in the most vigorous manner. But then, you also get better support for a variety of other paradigms like functional programming and much cooler features like list comprehensions, anonymous functions, and some support for lazy evaluation. You also get lists, hashes, strings, and tuples built into the language itself, rather than tacked on as an afterthought in a library full of leaky abstractions (i.e. the C++ string class and STL). Python's standard library is also much better for short, one-off programs and tools, since it includes so much functionality in a single, well-documented place.

Really, the only reason to love C++ is for performance reasons, which is why most serious game development is done using it. I mean, the only alternative in a lot of cases where you use C++ is using either assembly or C, and most people don't have the discipline and knowledge to write good, manageable C code.

But as always, it's more personal preference than anything when you write your own code. I've written web applications in C.

Hmm... Suppose I have a few:
- Get somewhat good at Chess
- Start learning C and Python
- Fill my free time with more meaningful activities
- Use my abilities to do something worthwhile for others


If you learn C, also learn assembly language alongside it. That's because unlike most "high-level" languages, C doesn't do very much to abstract you away from the machine, so things like pointers and strings won't make sense unless you can break it down into assembly and understand how it works and why.

Really, C is just a portable way to write low-level code, which is nice if you want the ability to take complete advantage of the hardware you're using. A lot of libraries and APIs on Windows, Mac, and UNIX-like systems are also written in C, so you can do pretty much anything with it, but those same libraries are easy to wrap and use in pretty much any other language, to include Python. That's just one of those personal choices though. Here's a tip though: C is definitely a lot more fun if you surround yourself with good libraries and debugging tools and do a little meta-programming/code generation.

Also, if you learn C++ afterwards, don't even think of it in terms of C. Approach it as a new language.

And if you do want to learn C++ later, I suggest learning Smalltalk before learning C++. You'll learn real Object Oriented programming instead of the half-assed stuff you find in most C++ books, which will make you that much better when you learn C++, because you'll know how Object Oriented programming was really meant to be done.

Then just approach C++ as an attempt to give you Smalltalk powers in C.

As far as resources go:

  • http://c-faq.com/ - The comp.lang.c's C FAQ is one of those things you should read front to back a few times. I've probably read it a dozen times or so. It's that helpful.
  • C Unleashed - Once you have the language down, this'll teach you a thing or two about real programming concepts like abstract data types, searching, sorting, algorithmic complexity, debugging programs, digital signal processing, language parsing, etc. Basically, your first step into becoming a real intermediate C programmer.
  • The C Programming Language - I would read this last, since by then you'll be a good enough programmer to appreciate the sort of concise, simple book this is. This is more for fun than anything, but it does help you pick up more idiomatic C as it was used early on.

Sorry I don't have an actual reference for learning C, but there's nothing I know of that's well written for beginners. I can only reiterate my advice of learning C and assembly alongside each other, as otherwise you run the risk of "not getting" C even after several years of trying.

EDIT:
Some other possibly useful resource that I probably haven't seen before:

Also, I used to use this site a lot as a quick reference of handy notes when I was first learning the language.

D'oh! My edition of Learning Python is for Python 2.5.
 :picardno

The differences between Python 3.0 and 2.5 aren't so big that you can't get over them after a good day or two. Go ahead and learn Python 2.5 and then just read what changed in Python 3.0. It's more important to familiarize yourself with computer science concepts and methods than with any specific language, and that takes time.

Python 3.0 won't be the de facto version in most distributions for at least a year or two anyway.

If you're learning Python, you should also experiment with Haskell afterwards. Python has a few really powerful features found in Haskell, but most programmers are only familiar with procedural and object-oriented styles of programming, so they completely overlook them.
« Last Edit: January 02, 2009, 12:33:58 am by Ramsus »

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: New Years Resolutions Thread
« Reply #22 on: January 01, 2009, 04:06:44 pm »
Whew, I don't feel so bad now, thanks Ramsus.

Ramsus

  • Guest
Re: New Years Resolutions Thread
« Reply #23 on: January 01, 2009, 04:13:19 pm »
Just out of curiosity, what's wrong with The Python Tutorial included with the documentation? I always thought it was pretty good.

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: New Years Resolutions Thread
« Reply #24 on: January 01, 2009, 04:28:20 pm »
I guess I just like learning from books for some reason. However, now that you've shown me that, I'll use that to come up to speed on Python 3.0 whenever I have 2.5 under my belt.

Ramsus

  • Guest
Re: New Years Resolutions Thread
« Reply #25 on: January 01, 2009, 04:43:01 pm »
While you're learning the language, it's still useful to have the standard library documentation ready:

http://docs.python.org/library/index.html - Python 2.6
http://docs.python.org/3.0/library/index.html - Python 3.0

The tutorial, language reference, and library reference are all installed as Windows help files with the Windows version as well. Just check the start menu for "Python Manuals" for Python3.0. Another useful tip is to use the dir() function on objects to see what methods they contain. For example, if you want to see what all the methods of a string object are, just take any string object and dir().

Code: [Select]
>>> dir("some string")
['__add__', '__class__', '__contains__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__', '__gt__', '__hash__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '_formatter_field_name_split', '_formatter_parser', 'capitalize', 'center', 'count', 'encode', 'endswith', 'expandtabs', 'find', 'format', 'index', 'isalnum', 'isalpha', 'isdecimal', 'isdigit', 'isidentifier', 'islower', 'isnumeric', 'isprintable', 'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip', 'maketrans', 'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition', 'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate', 'upper', 'zfill']

You can also use the help() function on other functions to look up their descriptions.

Code: [Select]
>>> help(dir)
Help on built-in function dir in module builtins:

dir(...)
    dir([object]) -> list of strings
   
    If called without an argument, return the names in the current scope.
    Else, return an alphabetized list of names comprising (some of) the attributes
    of the given object, and of attributes reachable from it.
    If the object supplies a method named __dir__, it will be used; otherwise
    the default dir() logic is used and returns:
      for a module object: the module's attributes.
      for a class object:  its attributes, and recursively the attributes
        of its bases.
      for any other object: its attributes, its class's attributes, and
        recursively the attributes of its class's base classes.
« Last Edit: January 01, 2009, 04:45:25 pm by Ramsus »

FaustWolf

  • Guru of Time Emeritus
  • Arbiter (+8000)
  • *
  • Posts: 8972
  • Fan Power Advocate
    • View Profile
Re: New Years Resolutions Thread
« Reply #26 on: January 01, 2009, 05:02:37 pm »
Thanks again! It'll be awhile before I really get started though.

ZealKnight

  • Dimension Crosser (+1000)
  • *
  • Posts: 1067
  • Loyal Knight of the Kingdom of Zeal
    • View Profile
Re: New Years Resolutions Thread
« Reply #27 on: January 01, 2009, 10:11:22 pm »
New years resolution? Of course I don't have one. If I did it would mean I wasn't perfect.

Ramsus

  • Guest
Re: New Years Resolutions Thread
« Reply #28 on: January 05, 2009, 10:48:53 am »
Something else to note with learning C: There is no package system, no module system, no namespace system, no real way to organize your code provided other than the C preprocessor.

http://en.wikipedia.org/wiki/C_preprocessor

As such, it's essential to understand how it fits into the whole compiling and linking process so you can understand how to organize your code. It's also a good idea to be just as familiar with C macros as with the C code itself, as they crop up a lot in real code.

EDIT: And of course, even with C as with any other language, keep your library documentation handy. When I'm targeting Linux, I usually have this available:

http://www.gnu.org/software/libc/manual/html_node/index.html

Along with documentation for any extra libraries I might be using, and a lot of library functions also have man pages. On Windows, I guess I'd have the MSDN reference documentation for the Win32 platform SDK handy, but I only messed with the Win32 API and Windows development a handful of times.
« Last Edit: January 05, 2009, 11:14:10 am by Ramsus »

justin3009

  • Fan Project Leader
  • God of War (+3000)
  • *
  • Posts: 3296
    • View Profile
Re: New Years Resolutions Thread
« Reply #29 on: January 05, 2009, 11:01:50 am »
Quote
New years resolution? Of course I don't have one. If I did it would mean I wasn't perfect.
- I laughed IRL when reading that!

Well, My New Years Resolution is to improve on spriting and create my own style that I'm comfortable with.