Questions on OOP in MQL5 - page 24

 
Alexey Volchanskiy:

Sharp was born around 2000 and was in its infancy, but pluses ruled, so they made a bridge of C++ to dotnet for popularization. By the way, Sharp was created by Delphi and C++Builder developers, I was very surprised at that time, how many common concepts there are. Take the same properties, events.

imho, Sharp is quite a successful project from Microsoft - they not only lured people to their platform /Net, they gave all the different languages syntax for .Net - you could write it in Basic!

 
Igor Makanu:

imho, Sharpe is quite a successful project from Microsoft - not only did they lure people to their /Net platform, but they gave all the diverse language syntax for .Net - you could write it in Basic!

But I am not attracted to it. It's convenient and simple, but it lacks the drive of the pluses. You get distant from the iron.
 

I searched the forum, thanks to@fxsaber who posted many examples

add magic to the last example )))) I'm too lazy to write it by hand, I see the concept I wanted to see.

interface IStrategy
  {  void Algorithm()                 {Print("Это не должно запускаться!!!"); } };
//+------------------------------------------------------------------+
class CStrategy : public IStrategy
  {
protected:
   int               x;
  };
//+------------------------------------------------------------------+
#define  CLASS(NAME) class NAME: public CStrategy{\
public:              NAME()   {Print(__FUNCTION__);  x = 01;    }\
void              Algorithm() {Print(__FUNCTION__, ", x = ", x);} };
//+------------------------------------------------------------------+

CLASS( CStrategy_01 );
CLASS( CStrategy_02 );

//+------------------------------------------------------------------+
class Context
  {
private:
   IStrategy         *s;
public:
                     Context(IStrategy *_strategy)    { Print(__FUNCTION__); s = _strategy;  }
                    ~Context()                        { delete s;                            }
   void              GetStrategy()  { s.Algorithm();                       }
  };
//+------------------------------------------------------------------+
Context c1(new CStrategy_01);
Context c2(new CStrategy_02);
//+------------------------------------------------------------------+
void OnStart()
  {
   c1.GetStrategy();
   c2.GetStrategy();
  }
//+------------------------------------------------------------------+

Vladimir Simakov:
I don't get sucked in. It's convenient and straightforward, but I don't get the drive that I get in pluses. You drift away from the iron.

I don't think you have illusion, that C++ is closer to hardware, I doubt, that you'll be able to find anywhere docs on correct coding to modern processors, I was fond of reading by Pentium in late 90=ões, but then, when range of sticks started to grow rapidly, I realized, that I can't even read, and now even the Windows puts drivers for processors - imho, how can one for a pc... but alas, now everything works in this way - all virtual, all through ready-made bibbles, all through compiler optimization.... in general, imho it's an illusion that you write very effective code, it's clear that if the code is originally written through one place and crooked hands, then nothing will help)))

 
Alexey Volchanskiy:

Yes, it's easier on sharpe by an order of magnitude. And the speed is almost the same, that's without cli the pros win by a factor and a half.

I've seen all sorts of such tests based on naked loops, but it's about nothing. No one ever thinks how many threads there are under CLR (well, at least one byte of code must be compiled) and how much memory all this stuff eats.

A long time ago I installed cTrader, and my impressions remained as of a retarded g.... .

And in general - why create another layer of abstraction (bytecode, virtual machine), when we can agree upon the uniformity of CPU instructions (although binary software is well tolerable), like a minimum set realized by all? Probably the desire to create a sandbox where they are gods and indispensable. How stubbornly they pushed their dotnet, while making life difficult for those wishing to write in pluses.

ZS: I'm not talking about cli c++, that's some kind of misunderstanding.

 
Igor Makanu:

imho, Sharp is quite a successful project from Microsoft - not only did they lure people to their /Net platform, but they gave all the diverse language syntax for .Net - you could write it in Basic!

I would put it differently - people were lured away from Windows. This may be subjective.

ZS: for statistics - there are three times more C/C++ projects on github than on sharp (year 17).

 
Vict:

ZS: for the sake of statistics, there are three times more C/C++ projects on github than on sharp (year 17).

It's a subjective evaluation, the quality or rather tasks of the projects may be very small... it's a long time to speculate

The number of Chinese and Indian programmers is not an insignificant factor to gauge the situation - there are really too many of them and we don't know what the industry trends are in these countries, maybe they're sitting on C++ at the moment

And as I wrote above - the transition between C++ and C# and back is rather "painless", Microsoft did everything to make programmers rush back and forth )))) In 2017 there will be a lot of C++ projects, in 2019 there may be a lot of C# projects - you never know

ZS: a very subjective estimate... how many projects are there in python? - all new google videos are exclusively all presentations in python

 
Igor Makanu:

the quality or rather the objectives of the projects can be very small... there is a lot to think about

The number of programmers from China and India is not an unimportant moment to assess the situation - there are really a lot of them, we don't know what the industry trends are in these countries, maybe they're sitting on C++ now

And as I wrote above - the transition between C++ and C# and back is rather "painless", Microsoft did everything to make programmers rush back and forth )))) In 2017 there will be a lot of C++ projects, in 2019 there may be a lot of C# projects - you never know

ZS: a very subjective estimate... how many projects are there in python? - all new google videos are exclusively all presentations in python

Well, there are all sorts of projects in all languages, on average then there should be an average project. There are detailed statistics here https://githut.info/, but it's the 14th year.

I don't want to use Sharp, if only for ideological reasons. I'd rather write it in java (unlikely, though).

GitHut - Programming Languages and GitHub
GitHut - Programming Languages and GitHub
  • githut.info
GitHub provides publicly available API to interact with its huge dataset of events and interaction with the hosted repositories. GitHub Archive takes this data a step further by aggregating and storing it for public consumption. GitHub Archive dataset is also available via Google BigQuery. The quantitative data used in GitHut is collected from...
 
Igor Makanu:

the quality or rather the objectives of the projects can be very small... there is a lot to think about

The number of programmers from China and India is not an unimportant moment to assess the situation - there are really a lot of them, we don't know what the industry trends are in these countries, maybe they're sitting on C++ now

And as I wrote above - the transition between C++ and C# and back is rather "painless", Microsoft did everything to make programmers rush back and forth )))) In 2017 there will be a lot of C++ projects, in 2019 there may be a lot of C# projects - you never know

ZS: a very subjective estimate... how many projects are there in python? - all the new google videos are exclusively all presentations in python

In 2005, I worked for a German company for a while. I was rewriting a GUI for a plotter from C++ to C#. I knew Sharp at the time, as I had some tutorial, so I had no problem with the translation. I quit, because I got bored and now I don't have to think - I just sit and rewrite.

With Python it is a mystery to me how this interpreted, slow and ugly language managed to make its way to the top.

 
Igor Makanu:

It's a subjective estimation, the quality or rather project tasks may be very small...

And as I wrote above - the transition between C++ to C# and back is rather "painless", Microsoft did everything to make programmers hurry back and forth ))))

I agree with pluses on Sharp, but inversely, if you know c/c++ you can't do anything... Just header files alone will crush all desire to sharapist. IMHO.
 
Alexey Volchanskiy:

With Python, it's a mystery to me how this interpretive, retarded and ugly language managed to make its way to the top.

I think it went like this:

1. there are always more users than programmers or people who are familiar with the basics of programming.

2. interpreters are easier to understand for users:

a = 2
b = 5
c = a + b

and get a response from the machine, but you don't understand what it thinks, but once you write it, you see that the machine thinks like you)))

3. we need a quality interpreter, which would not burden a user with unnecessary knowledge about types and other stuff.

4. in order to ensure the mass use of the language, the software must be as open and accessible as possible.

The bottom line is that 1,2,3,4 - Python has united in itself and if there is an army of users, there will certainly be problems to be solved by the programmers who have joined them and made a bunch of libraries

))))


Vladimir Simakov:
I agree with pluses on Sharp, but in the opposite direction, if you know c/c++ you can't do it at all... Header files alone will crush all the desire to sharpe player. IMHO.

You are right, but no one runs from C# to C++ - why? You may plug ready dll in C++ into Sharp and use it, moreover it is easy to make one exe-shtick in C# that will contain the dll

I don't even know, I have discovered the world of C# for myself - I'm not going to quit, it's very comfortable, a lot of manuals on the web, even more ready-made libraries, ten lifetimes will not be enough to try everything ))))