[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Need to teach filthy casuals about classes
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /sci/ - Science & Math

Thread replies: 17
Thread images: 1
File: 1442369463727.jpg (23 KB, 500x291) Image search: [Google]
1442369463727.jpg
23 KB, 500x291
Hey /sci/
I'm a club leader for some kind of C++ programming club.
Just some basic things, nothing too hard or serious.
What should I talk about?
>>
>>7589945
Ask /g/
>>
>>7589945
I remember, when I first learnt about classes, I saw a yt video where someone was implementing a little rpg, where there are e.g. mother classes like character or item with attributes like name, gold, price, weight,... and inheritant classes like sorceress, warrior, armor, potions,... with other attriutes like stats, wichcraft, protection, healing power, etc. Made it pretty clear what a class is.
>>
>>7589945
Vector spaces, the raster space, build up into lenses and 3d engines
>>
arrays and pointers
>>
>>7589945
Fizz-Buzz
>>
>>7589945
hello world
>>
Install Gentoo
>>
We used to pose little puzzles like "write a program that writes out its own code," or "write a program that writes out the code for another program, which in turn writes out the code for the original program."

Slightly harder mode was using OS calls to compile and run the next program in the series after printing.

True hard mode was explaining to the sysadmin what we had done without looking like complete idiots.
>>
>>7589945
>I'm a club leader for some kind of C++ programming club.

So I'm assuming they already know the basics of C++ right? Some ideas:

Do a presentation on some of the new stuff in C++11 and C++14
Comparison between the new std::threads verses the old way with pthreads
Parallel/Distributed programming demonstration with MIP and OpenMP
How one does profiling, testing, debugging of real code
Crash course on source control like SVN/git
Multilingual programming (using mex to call C++ in Matlab, python <-> C++, etc)
Compiling and linking code, make, Cmake, libraries, etc
>>
proper use of goto/break
how to read/write files
how to write a memory manager
how to use pointers
>>
https://en.wikipedia.org/wiki/Liskov_substitution_principle

Seriously though, OO programming is going out of style these days. Serious people in industry are starting to do functional programming again.

Just teach your friends to never use inheritance for data (only for behavior, if ever) and always use composition (especially for data).
>>
>>7589945

Dont teach high level concepts without first teaching low level concepts.

High level concepts are abstractions used to express low level concepts with less effort.

A class does not model real world relationships. Think in terms of low level concepts. A class models a block of data members interpreted in a certain way. Maybe you want to model a real world object with a block of variables, maybe not.

First think what you want to do in low level terms.

Next write down those thoughts using high level concepts, so you dont need to write a million lines of copypasta.
>>
>>7592722

>never
>always

Rather teach them that every tool has a time and place where its the best choice, but nothing is absolute and everything depends on situation.

And dont use the term "OO programming" because everyone has a different definition for it so its pretty useless.

You have to use OO concepts to write good code. You just have to know how and where.
>>
>>7592903
>nothing is absolute and everything depends on situation

This statement has basically zero information. You might as well say nothing about anything.
>>
>>7589945

Talk about:
-How in c++ there is the principle of not paying for what you dont use/need (very important compared to other languages/communities)
-Difference between doing things at compile time/runtime (runtime vs compile time polymorphism, calculations, being able to change data/behavior at compile vs runtime, etc.)
-Lambdas (these are awesome) and how to use them as callbacks properly (=use function template with lambda type as template param, so it can be inlined, because std::function is horrible)
-How to use git to publish your code on github or just for backup purposes
-What you should optimize and what not (premature optimization)
>>
>>7592676
How can you forget boost related goodies
Thread replies: 17
Thread images: 1

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.