Giter VIP home page Giter VIP logo

Comments (4)

GISED-Link avatar GISED-Link commented on June 16, 2024 1

Hi @benhar-dev,

Thank you very much for your reply. I open this issue waaaaay too early. After I open the issue, I started to read what was in the src folder. And only then I finally got the whole concept of this project.

You are clearly a step above where my team needs to go. Now we have duplicated code everywhere, early days code convention, etc...

Thank you for this amazing project, I hope I can give it a try in a next future.

from mobject-io.

GISED-Link avatar GISED-Link commented on June 16, 2024

Ok, the more I read your documentation the more I understand where you will go with this project. This issue is irrelevant since you are thinking about to do something special with the CyclicCall method.

from mobject-io.

benhar-dev avatar benhar-dev commented on June 16, 2024

Hi @GISED-Link,

Thank you for your comments on here, it is much appreciated!

I totally agree with you with how nice code looks when you get in to OOP, and for many years I used a combination of FB style and CLASS in exactly the same way you describe. With this style you will make your programs more readable and it makes code writing easier. I coded this way for so long because it works.

The problem I started to face is that I was applying OOP to more and more machines and projects, and as such I found that I was finding cyclic calling to be an issue. In a machine it was not as obvious, but when I was coding projects which handled communication and request / response was writing myself in to a corner.

Almost everything with IO needs cyclic calling, but also things such as timers. If I passed a cyclic object in to another object which was non-cyclic then I shouldn't force the non-cyclic object to know or care to call the cyclic object. This placed my cyclic call on the outside. Still, totally fine and this can be done as most of the time your IO is static, so you know you need to call a motor or lamp.

Then the big problem hit. I wanted to use __New to make something which was cyclic. What was worse was that the thing that created it was non-cyclic. Hence Mobject was born. Any objects can be cyclic, and can also automatically be called forever, or until they complete. This allows me to make things like asynchronous commands, which only exist for a short period, but still need "updating" each cycle to do their job. To be able to manage such a thing I needed to fully embrace OOP and remove the non-oop parts from my code.

The examples on Mobject do not do a good job of conveying this problem/solution, as if you do not make things with __NEW then it's not obvious that this problem exsists. FB style or CLASS with the call on the outside is totally fine. As soon as you use __NEW you run head long in to the problem I had.

I hope you like the work and I'm always keen to know peoples ideas and comments. Plus I hope Mobject works for you as and when you need something cyclic called when you __NEW it up.

Happy coding!

Ben - Coding bytes
https://codingbytes.teachable.com/p/codingbytes_twincat3

from mobject-io.

benhar-dev avatar benhar-dev commented on June 16, 2024

Sounds good and thanks again! I'll be making more OOP videos soon on CodingBytes so hopefully these will help too.

from mobject-io.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.