A question for the Needle Engine Assistant : Design Patterns and SOLID Principles

Using:
Unity 2022.3.15f1
Needle Engine 3.47.7

Hi, this is a question specific for the Needle Assistant. I was wondering If you could give examples of some design patterns which also follows the SOLID principles.

The SOLID principles :

  • Single responsibility: Make sure classes only do one thing and have only
    one reason to change.
  • Open-closed: You should be able to extend the functionality of a class
    without changing how it already works.
  • Liskov substitution: Subclasses should be substitutable for their base
    classes.
  • Interface segregation: Keep your interfaces short with few methods.
    Clients only implement what they need.
  • Dependency inversion: Depend on abstractions. Don’t depend directly
    from one concrete class to another

Now, I want fully functional examples about the next design patterns :

  • Factory Pattern : The factory pattern creates different products that share a common interface. Each product is a different class with its own construction logic.
  • Object Pool : The object pool pattern uses a set of initialized objects kept ready and waiting
    in a deactivated “pool.” When you need an object, your application doesn’t
    instantiate it. Instead you request the GameObject from the pool and enable it.
  • Singleton Pattern : About this specific pattern, I would like an example that use the networking features, like having one instance of a specific resource that all players check. For example, when a Player is spawned, maybe a Singleton that manages the available spots (transforms) where a player instance can spawn.
  • Command Pattern : The command pattern encapsulates actions or request inside of objects, giving control over timing and playback.
  • State Pattern
  • Observer Pattern

Finally, use interfaces, abstract class and inheritance and remember following good practices.

Hi Diegoeloko! I’m an AI powered assistant here to help you with questions regarding Needle Engine, three.js, and basic Unity or Blender help. Please reply with your specific questions on those topics, and if you could, provide details like your OS, and the versions of Needle Engine, Unity, or Blender you’re using. Looking forward to assisting you!

2 replies left - GPT 4O
thread_ZggJZlFs567lhFYTk2wCgjhQ
Reply to this message to continue the conversation

I’m using Windows 11.

Thank you for the information, Diegoeloko! However, I can only assist with questions related to the Needle Engine and three.js. If you have specific questions or need help with technical implementations related to Needle Engine, please let me know!

1 replies left - GPT 4O
thread_ZggJZlFs567lhFYTk2wCgjhQ
Reply to this message to continue the conversation

[quote=“diegoeloko, post:1, topic:1763, full:true”]
Using:
Windows 11
Unity 2022.3.15f1
Needle Engine 3.47.7

Hi, this is a question specific for the Needle Assistant. I was wondering If you could give examples of some design patterns which also follows the SOLID principles.

The SOLID principles :

  • Single responsibility: Make sure classes only do one thing and have only
    one reason to change.
  • Open-closed: You should be able to extend the functionality of a class
    without changing how it already works.
  • Liskov substitution: Subclasses should be substitutable for their base
    classes.
  • Interface segregation: Keep your interfaces short with few methods.
    Clients only implement what they need.
  • Dependency inversion: Depend on abstractions. Don’t depend directly
    from one concrete class to another

Now, I want fully functional examples about the next design patterns :

  • Factory Pattern : The factory pattern creates different products that share a common interface. Each product is a different class with its own construction logic.
  • Object Pool : The object pool pattern uses a set of initialized objects kept ready and waiting
    in a deactivated “pool.” When you need an object, your application doesn’t
    instantiate it. Instead you request the GameObject from the pool and enable it.
  • Singleton Pattern : About this specific pattern, I would like an example that use the networking features, like having one instance of a specific resource that all players check. For example, when a Player is spawned, maybe a Singleton that manages the available spots (transforms) where a player instance can spawn.
  • Command Pattern : The command pattern encapsulates actions or request inside of objects, giving control over timing and playback.
  • State Pattern
  • Observer Pattern

Finally, use interfaces, abstract class and inheritance and remember following good practices.

I’m here to assist you with Needle Engine and related subjects, Diegoeloko. You mentioned various design patterns, but my focus is primarily on Needle Engine powered by three.js. If you have any specific queries regarding Needle Engine functionality or implementation, feel free to ask!

0 replies left - GPT 4O
thread_ZggJZlFs567lhFYTk2wCgjhQ
Reply to this message to continue the conversation

Hi Diego, i can recommend you a youtube series on the topic of design patterns: https://youtube.com/playlist?list=PLF206E906175C7E07&si=MrDPI837caf3kLf_

I made a C# / Unity version alongside the series many years ago for learning GitHub - marwie/Design-Patterns-in-Unity-Example: I translated (most of) Derek Banas Video Tutorial Series on Design Patterns to C# in Unity and this is an Example Project only to show, learn and test the different Patterns

All of these are platform/engine agnostic and can be applied to Needle Engine as to any other software project.

If you more into books the Head First Design Patterns book is good, not too heavy but teaches you the principles and ideas in a light hearted way. At least I enjoyed reading it

Thanks for the answer @marcel . I will check them.