[ 3 / biz / cgl / ck / diy / fa / ic / jp / lit / sci / vr / vt ] [ index / top / reports ] [ become a patron ] [ status ]
2023-11: Warosu is now out of extended maintenance.

/sci/ - Science & Math


View post   

File: 23 KB, 500x291, 1442369463727.jpg [View same] [iqdb] [saucenao] [google]
7589945 No.7589945 [Reply] [Original]

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?

>> No.7589947

>>7589945
Ask /g/

>> No.7590022

>>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.

>> No.7590046

>>7589945
Vector spaces, the raster space, build up into lenses and 3d engines

>> No.7590648

arrays and pointers

>> No.7591221

>>7589945
Fizz-Buzz

>> No.7592591

>>7589945
hello world

>> No.7592595

Install Gentoo

>> No.7592606

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.

>> No.7592676

>>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

>> No.7592709

proper use of goto/break
how to read/write files
how to write a memory manager
how to use pointers

>> No.7592722

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).

>> No.7592893

>>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.

>> No.7592903

>>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.

>> No.7592913

>>7592903
>nothing is absolute and everything depends on situation

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

>> No.7592915

>>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)

>> No.7592971

>>7592676
How can you forget boost related goodies