As I am fairly new to arduino I decided to buy a book to famiiarise
myself with the language of C++. I accidently bought a different book to what I was looking for - one based around the programming of things
like operating systems. Although it was built around a different kind of c++ programming I still kept it and have learned alot, not that it is all
transferable to arduino. That is why I wrote this. Does anyone know
if arduino supports object orieted programming?
You can do OOP in assembler if you want to, but there are languages that support OOP better than others. Arduino is programmed in C++ which supports OOP quite well.
First off, OOP is more of a programming methodology than something that requires intrinsic language support (though don't get me wrong - having such support is usually needed for successfully implementing the OOP methodology in a particular language).
The Arduino system is based off of C/C++, and since C++ is OOP, then yes "Arduino supports OOP".
With that said, you won't see many people using C++ and OOP outside of libraries with the Arduino; I am not sure why that is, but I suspect it has mostly to do with the level of most user's experience with programming, the fact that functional programming can solve 99% of problems the Arduino is used for, and the "straightforwardness" of functional programming (making it easier for beginners).
You tend to see OOP used for libraries because it provides for an easier end-user experience, plus most (all?) of the tutorials on making a library revolve around doing it in C++/OPP fashion.
There is no reason why you couldn't do the same with the rest of the system (however, setup() and loop() would have to remain functions outside of a class - but you could conceivably do everything else inside custom classes instantiated and called from those two functions); at least, I don't think there is (but I have never tried myself)...
OO is a mean, not a goal in itself. it is a better(?) way to handle the complexity of a program as it resembles the world around us to some extend. More than functional programming does. However as most Arduino applications are not very complex functional programming is adequate to handle it. And writing a good quality (reusable) class is not simple either.
I guess that most people think of a system as just one big object [ == end user perspective ]
I am not sure why that is, but I suspect it has mostly to do with the level of most user's experience with programming, the fact that functional programming can solve 99% of problems the Arduino is used for, and the "straightforwardness" of functional programming (making it easier for beginners).
Add to that the fact that one can't stray to far from the hardware when programming the Arduino and the limited resources, specially the limited RAM makes excessive use of object-oriented sometimes problematic.