Notifications
Clear all

[Closed] Object Oriented techniques - Example 1 - "Hello Class"

302 Posts
10 Users
229 Likes
20 K Views
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@frogandtoad I think that is a big part of the issue here, the average hobbyist comes nowhere close to writing enough code for their [your project] to be motivated to learn a new language.

Sorry to disagree with you, but I have been here for a while, and recognize the members skills who join here.

I know many of the people here, and they are all different... newbies, intermediate and experienced.

We also have suitable categories for such questions (C++ for example, where BTW, these tutorials were actually posted in the first place) - Have you read the forum rules, etc...?

In my experience here, we have a great mix of individuals, and from what I can see, most of them love to learn new things - Why else are they here?

For example... why are you here?

Many people here follow along with Bill's tutorials (of course), but some are trying to learn ROS which is even harder than the C++ OOP we're discussing here... yet they struggle through it... and are willing to go through that learning process!

ROS is nothing more than an semi advanced version of MQTT, but they still want to learn the cool thing, rather than writing their own library to do the same or better, subject to user design!

Please search this forum for some of the robot code associated with Bill's initial design (you can also get Bill's code from his github page).  Note that without classes, Bill's *basic* code (and others), is already so large (1000+ lines), that he nor anyone else can complete it... I'd love to be wrong, so prove me wrong - In all these years... not one member is yet to to prove me wrong in this regard (complexity, lines of code, logic, etc...).

I look forward to your example. seeing that you deal with 10's of thousands of lines of code, let lone millions of lines of code 😉

I'll believe it when I see it!


   
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@frogandtoad The point I am trying to make and others is that while OOP may be all you say, it is really not worth my trouble to spend hundreds or more hours learning a new language for a few dozen lines of code or even a few hundred.

We're not bothered by your trouble... time continues to flow, and this forum is for everyone who wants to learn C++ and advance their skills further... if that is not for you, then as I have mentioned it before, you can choose not to participate in this thread at all, and completely ignore it.

Thanks for your input.


   
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@frogandtoad I think you are missing another point. This debate is to me at least like debating the pros and cons of a tank vs a bicycle. They can both move you through space and time but have wildly different use cases. If you don't 'get that' then we are all wasting our time. 

 LOL... I'm sure one of us is wasting their time 😉


   
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@frogandtoad I think you are missing another point. This debate is to me at least like debating the pros and cons of a tank vs a bicycle. They can both move you through space and time but have wildly different use cases. If you don't 'get that' then we are all wasting our time. 

Please do some research sir, I think it is you who is missing the point!

I don't mean to be harsh, but this is not the 50's and 60's!


   
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@binaryrhyme

Posted by: @binaryrhyme
Posted by: @zander

@frogandtoad The entire code to blink one led goes into a sub-routine then the mainline code just calls that subroutine with the applicable parameters. Each additional led is one line of code. Where OOP would have a big advantage is with overloaded operators. I could have made excellent use of that at DJ becasue formatting 5 channel paper tape is very different code than 8 bit ascii.

Heh. I illustrate things with simple examples to keep the complexity of the code down while illustrating the concepts. I guess my next example will have to illustrate something really hard to do procedurally, lol. (In the case of this example, the point is not to blink LEDs. The point is in the architecture of managed display refreshes that allows any display element to be included) ... but will ponder on a useful MCU app that gets truly mind bending to implement procedurally, lol.

@zander

How about you build us a web server in your nominated language?
I'd love to see that 😉


   
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 
Posted by: @byron
Posted by: @zander

It keeps me busy while I am having my coffee

You are drinking a lot of coffee. 

I'm not sure it's coffee!


   
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander @byron I believe that al

Posted by: @zander

@byron I believe that almost any time you write code it should be your best code. It reinforces good habits.

That is a good point... 'TRUE' or 'true'?

😉


   
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@robotbuilder I agree, this kind of thing needs it's own sub-forum and topics/threads.

As already noted, it does have its own forum... it's called C++, under components and programming, and shown on every post alongside the subject name to the right of it.

Again, you should unsubscribe from it if it really bothers you so much.


   
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 
Posted by: @frogandtoad

That is a good point... 'TRUE' or 'true'?

Neither, its 'True',  as python is a much better language (imho of course) for writing code for hobby use.

@zander, I think I remember you said you had a Raspberry Pi.  If so do you code for it in python, or do you still use C.   BTW if you have not tried python you would not need the 10 years C++ reputedly takes to become competent in python, I think a couple of weeks giving it a couple of hours a day would get you to a competent level.  Getting to a professional level would take much longer, but you wont need to go there if your not minded.  You would be writing your python based code (and using classes) to construct a neat little web server before Easter time. 😎  

But maybe we should wait for @binaryrhyme 's examples which I look forward to.

 

This post was modified 2 years ago by byron

   
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 
Posted by: @byron
Posted by: @frogandtoad

That is a good point... 'TRUE' or 'true'?

Neither, its 'True',  as python is a much better language (imho of course) for writing code for hobby use.

You are free to such an opinion, of course... but why do you take it so personally, and always refer to how you feel about it, rather than acknowledging how the collective group of members feel about it?

Aren't you letting your personal basis influence the members here?

Do you have any statistics to support your position?

In case you haven't noticed... this is not a thread about python, it.'s about C++ and OOP, in a C++ forum no less!

If you wish to start another thread about using OOP in python, then I'm sure that I and others would welcome it, and provide just as many examples to prove OOP's worth.

I await your python OOP tutorials 😉


   
byron
(@byron)
No Title
Joined: 5 years ago
Posts: 1122
 
Posted by: @frogandtoad

You are free to such an opinion, of course... but why do you take it so personally

Its not personal, just a point of view that in the context of several posts on the complexity of C++, especially for @zander and I wondered if he was using python.   Posts on threads do wander, probably much to your annoyance but no point in worrying too much about it.   It was not an attack on you and don't take it as so.  So lets say its my post was not TRUE, true or True, so I guess that makes it False. 😎 


   
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 
Posted by: @byron
Posted by: @frogandtoad

You are free to such an opinion, of course... but why do you take it so personally

Its not personal, just a point of view that in the context of several posts on the complexity of C++, especially for @zander and I wondered if he was using python.   Posts on threads do wander, probably much to your annoyance but no point in worrying too much about it.   It was not an attack on you and don't take it as so.  So lets say its my post was not TRUE, true or True, so I guess that makes it False. 😎 

Well, @zander clearly never mentioned python at all in this discussion.

I was not annoyed at all, so please do not make some misleading assumptions.

All I was getting at is that this was a C++ discussion, and shouldn't be turned into a python one.
I like python too(and five or six other languages), and if you would like to start a python OOP thread, then I will welcome that with open arms... go for it... show us what it can do 😉


   
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander

Posted by: @zander

@frogandtoad The entire code to blink one led goes into a sub-routine then the mainline code just calls that subroutine with the applicable parameters. Each additional led is one line of code. Where OOP would have a big advantage is with overloaded operators. I could have made excellent use of that at DJ becasue formatting 5 channel paper tape is very different code than 8 bit ascii.

Sorry to be pedantic and correct... but ASCII is a 7 bit code, not 8.
You must be referring to "Extended ASCII" instead, which the ISO C++ language does not recognize!

Cheers


   
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 7001
 

@frogandtoad If that happens it's a good thing, I just haven't seen it yet and could care less given I will likely write about the same amount of code in the rest of my life equivalent to what I would do in a few weeks when I was a paid codeslinger.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 
Posted by: @zander

@robotbuilder I agree, this kind of thing needs it's own sub-forum and topics/threads.

How about something like: "reminiscing and waffling" 😀


   
Page 15 / 21