-
-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add exercise for pointer concept #825
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the exercise itself. In the JavaScript track it's used to show how objects can be constructed and composed, IMHO a really good exercise for that because it's simple enough for beginners but not trivial.
But here the exercise is used to showcase pointers and dynamic memory allocation. That looks rather forced. Why should the position and size be passed by pointer, why should programWindow
allocate memory dynamically? That just makes it more difficult, without (at least to me) clear benefits. I'm missing the motivation for that.
The dynamic memory allocation also adds the problem of ownership. Now the students have to write a destructor (and if they follow the rule of five also at least delete the copy constructor and copy assignment operator.)
I would really like a different exercise for this pointer concept, one where pointers (and maybe dynamic memory allocation) are a better fit.
ff24370
to
705c8dd
Compare
@siebenschlaefer @ahans |
I added a task, so students can use the & opertor. |
Hey @ErikSchierboom, do you have time to review this new exercise? I would like to move the syllabus along, but the other two maintainers seem busy. |
No description provided.