Real time use of abstract, sealed and static class

2.3k views Asked by At

If I've some common functionality that I've to keep in a class, so will I go for static, sealed or abstract class...Does all these types of classes serve the purpose of keeping the common functionality together...where actually the difference lies when I've to go for one

1

There are 1 answers

7
Jeroen van Langen On

abstract, sealed, static has nothing to do with real time development. It has to do with bring structure within your software, so that the functionality implemented in classes can and should be used in the right way.


After some comments i think this:

I think you can only learn this, by doing it. There isn't a book or epub that will explain you how to do programming. They will show the syntax and some examples. It will be trial and error. Every day you'll face a new challenge. You'll have to practice it. The best advise is, look what others already created and try to imagine why did they wrote/solve it that way.

I can explain what a static/sealed/abstract class is/does, but it doesn't learn you when to use it.


Back to the question: Define 'real time'.. I think that static/abstract/sealed should NOT be decisive on how you write your 'real-time' software. If you are 'scared' about performance on this level, C# should not be your choise. I would write c++ or if you want a real challenge, try to beat the compilers with asm ;-)

I think you won't measure the 'overhead'

So, use abstract/static/sealed in a right way, so your future collega's/you can read/maintain it.

I use C# for communication (tcp/ip) between a windows computer and a PLC (with delta robots). But it's far from realtime. It's fast enough to keep many robot working with > 100 messages per second.