I love o-o programming :-)

Member
Posts: 749
Joined: 2003.01
Post: #1
I started to write a ragdoll editor and for the first time in my life I'm feeling I wrote good code, as good as possible (for me), and it was all easy and fast (amazingly).

I got my bad programming habits from TNT basic, where you just used globals for everything and simply tidied (spelling?) things up a bit wrapping up stuff in procedures (so I could at least use local variables inside procedures).

I never understood how to write decent code in C. Well, maybe I did in theory, but it looked simply a huge effort. It looked as you always had to pass in every function tons and tons of stuff. And just how sucky are those -> ? So I just sticked to the "TNTbasic" approach, knowing my code sucked but at least I could write it fast.

I finally grasped o-o programming (I think) with blitzmax, when I forced my self to use lists of objects, and writing functions which always passed inside pointers to objects. And that important functions should have a "dedicated" object so you can pass in only that object (or few) and not many. (So then you can also use it as a method). I think functions are a good criterion to make objects. And once you have good objects using pointers is sooo powerful and easy. It's really an amazing jump from using "just variables", mind blowing to feel the power.

It's amazing how using some language or another, some feauture or other changes your point of view.

©h€ck øut µy stuƒƒ åt ragdollsoft.com
New game in development Rubber Ninjas - Mac Games Downloads
Quote this message in a reply
Member
Posts: 198
Joined: 2005.01
Post: #2
Najdorf Wrote:It's amazing how using some language or another, some feauture or other changes your point of view.

Try functional programming some time Wink

http://www.haskell.org/aboutHaskell.html

Cryptic Allusion Games / Cryptic Allusion, LLC
http://www.cagames.com/
Quote this message in a reply
Moderator
Posts: 770
Joined: 2003.04
Post: #3
Dan Potter Wrote:Try functional programming some time Wink

http://www.haskell.org/aboutHaskell.html

Um... I did my final project for my (CS) Functional Programming course using Haskell. I can only say I loathe Haskell! (Although I did get a 10, "A", or whatever it is called in English... Sneaky )

Edit: I just checked the page you linked, funnily enough, they put a sorting algorithm as an example of how "good" Haskell is. My final project was almost exclusively about implementing several sorting methods in Haskell, and I can say without a doubt that this answer in the FAQ is FALSE:
Quote:Aren't functional programs very slow?
They used to be, but the compilers have now caught up. Haskell programs run fast enough for all but the most performance-demanding applications.


(Unless "recently" means "mid-2004")
Quote this message in a reply
Member
Posts: 198
Joined: 2005.01
Post: #4
Haskell is actually amazingly cool once you wrap your head all the way around it. That said, I'm not sure I ever bothered to 100% do that either. Grin I tried writing an IRC bot in Haskell once and that was just a disaster (and I took a whole class in it).

It's relevant to the original comment though: if you get good at Haskell it can totally change the way you think about programming.

Edit to answer your edit Smile -- they actually say farther down that the Haskell version is very inefficient. But it's succinct and understandable, which is half the point of Haskell. And it's machine-parallelizable, which is about the other half.

Cryptic Allusion Games / Cryptic Allusion, LLC
http://www.cagames.com/
Quote this message in a reply
Post Reply