Better singleton in C db.h: #pragma_once struct db; db* get_db(void); // more functions that deal with db hena db.c: #include "db.h" struct db {/*db stuff*/} _db; db* get_db() { return &_db; } // implementation of the rest of the functions
@@amrmohamed2608 there is no such thing as anti pattern. It all depends on the context. I would happily accept criticism to Singletons in a certain context stating specific reasons why exactly it's bad.
انت رائع الله يوفقك ويعطيك العافيه .. جزاك الله خير.. شرحك مفيد جدا
More videos about the singleton please
شرحك حلو جداا .. بس ياريت لو تكبر الفونت شوية في vscode عشان يناسب التصوير مش اقل من 20 بيكسل
straight to the point, keep it up
وقت الفيديو مناسب جدا (المختصر المفيد) والمحتوي عظيم,استمر (Y)
شرح ممتاز واطلالتك جميلة واسلوبك ممتع . تحية لك واتمنى المواصلة
time was amazing..hope talk about state or observer ... :D
Did talk about the observer after this one :D
الشرح ممتاز
بس حاول تكبر الخط او تعمل زوم لما تيجي تكتب الكود
pretty good video btw
3aaaaaash
Better singleton in C
db.h:
#pragma_once
struct db;
db* get_db(void);
// more functions that deal with db hena
db.c:
#include "db.h"
struct db {/*db stuff*/} _db;
db* get_db()
{
return &_db;
}
// implementation of the rest of the functions
This looks neat
Some says that singletons are anti design patterns...and I honestly believe that they should not be included in dp books or whatsoever
@@amrmohamed2608 there is no such thing as anti pattern. It all depends on the context. I would happily accept criticism to Singletons in a certain context stating specific reasons why exactly it's bad.
Btw lama ba2ool "better Singleton" I'm referring to my other comment msh asdy better than your code 😄
at min 2:04 you are explain something that your face camera is covering the board so it makes some confusion.
Yup you are correct, I'll try to take care in the upcoming videos
singleton in C = global variables lol
struct db {/*db stuff*/} _db;