Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 118 119 [120] 121 122 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 902612 times)

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1785 on: February 29, 2012, 12:34:27 am »

ok, I need some schooling,  so far I've only been working in main, made programs that were thousands of lines long, but was all in main,  Recently I was talking to someone about SDL, and they linked me a tutorial they were having trouble with
It was an easy tutorial about making a star field that had random stars going random speeds, but when I downloaded the example code,  It was split among 10 different C file / header files, and I wasn't able to compile it.
what / when is the proper way / time to get out of main?  And why cant I compile this 10 file program?

Are you familiar with methods/functions/procedures?  You really do want to split your code up into methods where it's reasonable.  Splitting your code further into multiple files helps organize it.  You'll just have to tell your compiler about all of those files.  And since that's annoying, you can streamline it by writing a very basic makefile, though that isn't at all necesary.  Which tutorial are you using, again?

Does anyone have an idiot's guide to OOP? I keep reading the book and watching youtube tutorials and I just don't get it.

I don't know any off hand, but I can write one if you'd like.  What about it is giving your trouble?  Yes, it's okay to say "everything".
Logged

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1786 on: February 29, 2012, 12:59:25 am »

Everything sums it up nicely. Well, I honestly don't know if I can say that. We haven't done "everything", so I don't know if those parts will give me fits or not. Classes, I think I understand. I think. Then, we got into friends, and overloading (operations and operators,) inheritance/multi-inheritance, polymorphism and virtual functions. Now, my mind is full of fuck.
« Last Edit: February 29, 2012, 01:04:25 am by MaximumZero »
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1787 on: February 29, 2012, 01:35:26 am »

Are you having trouble with the concepts themselves, or how they're implemented in C++?
Logged

Valid_Dark

  • Bay Watcher
  • If you wont let me Dream, I wont let you sleep.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1788 on: February 29, 2012, 02:12:06 am »

Thank you guys,
I've been slacking on reading my c++ book so I'm still not at classes yet  :-[
I'll start reading it again soon, I have my next 2d project planned already.
I don't do the traditional sorts of game projects ( tetris, pong, astroids etc. )
But I try to keep all of mine really out of the box and creative.  What I make next I really think most of this forum would enjoy
if I have you lot pegged right, which I think I do.
Looking forward to getting started, but I still need to read that classes chapter first.
Logged
There are 10 types of people in this world. Those that understand binary and those that don't


Quote
My milkshake brings all the criminals to justice.

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1789 on: February 29, 2012, 02:48:43 am »

Everything sums it up nicely. Well, I honestly don't know if I can say that. We haven't done "everything", so I don't know if those parts will give me fits or not. Classes, I think I understand. I think. Then, we got into friends, and overloading (operations and operators,) inheritance/multi-inheritance, polymorphism and virtual functions. Now, my mind is full of fuck.

A good 115 pages ago, Max White did a tutorial on classes in C#.  It's worth a read for concepts.  I'll see about writing something up for you at not 2AM.  If you could answer Madoc's question, it would give the others and I a better idea what to say to you.

Thank you guys,
I've been slacking on reading my c++ book so I'm still not at classes yet  :-[
I'll start reading it again soon, I have my next 2d project planned already.
I don't do the traditional sorts of game projects ( tetris, pong, astroids etc. )
But I try to keep all of mine really out of the box and creative.  What I make next I really think most of this forum would enjoy
if I have you lot pegged right, which I think I do.
Looking forward to getting started, but I still need to read that classes chapter first.

If you have any questions on classes or anything else, be sure to ask.  If you're going for anything too complex, look into writing a makefile.  You know what...I'll probably just write a tutorial on writing makefiles...they're incredibly useful when you have more than three or four files to compile together.
Logged

dreadmullet

  • Bay Watcher
  • Inadequate Comedian
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1790 on: February 29, 2012, 03:36:38 am »

Alright, I've finished reading this entire thread.

Hi. I'm dreadmullet, adept C# programmer. I'm currently making my first roguelike using ncurses. It's going incredibly well (roguelike development is refreshingly easy), and I'll probably share some stuff about it soon.

If anyone needs help with C#, I'll try to help if I can.
Logged

Max White

  • Bay Watcher
  • Still not hollowed!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1791 on: February 29, 2012, 03:38:30 am »

Welcome! Glad to have another C# guy on board.

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1792 on: February 29, 2012, 08:49:44 am »

BURNITBURNITBURNITBURNITBURNIT!!
j/k

Anyway, I'm a 3rd and a half year CS major, and I really don't feel like I've learned that much that feels like it has worth. We've dabbled our toes in pretty much everywhere, from gates, to embedded systems, to high level languages and ADTs to networking (not in that order), and I've aced pretty much all of them, but I still feel like, for even just getting breadth in the field, we could have done a lot more--even in regards to just theory. When does it get to the point where it feels like you can do something? I mean, I have no doubt that if I put my mind to some project, I could do it, but I still feel like I'm as much of an amateur as I was before I started uni.
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #1793 on: February 29, 2012, 10:29:04 am »

To be honest you learn next to nothing at university that is useful in the industry that you wouldn't learn after a couple of weeks on the job if they just threw you in the deep end. The industry used to throw people in the deep end anyway, it's just now they make you run in circles to get a degree first. When it comes to computer science you don't go to university to learn a trade, you go to get a degree.

You do need the degree to be considered by employers, but what you actually need to know you'll learn doing an internship or work placement year. Of course programming in your spare time as a hobby helps (and I don't think you can academically teach programming effectively).

Being a form of engineering, the following applies to programming too:
"When told that work is work and spare time is not for engineering I am concerned that the candidate's world view is not really that of a successful engineer."
http://www.analog.com/en/all-operational-amplifiers-op-amps/operational-amplifiers-op-amps/products/raq_make_do_issue61/resources/faq.html
« Last Edit: February 29, 2012, 10:37:46 am by MorleyDev »
Logged

MaximumZero

  • Bay Watcher
  • Stare into the abyss.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1794 on: February 29, 2012, 11:56:14 am »

Are you having trouble with the concepts themselves, or how they're implemented in C++?
Both. I don't understand the "why" and it's obfuscating the "how".
Logged
  
Holy crap, why did I not start watching One Punch Man earlier? This is the best thing.
probably figured an autobiography wouldn't be interesting

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1795 on: February 29, 2012, 12:14:46 pm »

Quote
You do need the degree to be considered by employers

Err... nope? I've seen studies that put those with and without degrees about equal, assuming other circumstances are the same.

Only real advantage of Uni is making contacts and having an easier time getting your first job, so its a bit less risky - but spending four years actually WORKING on your own stuff, putting in the same amount of time you would at college, makes you just as employable (or more employable if you actually get a job and spend a good chunk of that time employed).
Logged

Stargrasper

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1796 on: February 29, 2012, 12:44:39 pm »

BURNITBURNITBURNITBURNITBURNIT!!
j/k

Anyway, I'm a 3rd and a half year CS major, and I really don't feel like I've learned that much that feels like it has worth. We've dabbled our toes in pretty much everywhere, from gates, to embedded systems, to high level languages and ADTs to networking (not in that order), and I've aced pretty much all of them, but I still feel like, for even just getting breadth in the field, we could have done a lot more--even in regards to just theory. When does it get to the point where it feels like you can do something? I mean, I have no doubt that if I put my mind to some project, I could do it, but I still feel like I'm as much of an amateur as I was before I started uni.

You really don't feel like you can do something until you buckle down and do it anyway.  Seriously.  That's a confidence game.  You have the skill, so just apply to something.

Are you having trouble with the concepts themselves, or how they're implemented in C++?
Both. I don't understand the "why" and it's obfuscating the "how".

Alright.  I'll see if I can cobble something together for you.
Logged

MadocComadrin

  • Bay Watcher
  • A mysterious laboratory goblin!
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1797 on: February 29, 2012, 12:49:31 pm »

Well, I can take a shot at some helpful hints.

Friend functions allow you to use private and protected members of a class outside of the scope of that class.  That is, you have a function that needs access to the parts of a class you want to keep "secret", but that function for whatever reason can't be part of the class itself (eg. you don't want it to be called from the class or an object of the class). One big example is overloading the stream insert/extract operators (<< and >>).

Before I go into that, I should make a brief touch on operator overloading. One thing to hammer into your head is that in c++, an operator is not much more than a function that has it's arguments arranged in a way that makes logical sense. Operator overloading allows you to define how those operators work with classes you design. For example, if you have a Fraction class, and you want to add two fraction objects, you could create your own function "add" and add Fractions like this: fraction1.add(fraction2); or you could overload the + operator and use fraction1 + fraction2. (Good practice is to define both and have one call the other).

So, to complete the example of both operator overloading and friend functions, let say you have a class with a private member x. You want to be able to use cout to print x without defining a "getter" function, so you use the stream insert operator. That operator often takes the form, ostreamParameter << myClassParameter, and returns an ostream. When overloading the operator, it looks like this (assuming you're using the appropriate namespaces)

Code: [Select]
class myClass
{
     public: //declare friends inside the class, even though they technically aren't part of the class.
          friend ostream& operator<<(ostream& output, const Point& p);
     private:
          int x; //this is our "secret"
};

//Because friend functions aren't part of the class, don't prepend the function name with myClass::
ostream& operator<< (ostream& out, const myClass& c)
{
     out << c.x; //now we can use the "secret'!
     return out; //we return out so we can chain them
                    //eg cout << "My secret is " << c;
}

I hope that helps a bit. I'll type of something for inheritance and polymorphism if someone else doesn't.
Logged

MorleyDev

  • Bay Watcher
  • "It is not enough for it to just work."
    • View Profile
    • MorleyDev
Re: if self.isCoder(): post() #Programming Thread
« Reply #1798 on: February 29, 2012, 01:02:42 pm »

Friend allows you to basically ignore "public, protected and private" in certain circumstances by saying specific classes or functions are allowed to ignore it. It's generally a bad idea if alternatives exist because it removes the "black box" aspects of classes, namely it pisses off the people that think classes and functions should be self-contained with anything outside of them only concerned about inputs and outputs.

Quote
Err... nope? I've seen studies that put those with and without degrees about equal, assuming other circumstances are the same.

The way someone I know from the industry put it to me is: They could vouch for me to get me a job in their company as a junior developer (I have a friend who did this for his gap year). The problem with that I'd start 'lower' and it'd be more difficult to move horizontally (so if I decided I hated programming and wanted to be a project manager at a different company, even with the experience as a developer and contacts it'd turn an already tricky move into a nightmare).

So yes, you can get in but it's significantly more difficult for equal or lesser rewards. The only reason I know that person is by shear luck in that my Computing teacher in College went on maternity leave so they hired him to work part-time in an agreement with a local development studio to act a substitute teacher.
« Last Edit: February 29, 2012, 01:14:41 pm by MorleyDev »
Logged

GlyphGryph

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #1799 on: February 29, 2012, 01:10:08 pm »

I didn't say there weren't good reasons to go to Uni instead, just disagreeing with the notion you need to. There are still plenty of places that happily take anyone who has shown they can program well, regardless of how they came about those abilities, and if you can spend those four years you didn't go to college actually working, and come out with 4 years work experience, I would argue you'd at LEAST be on equal footing with a college grad without work experience, if not better of.

(Of course, both a degree and 4 years of work experience is better, and if you WASTE your four years of working not-programming or not-learning-as-you-program, you're not gonna get much out of it. Just pointing out that's a field that still very much rewards those who prefer to engage in self-directed learning and degree-less career advancement.)
Logged
Pages: 1 ... 118 119 [120] 121 122 ... 796