Can OOP be used in Embedded C? [closed] - c++

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I'm very new to software development and really loving it.
Currently, my work involves C++ programming in an OOP implementation (basically, the guys who started the framework for the software used OOP approach in everything). I jumped in and inherited what's already there.
Hobby-wise, I would like to develop a framework also for an embedded application.
Basically programming Embedded C on a microcontroller.
Is it wise to do the framework in OOP approach also?
I was thinking it is more organized.
Thanks in advance for the answers!

I would say that it depends on your microcontroller specifications (and how many resources you have).
In my experience (as Olaf says it's a subjective opinion):
OOP approach is usually clearer, avoids some mistakes for common variables and allows other person to use the framework without a painful learning process.
However... it usually require more resources as you need to encapsulate everything and that leads into more functions.
So... it depends...

It depends on your Embedded applicaton.
In some scenarios some c++ features costlier.
for e.g. run time polymorphism. .
Hope this link helps.!
http://www.embedded.com/design/programming-languages-and-tools/4424383/A-guide-to-C--for-C-programmers

Related

Is the Go programming language replacing C++? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I have read on some blogs that Go is a better system programming language and is going to replace C/C++. I am currently learning C++. So, I was wondering whether I should continue learning C++ or move to Go?
Go is designed for reliable, fast online services. It's the recommended language of Google App Engine. It does have general feature parity with C, plus additional scalability features. Perhaps, one day, it will be adopted for embedded programming and client-side applications, but that has yet to happen.
C is used in many, many application domains. No other language approaches its breadth of use. As a first language, though, it won't help you develop good habits.
C++ is a multi-paradigm language. It supports deep, generic metaprogramming. Many users of C++ are really using "embedded domain-specific languages" (EDSLs) where a library provides functionality defined within the C++ grammar. Go does not attempt to provide this depth, which is a Pandora's box of complexity.

The suitability of procedural programs for graphical applications [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
Dear software engineers:
I am currently teaching a procedural programming unit (using the C language) to a group of Level 3 students in the UK. Here is the Unit 16 Procedural Programming specification document.
For a Distinction (higher level) task, the students must "evaluate the suitability of procedural programs for graphical applications".
It is possible to implement graphical applications using GTK and Qt, but it's also possible to create blinking text on a webpage (just because you can, it doesn't mean you should).
Many games and desktop applications are written in C++, so I suspect that object-oriented code is better for building graphical applications.
To reiterate, I need to "evaluate the suitability of procedural programs for graphical applications".
As a software engineer, how would you answer this question?
[Edit] For what it's worth, I received an excellent response to this question on Quora.
I don't think that object-oriented or procedural programs are "better", any more than writing algorithms in recursive or iterative style are "better".
Lots of wonderful code was written before object-orientation came along.
I think the styles have more to do with managing complexity. Objects are state and behavior together in a single software component. When you system maps well to objects, that style can be a good way to manage complexity. It's worked well for GUI components like windows, buttons, etc.
But it need not be the only way.
I took an intro programming class in C at Stanford University in 1996, when C++ was just starting to take hold and neither Java nor C# existed. They had students doing graphical programming using a very disciplined style that used well designed libraries and rigorous decomposition. I would defy you to find better code.
Even with object oriented programming, normally functions will eventually get called to perform some operations, and the code in those functions would be considered procedural. The main difference is how the code ended up calling those functions along with the parameters used by those functions.

Ocaml and Algorithmic Trading [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I'm completely new to the Algorithmic Trading domain. I've just completed a course that was Ocaml based, and read about Jane Street. Obviously they are a huge company with a large amount of resources, but is it feasible to use Ocaml for small time algorithmic trading?
I know that probably seems like a stupid question, but (from what i've found) there aren't any trading APIs for Ocaml. This would mean one would have to written from scratch correct?
Any insight would be greatly appreciated guys, like I said I am a complete noob to this domain.
Thanks!
I've recently noticed this package in Opam that could provide a starting point for a trading API:
"IBX is a pure OCaml implementation of the Interactive Brokers Trader Workstation API (TWS API) built on top of Jane Street's Core and Async library."
As for open source trading algorithms in general this project started recently:
http://scarcecapital.com/hft/
I think this question is probably too open-ended for the Stack Overflow environment to be useful to you. Stack Overflow is for when you have a specific problem you're trying to solve.
But being opinionated, I can't help but say that OCaml might be pretty good for algorithmic trading. The strong typing system and immutable data tend to help avoid errors while allowing you to code quickly. This, at least, is what I've found. But you'd need to plug OCaml in to your data sources and your trade execution channel, which would be extra work. Knowing nothing about this area, I don't know if there are libraries for other languages.
Most likely the folks who are actually doing this have an incentive to keep their secrets to themselves. But that would be true regardless of the language.

boost vs POCO as for learning curve and suitability for beginners (HTTP client) [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 2 years ago.
Improve this question
which library would you advise me to use? I don't know any of these libraries.
I heard, that Boost is very often used but also it's hard to code in.
So to make this question as objective as possible:
Just simply from the aspect of beginner programmer (I've coded ~1000 LOC in C++ in my life)
which library would be better to learn?
I'll be using it mainly for HTTP client.
The answer is bound to be subjective but with particular emphasis on for a beginner then I think POCO is clearly the way to go. It actually has some HTTPClient classes and once you get beyond the point of being happy that something works the code is clear enough to follow so that you can dig in and understand why it works if that is where things lead you.
POCO is well written OOP code and does not require much in the way of understanding templates and such. The classes are well integrated with one another, extensive, and the documentation more or less points you to the next (or previous) class that you need. You won't be dashing around 20 separate libs as Boost is likely to have you doing. (There is always time for that later!)

Projects for C++ Beginner/Intermediate? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
I really want to learn more about C++. I know the basics, and I know the concepts, and I have even been able to create C++ projects myself, but my problem is being able to view, fix, and add to code I haven't written myself. I have looked at some open source projects on sourceforge, etc, but many of them are so big or there are soooo many projects available until I don't know what to do.
Are there any "small or simple" projects or tasks in C++ that will allow me to extend my knowledge of C++ by use of hands on experience?
If you are already able to create own projects, I think the best way to learn how to read&change someone's code is to get job in software company. They even will pay for it :)
Creating your own client / server application using socket programming is a big and fun area in programming which you should check out.
http://subjects.ee.unsw.edu.au/tele3118/wk6_sockets.pdf
...but my problem is being able to
view, fix, and add to code I haven't
written myself.
That is tough even for experienced programmers.
A book that might help you is Code Reading: The Open Source Perspective by Diomidis Spinellis.
Read The Art of Unix Programming ( TAOUP ). Its available online, well written and has lots of case studies that represent well designed programs. You may also find some good C++ opensource software amongst those case studies.
Apart from TAOUP, take a look at Boost C++ Libraries. They provide peer reviewed source libraries that are very well documented.
Another one, I have heard is Postfix ( an Open source email server for Unix ) that is said to have well written C++ code. Though, I must admit I do not have any direct experience with it.
Hope this helps :)