Return to

I need help with my C++ program

I would not blame that on OOP. I would blame that on bad teachers or the person lacking when to use objects and when not to. I see this all the time. I am not a fan of C++ because I tend to write C with objects, so I default to C if have to choose between the two. The only time I use C++ features are when I need to do something that only Objects can do and a C+±ism makes that easier to do.

You hate it now because you don’t see the usefulness. Once you deal with real world problems, you will come to appreciate the simplicity that an Object may have compared to a purely procedural approach. Example, If you are making structs for everything and different types of structs to with associated functions to do some heavy lifting, an object and built in object functions may be the easier way.

I actually started with OOP first and once I got over the hump of “What is an Object”, I started seeing all sorts of solutions to problems. When I then learn purely procedural code, I found it difficult because I had to do a lot of data manipulation to get the data into a predictable way; objects would have made it so much easier. But now I am more of a procedural person because I like the simplicity and maintainability, but I have no hesitation to use objects when I need to.


You completely ignore Functional programming here. Those two sentences tell me that you obviously undervalue my opinions because I am more inexperienced (at least that’s the way it comes accross to me). Secondly, the first sentence tells me that you underestimate my understanding of programming concepts and competence as a programmer. I do see the usefulness of OOP, but I will always hate OOP - probably because of how much it encourages bad programming practices. Yes, there is probably a lot about the paradigm that I do not understand, but Python has really helped me understand classes and objects, and it continues to do so. I find objects to be useful, but modern OOP as a paradigm is extremely flawed in my opinion. I see its flaws as a student trying to learn it, and I see it from more experienced people all over YouTube and even in the wider internet. I understand classes and objects; and, indeed they are just as powerful as arrays, lists, or dictionaries. A functional programming paradigm makes use of objects and classes as well by the way, for classes are merely just a datatype just like any other datatype. At any rate, the main objective in programming isn’t subscribing to a particular paradigm, but it is to get the job done. In some situations, an OOP-based program is useful; yet modern OOP often perverts its usefulness into uselessness. In other cases, functional is more appropriate. Still others, a combination of the two is better. And sometimes nothing is better than nice, simple procedural (such as a bash script). OOP is a hammer, and not every programming problem is a nail; yet school (and many executatives in many organizations) seem to want to force bad coding practices on their students and engineers simply because “it’s the industry standard”. That being said, I do think that a Functional approach is more like a Swiss army knife, because it can make the tools that it needs. In the same way that using GoTo in code is bad for readability; modern OOP is bad for program readability, design, state management, and software optimization (ie, OOP causes bloat). (Please note that for me to share every single resource that I have consumed about OOP is impossible. For the first link, that is an extreme perspective to help get my point accross. The second link is a wikipedia page about a copyrighted work that I cannot rightly share on this forum. The book isn’t the only resource like it, but i feel like it is the best. Also, I guess it’s important for me to explain by what I mean by modern OOP. Really, I guess it comes down to what is discussed in Design Patterns. Namely, what you said about bad teachers and people not knowning when to use objects and when not to.)

Honestly, I think we can agree on this here. Maybe we agree on a lot of the finer details about this, but I think our conclusions are vastly different. Mine is largely negative towards OOP, and yours is largely positive towards OOP. Personally I am trying to learn as much as I can about OOP so that I can do it right when I do use it, but that is hard given how much people want to teach me bad OOP practices. Practice makes perfect… unless it is imperfect practice. It’s already a lot to take in - much less having to sort between good and bad. As for this particular program, I only care enough to get a passing grade because so much about it is fudging asinine.

I would probably go for a Functional approach in C to be honest, with structs where necessary. I don’t really know because I don’t have the luxury of choosing how to write my program in my way. The school tells me how they want it written. :roll_eyes:

There’s a lot of cases where people exaggerate and overuse features:

Here’s a random example off the the internet.

int main(int argc, char **argv)
	CC_Flasher cc_flasher;

	return cc_flasher.execute(argc, argv) ? EXIT_SUCCESS : EXIT_FAILURE;

why is this a class. Source files are a perfectly fine encapsulation mechanism already…

Same utility:

#include "common.h"
#include <boost/signals2.hpp>

class ProgressWatcher : boost::noncopyable
	typedef boost::signals2::signal<void (uint_t done_size, uint_t full_size)> OnProgress;

	void do_on_read_progress(const OnProgress::slot_type &slot);
	void do_on_write_progress(const OnProgress::slot_type &slot);

	void read_progress(uint_t done_chunk);
	void write_progress(uint_t done_chunk);

	void read_start(size_t total_size);
	void read_finish();

	void write_start(size_t total_size);
	void write_finish();

	void enable(bool enable);


	uint_t total_read_;
	uint_t total_write_;
	bool read_started_;
	bool write_started_;
	uint_t done_read_;
	uint_t done_write_;
	bool enabled_;
	OnProgress on_read_progress_;
	OnProgress on_write_progress_;

It wraps a pointer to a function that actually does the “heavy lifting” of maybe printing progress on stderr. It’s created close to main and forwarded all the way down to one relatively tight loop where it’s touched, … it can totally be replaced by a global bool report_progress that you can set from main and read as an extern from that tight loop, or if you want to be fancy replace the class with a function pointer that takes a string to maybe print and pass that in so you can do testing by looking at the progress messages.

I’ve spent a few years on a really large Go codebase, there’s been cases where I missed some of the expressivity of c++, but I was mostly grateful for the fact most features did not exist there.

There’s lots and lots of really bad code out there, but it’s not about how bad the pieces of code are, it’s about how developers can work with code together to get things working and how organizations can achieve things without writing their own progress reporter over-and-over; and keep doing useful things one after another easily. What we want is code that’s both easy to read and understand, easy to maintain, both useful and easy to change at the same time. There’s a lot of c++ out there, from my experience there’s more bad / overbuilt c++ than good, but I think on average if you compare it with c it’s not that bad.

There’s always going to be code cultivation opportunities out there - code you write as your younger self is bound to mostly look dumb to your more experienced self later on.

1 Like

How has this guy gotten so much advice when he continues to be so petulant to people that are trying to help? The dude is not worth helping with that attitude, my two cents.

1 Like

this whole thread will be used in a programming lecture one day…
if you get an assigment from the teacher, just post it in a tech forum like levelonetech and watch it gettting solved in real time.

Hey he’s doing comp sci in university and asking for advice, he’s a coding god (ahem, sorry… dragon) and his professor is an ass-hat for assigning such “stupid” material. Suggesting he re-write to understand the problem from a different angle to learn via experimentation is dumb, just hand him the solution.

Also, the entire industry who has settled on OOP like 30-35 years ago in order to solve real world issues due to finding limitations with functional programming and its ability to easily abstract and map onto real world problems are doing it wrong.

1 Like

Some of it is part rant you know. It’s called venting. Everyone does it. Secondly, I wouldn’t be so petulant if people like you wouldn’t irritate me. Plus I am sure a lot of experienced programmers have gone through the same frustration I am going though now with some of their early programs. Honestly, a lot of this program has been fun - such as making Roster::printInvalidEmails()and Roster::add(). It’s been even more fun than my personal projects in Python.

First, the username is just a username. It doesn’t mean anything except for the fact that I like programming, I like dragons (they’re my favorite mythical creature in high fantasy and if you’ll read my bio you’ll see that I am a big reader), and it sounded cool in a nerdy way when I put them together. It’s better than thro at any rate. Secondly I’ve never said anything about my professor being an ass-hat. Plus, my professor didn’t even assign the program; the university did. Besides, I’ve also used his assistance as a resource to help me figure out things in the code, and he’s told me things that you guys never told me here. Without both this thread and his help, I would be further behind than if I were just trying to figure things out on my own.

All I am going to say is that I am not the only programmer that has a problem with the industry standard of OOP. Obviously the entire industry does not fully buy into OOP, or languages like Haskell would have died a long time ago.
Edit: Also, before I ever made this thread: OOP and Functional Programming (for the sake of my sanity, only talk about Python)

Screenshot from 2021-09-08 22-48-41

Thanks everyone for your help!


Slow down high speed. I was not trying to talk down to you or under value you in any way. I was only commenting on how you profess hate towards OOP. While I may be coming from years of academic and professional experience, I was not trying to speak down to you. It really does not seem like you hate OOP, you seem to hate more of the forced use of it and the applications that you have been shown that are more or less contrived. Again, use the right tools for the job but never limit your options or pigeon hole your self. That is all that I am saying.

Also, replace everything time that I mentioned procedural programming with functional programming, if that helps. Just an additional word of advice, statements like

is not a good look. People change and so do opinions and feelings. You never know what the future holds.


sorry xD. Also, my professor saw the way that I implemented what I named, getByID(const string& studentID) and he said that it was a very procedural implementation.

By the way, there is a reason most engineers won’t just hand out the answer on a silver platter; And that is because if we do, you will not learn.

In the best case, you will take the solution offered, get your grade, and then never touch a line of code ever again, instead opting to jump into management - where you will make a poor job, until you learn what a programmer does and what actually works for producing quality code. (Hint: It isn’t SAFe)

In the worst case, you will end up at work as a clueless n00b and need to relearn all lessons you previously skipped, but now you got angry customers and/or bosses breathing down your neck.

Neither position is ideal to end up in - better that you learn it properly in school, even if it takes more time than the professor has given you. Even if it is frustrating and hard.

Then there is the issue about programming. The skill of program construction is a craft. The only way to get better, is practice, practice, practice and more practice. Just like drawing. Or playing an instrument. Or pottery. Or writing. Or any other number of crafts. Experience teaches better what works and what does not, rather than telling people what doesn’t work, it is better for them to find it out.

So yeah, there is a reason we sometimes can come off as smug, unapologetic and condescending bastards. No, we’re not giving you the info you want. We are giving you the info you need. Use that information to learn. Sometimes it is hard to give hints without giving away the answer, and yeah, communication is hard. Especially in text format, double so if it’s in a second language.

As a principle, I always try to filter my internet content with Hanlons Razor - “Never attribute to malice that which can be adequately explained by incompetence”. It really helps. :slight_smile:

I use this in the corporate world every day. That is how I am able to shrug things off and not take things personally.

Also this. If you get used to giving people the answer in the corporate world, eventually you will be responsible for doing your job and their jobs because they will just ask you instead of figuring it out. It is quicker for them, less frustrating for them. That can turn into a trend where people start to seem like your time is less valuable than theirs. That is usually not the case, but it appears that way. This leads back to the original quote.

I never wanted you guys to give me the answer, but I did need your guidance to point me in the right direction. I am really passionate about programming, and I know without a doubt that it is what I want to do. This, program, by the way shouldn’t be indicative of how I normally program. There was a lot in the directions that were confusing, and even my professor agreed. (Again, he did not create the assignment. The university did.) Another problem was how the assignment basically told me how to make the program. It was to the point of stupidity. I had to create two classes, and I had to use specified variables, and it spelled out the Roster methods that I had to create. That was super annoying and frustrating to me. I would have simply preferred the assignment to tell me what the program was supposed to do and have me implement it. I’ve had a few that were like that, and I felt rather proud of finishing them. But it didn’t say that, because the program ultimately does nothing.

Time was not a factor. I was merely frustrated by the program. The directions were terrible, so terrible in fact that my professor told me that my program was way more complicated than the assignment actually was. But that is okay because a lot of students do that simply because of how badly structured the assignment directions are. He didn’t tell me what part of my program was over-complicated, but it doesn’t really matter anymore tbh.

Yeah, I understand that programming is craft. It’s why I fell in love with it. But you know, my class is online. My band director used to say, “Perfect practice makes perfect. But if you practice wrong, then you’ll play wrong.” I needed someone to tell me what I was doing wrong, but not in a condescending way.

I agree that communication is harder in text format, and perhaps that is entirely why you guys came off as “…smug, unapologetic, and (especially) condescending bastards…”. However, I am going to strongly disagree with the part about you guys giving me the information that I need rather than the information that I want. The information that I needed was the information that I wanted. When I was finally able to get in touch with him, my professor gave me the information I needed in about 15 minutes - compared to the 12 days we spent trying to figure out why the remove function caused such an immortal bug. (Honestly, the bug is probable still hiding in there somewhere). Plus some of your answers you gave specifically were very confusing for me and more often than not you did seem very condescending. Maybe because you are experienced you don’t realize how condescending you are? Honestly, imo, the work that I do in school doesn’t matter. Ultimately, it is what I create in the real world that will matter. In the end, the American school system is all about getting that passing grade - that’s just the way it is… that’s a large reason why the US is #22 in education.

Everything before the point at which Engle pointed out a flaw in my Makefile pretty much seemed to talk about how bad my code was. I honestly didn’t care. I was simply doing what the school wanted. And also, the most helpful people were @Engle, @risk, and @Mastic_Warrior. I know you were trying to help the best way that you know how, wertigon, but often it was either a confusing mess, unhelpful rambling, or reteaching me things I already knew (i.e the difference between the pre-incremnent and post-increment operators). I didn’t even use the bit about copy and move constructors because my professor was straight up like why?

My Taekwondo instructor liked to use an expression; “The way we train is how we fight when it does matter.” Quite a bit of truth to that.

The way you presented your problem told me you had not grasped fundamental OOP concepts.
The way you presented your code with no unit tests told me this is a person with little programming skill and poor methodology, as well as no clue about proper build systems.
The way you got all defensive once flaws were pointed out told me, this person has real issues with authority as well as low self esteem.

So yes, I draw conclusions about your current skill level from that information since that is everything I have to go on at that point in time. Hence why I explained things you already knew. :slight_smile:

It’s like a foreigner arriving in Los Angeles asking where Capitol Hill is for your investment meeting with Mr. Trump (back in 2013 when he lived in NYC). Where do you even begin to explain what is wrong in that picture?

Also, don’t give me that bullshit that “This isn’t really the way I code” - it clearly is the way you code OOP, else you would not have coded it that way. Yeah, it is buggy, shitty, and poor quality. So own that code and learn to be a better developer, instead of blaming the rest of the world for what ultimately is your own shortcomings. The good news are that no one is expecting you to deliver production ready code for safety-critical functions for quite a while, so it doesn’t matter that the code is a dumpster fire.

Learn to take criticism, because all work is criticized. Learn what to do better. No need to argue with idiots like me about why you chose to do a stupid thing, just acknowledge that thing could have been done in a better way, and leave it at that. Because frankly, we already have a million reasons to be stupid, and at the end of the day results matter more than reasons.

And as a final advice, drop your guard a little. No one here thinks you are a horrible person because you wrote some crap code for an assignment - Though seriously, what’s up with the goat sacrifices in your basement? Like, that’s sooooo eighties stuff man… It’s so horrible! Today you are supposed to sacrifice Roosters man, Roosters! The higher uppers seem to really prefer a chicken based diet these days… :wink:

Depending on if you want to go into this field professionally or not, there will be shops where this is how things are done. The Architect and Senior Software/Developer Leads will dictate how you do things and then tell you to go make it happen. Sometimes, you will have to hunker down and maliciously comply because your job is to build it based off of their instructions, not how you feel it should be done. A good lead will listen to you input/criticisms and work with you to understand why they are asking for things in a certain way. If you have found something that they did not consider, then they will give you a Bravo Zulu if they are worth their weight in gold.

Be prepared for this in the real world. If you work for a shop that specializes in Agile, there are processes to mitigate this before it reached you as a task to complete in a sprint, but that is not always the case. Sometime, that is what the customer wants and you have to maliciously comply.
Also, a good skill to learn is how to break down poorly worded/complex requirements and break them down into the sum of their parts. Overall, that is what we were trying to instruct you to do, and you eventually came around once you got past the initial frustration. Being able to do this is what separates you as a developer from those that are more or less just coders.

If that (wo)man is still around, please give them a call and thank them for that word of advice. You are not wrong here, and you are not wrong for being upset about the way that the assignment was presented. But do keep in mind, that higher education has become a scam as of recent, and only the truly motivated develop the skills to adapt and over come. This is one of those situations where, you have not control and you pretty much have to adapt and over come. Cs get degrees and you really should not take this one too seriously as long as you made a passing grade. Think of this lesson in frustration as a reason for you to further develop your craft so that you can be in a position where you can prevent others from having to go through this pain. It really is unneccesary but it happens everyday.

In the US Navy and US Marine Corps, they use the term “Train how we fight and fight how we train.” It is the reason why the Department of the Navy is the best and most well rounded fighting force in the World. The US Navy is the only Department of Defence branch organization that can do the jobs of all of the other branches (Army, Air Force, Space Force, Coast Guard, Merchant Marines).

I will say this from the outside looking in. It may be that we are coming in with more experience which made our responses seem condescending. I am guilty of coming off that way, at times. I don’t think anyone really intended that, at least not at first. With that said, we could all do better on the communication front.

In general, I have learned, if someone is asking for advice/help, and you are getting frustrated in a assisting that person. Stop. Think about what is going on. Whether it is you or the person that you are trying to help that is the source of conflict, it is okay to let them know that you can no longer assist and disengage.

1 Like

My band director used to say that if you practice wrong then you will play wrong, so I will take that. However, I still say that ultimately school does not matter. We can go into it, but ultimately my strong feelings against the American College system are very political and not at all important to this thread. I continue my path through school anyway because I don’t know where else to start since no one tells you where else to start, plus there are little opportunities for programming jobs if you do not have a college degree.

I do not. But, college in America is overpriced 22nd rate education after all. Personally, I am trying to do my own stuff to try and understand it better. And honestly, I grasp it better through my personal projects in Python (not C++) than I do with anything in college. You’ve hinted at you knowing English only through a second language, so maybe you are unfamiliar with American problems concerning Higher Education; but they are immensely problematic. Many others have told me to learn by doing when I’ve explained to them my shortcomings with grasping certain programming concepts; and all of them involve OOP. And yes OOP is a terrible way to go about designing programs; so I hate OOP. Several others more experienced than me have this opinion, and I am inclined to agree with them.

I had unit tests. Maybe not as many as I should have (as I explained earlier in the tests), but I did. Also this is where you need to learn what words to use and what not to use.

I do have a problem with authority, and I can go into why if you like; but I’d rather not. That is not something I am going to be able to change (my psychiatrist says as much), but something I must work through and ultimately keep from hindering my path through life. I take that second part as a personal insult, and it solidifies my conclusion earlier on that you lack people skills.

It isn’t the way I code, because the way I code would not include OOP, so you are right in saying that it is the way I code OOP. :roll_eyes:

No you explained stuff to me like I was retarded. I do take personal offense when people treat me that way. Learn better people skills man. You cannot blame that on me, for once.

First I have no problem with criticism in my work. I wouldn’t have gotten this far in life if I did. For example, in my high school English classes, I would go to my teachers, and peers too, to have them check my essays and writing. It sucked in 9th grade, but by the time I became a senior, my teacher praised my writing as some of the best she’d ever seen - but it still received plenty of criticism. My defensiveness was not with your criticism, but your approach. If someone approaches you with an angry face, you’re gonna get defensive until you realize they are there just to talk. In the same way, I got defensive when you just attacked my code, and you still don’t realize how poor your choice of words are because you still use them. You could have explained to me what I was doing wrong, instead of saying vague statements like “Also, as a general advice I’d say you’re trying to be far too clever with every single line in your code. Less is more in this case - code for readability, not speed. Right now it’s far too messy to keep track of what is happening.” I didn’t know what I was doing wrong. I thought you were talking about something entirely different than you were, and that is why I got mad at you. It wasn’t until later on that I realized why you said that and what you were talking about. An example of you throwing insults is how you chose to describe me as, “… a person with little programming skill and poor methodology, as well as no clue about proper build systems”. That’s a seriously bad choice of words there. It is true, but you don’t insult people like that. My instant reaction is to get angry at you, and I did; but I am having to ignore that anger.

What? What does that even mean?

I was afraid of that, but I do know that the assignments won’t be as bad as the ones in college. I’ve talked to others who are more experienced than I that tell me as much, so if you contradict them; that puts me in a very confused state.

Also thank you for the rest of your post, Mastic_Warrior. (I shouldn’t comment on the rest of it as this reply is already very long). I think @wertigon should also read it as an example of how to better give criticism. He harps on me for receiving it when the criticism he’s giving me is like a person kicking a puppy across the floor when he pees on the bed, metaphorically speaking. Many, but not all, of wertigon’s criticisms are valid, so I am not “…blaming the rest of the world for what ultimately is [my] own shortcomings”, which is honestly untrue. Of course my abilities now suck, though I don’t know the extent and precisely what makes them suck (@wertigon again). I’d be a fool to think otherwise, and indeed Wendel has told me before that I should get over my “imposter syndrome”. My point is to tell you that you need to learn how to give criticism instead of telling me that I need to learn how to take it, @wertigon.

This, right here, is proof enough you got deep issues. I said, “stop arguing with idiots like me”. Who am I to you? Just some idiot jerk on the internet. What does my opinion of you matter? Not. One. Bit.

No one is expecting you to be perfect. What would be nice would be if you started owning up to your mistakes - right now you’re just playing the blame game. And when I started goofing and jokingly make insinuations about you sacrificing goats in the basement, in a clearly absurd manner, you took the bait hook, line and sinker. :slight_smile:

Not only are you vastly insecure and showing it; you also clearly don’t know when to quit, nor which fights are worth having. It’s o.k. Those things come with experience. But I’m walking away from this one now. Because it ain’t worth my time.

1 Like

And what does attacking me as insecure accomplish? I have said nothing about you as a person. Just that you need to learn to properly give criticism to people. Also your post before mine was a wall of text describing what a bad person I am. I also just noticed another interaction you had with me on another one of my threads too and I have decided that the criticisms of an opinionated prick do not matter.

Temp closed on topic starters request.
Under investigation of mod team.

I would suggest that you both @CodeDragon57 and @wertigon keep your differences away from the main topic please.
And eventually solve those in a pm with or without mod supervision.

Keep it cool thanks.