Programming Philosophy
Posted: Sun May 29, 2011 7:12 pm
Anyone care to discuss?
http://www.youtube.com/watch?v=p6FSKSdhQgY
http://www.youtube.com/watch?v=p6FSKSdhQgY
The Next Generation of 2D Roleplaying Games
http://elysianshadows.com/phpBB3/
speakers @ max?short wrote:waaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay to quiet.
ismetteren wrote: You are talking a lot about that it is important to write programs in the same way computers understand them (procedural). But isn't the whole point of a compiler to be able to write code on a higher abstraction layer? I can see the conceptual beauty in your approach (then again, LISP is also conceptually beautyfull), but is there really any good reason that the way you structure your programs should be similar to the way the computer reads them? "Programs must be written for people to read, and only incidentally for machines to execute." a guy (Hal Abelson, author of a book about programs and their structure EDIT: *Hey.... that is actually that guy from those MIT lectures! http://groups.csail.mit.edu/mac/classes ... -lectures/ *) once said.
ismetteren wrote: EDIT2:
I figured that i probably should add my own "programming philosophy". It is pretty simple. I don't write my programs for school, neither for a job. I don't program to reach some specific result. I'm 17 years old, by many peoples standards I'm not even supposed to be able to program anything yet, which means that i have absolutely no standards or expectations to live up to[1]. Therefore i just do whatever i find interesting. Right now I'm learning Haskell. The 100% percent pure functional style might not be anything like how the computer actually work, and it might be limiting what i can do(at least how i can do it), but it is also very interesting and cool(It is a completely other way to think about programming, i recommend it ), so thats what I'm doing.
This philosophy(I can't help thinking that that is not the correct term?... What do i know, i'm not a native English speaker..) of mine has meant that even though I have had this interest in programming for a couple of years by now, i don't really have any finished products to show for it except knowing a lot of stuff. I'm fine with that.
Damn I want to take a physics classismetteren wrote: [1] My class mates found it über fantastic, that while doing a physics/math experiment where we threw a lot of dice(about 50), removing all the 6s and then repeated to simulate radioactive decay and then used regression to create a model, I could write a program that made the experiment with 100,000,000 dice in couple of minutes. You know, the law of large numbers and all that
Very well put, I find the first part of your philosophy especially interestingEccentricDuck wrote:I want to build robust organic software that I can picture and structure in my head, explain to others, and modify later. I want the power to create a multitude of different structures - though I don't want infinite power at the cost of infinite complexity (I can't work with infinite complexity - I wouldn't know where to begin).
To me, programming is an art and a craft; languages and computers are my tools. They are useful mostly for what I can create with them - though I also have a strong appreciation for the experience of creating. That which hinders me needlessly, or doesn't teach me anything, is probably not the best tool to be using. My tools should be contributing to my growth, or the growth of my works.
I feel the same way. To me programming is not only a art, a craft; but a form of expression the same way a musician may write a beautiful symphony or a artist may create a masterpiece.To me, programming is an art and a craft; languages and computers are my tools.
I like to think of OO as just being a wrapper around procedural calls and data, which in reality it is. For modern video games, it is almost a necessity to use some sort of OO - whether it uses functionality built-into the language or not. In the video you were talking about using template functions instead of C++'s built in inheritance, but the fact is that you are still using object inheritance - the difference being templates are static while C++'s inheritance is dynamic.Anyone care to discuss?
http://www.youtube.com/watch?v=p6FSKSdhQgY
We think similarly.bnpph wrote:I like to think of OO as just being a wrapper around procedural calls and data, which in reality it is. For modern video games, it is almost a necessity to use some sort of OO - whether it uses functionality built-into the language or not.Anyone care to discuss?
http://www.youtube.com/watch?v=p6FSKSdhQgY
Actually I was talking about how classes can be used as a interchangeable part. A function with a template argument served as the machine the part was going into. I was not trying to rule out inheritance.bnpph wrote:In the video you were talking about using template functions instead of C++'s built in inheritance, but the fact is that you are still using object inheritance - the difference being templates are static while C++'s inheritance is dynamic.
Code: Select all
//This is a little pseudo.//
class Entity
{
public:
virtual void Attack();
};
class Player : public Entity
{
public:
void Attack();
};
void Player::Attack()
{
std::cout<<"Attack the goblin!"<<std::endl;
}
class Goblin : public Entity
{
public:
void Attack();
};
void Goblin::Attack()
{
std::cout<<"Attack the player!"<<std::endl;
}
template<class What1, class What2>
void Battle( What1 Obj1, What2 Obj2 )
{
Obj1.Attack();
Obj2.Attack();
}
Player P;
Goblin G;
Battle( P, G );
Code: Select all
class Entity
{
public:
virtual void Attack();
};
class Player : public Entity
{
public:
void Attack();
};
void Player::Attack()
{
std::cout<<"Attack the goblin!"<<std::endl;
}
class Goblin : public Entity
{
public:
void Attack();
};
void Goblin::Attack()
{
std::cout<<"Attack the player!"<<std::endl;
}
class Ogre : public Entity
{
public:
void Attack();
};
void Ogre::Attack()
{
std::cout<<"Attack the player!"<<std::endl;
}
template<class What1, class What2>
void Battle( What1 Obj1, What2 Obj2 )
{
Obj1.Attack();
Obj2.Attack();
}
Player P;
Ogre O;
Battle( P , O );
Agreed.bnpph wrote: Also, it is important to keep in mind that humans are computers too, and they happen to work much better with real-world objects than meaningless data. Because of this, humans can inherently write "real world" OO code much better than bit-pushing assembly,
Exactly! Although im not sure if you agreeing or disagreeing with me?bnpph wrote: just as modern electronic computers can compile into assembly much better than they can write elegant C++ code.
I thought that looked a little funny.bnpph wrote: Oh, and I believe you meant to say et cetera in the subtitles, not excreta - which is "Waste matter, such as sweat, urine, or feces, discharged from the body."
Those two code blocks are the same.Here is basically what I was trying to say (code wise).Similarly we can doCode: Select all
//This is a little pseudo.// class Entity { public: virtual void Attack(); }; class Player : public Entity { public: void Attack(); }; void Player::Attack() { std::cout<<"Attack the goblin!"<<std::endl; } class Goblin : public Entity { public: void Attack(); }; void Goblin::Attack() { std::cout<<"Attack the player!"<<std::endl; } template<class What1, class What2> void Battle( What1 Obj1, What2 Obj2 ) { Obj1.Attack(); Obj2.Attack(); } Player P; Goblin G; Battle( P, G );
Code: Select all
class Entity { public: virtual void Attack(); }; class Player : public Entity { public: void Attack(); }; void Player::Attack() { std::cout<<"Attack the goblin!"<<std::endl; } class Goblin : public Entity { public: void Attack(); }; void Goblin::Attack() { std::cout<<"Attack the player!"<<std::endl; } class Ogre : public Entity { public: void Attack(); }; void Ogre::Attack() { std::cout<<"Attack the player!"<<std::endl; } template<class What1, class What2> void Battle( What1 Obj1, What2 Obj2 ) { Obj1.Attack(); Obj2.Attack(); } Player P; Ogre O; Battle( P , O );
I forget now. I''ll have to rewatch the video.Although im not sure if you agreeing or disagreeing with me?
LOL fucking hilarious!M_D_K wrote:this is my philosophy (and my development methodology). An addendum is "get shit done... elegantly if possible".
M_D_K wrote:this is my philosophy (and my development methodology). An addendum is "get shit done... elegantly if possible".
Second code block has a fourth class in it and is slightly different at the bottom.bnpph wrote:Those two code blocks are the same.Here is basically what I was trying to say (code wise).Similarly we can doCode: Select all
//This is a little pseudo.// class Entity { public: virtual void Attack(); }; class Player : public Entity { public: void Attack(); }; void Player::Attack() { std::cout<<"Attack the goblin!"<<std::endl; } class Goblin : public Entity { public: void Attack(); }; void Goblin::Attack() { std::cout<<"Attack the player!"<<std::endl; } template<class What1, class What2> void Battle( What1 Obj1, What2 Obj2 ) { Obj1.Attack(); Obj2.Attack(); } Player P; Goblin G; Battle( P, G );
Code: Select all
class Entity { public: virtual void Attack(); }; class Player : public Entity { public: void Attack(); }; void Player::Attack() { std::cout<<"Attack the goblin!"<<std::endl; } class Goblin : public Entity { public: void Attack(); }; void Goblin::Attack() { std::cout<<"Attack the player!"<<std::endl; } class Ogre : public Entity { public: void Attack(); }; void Ogre::Attack() { std::cout<<"Attack the player!"<<std::endl; } template<class What1, class What2> void Battle( What1 Obj1, What2 Obj2 ) { Obj1.Attack(); Obj2.Attack(); } Player P; Ogre O; Battle( P , O );
*Joke* <reference> interpreting vague answer as yes </reference>.bnpph wrote:I forget now. I''ll have to rewatch the video.Although im not sure if you agreeing or disagreeing with me?