🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #231889

Re: Dobre praktyki

#231889
From: Marek S
Date: Thu, 25 Jan 2018 23:03
22 lines
1939 bytes
W dniu 25-01-2018 o 21:10, Wojciech Bancer pisze:

> https://stackoverflow.com/questions/12755539/why-is-singleton-considered-an-anti-pattern
> https://www.michaelsafyan.com/tech/design/patterns/singleton
> 
> Bazy danych to najczęściej factory.
> A singletony to pain-in-the-ass podczas pisania testów.
> 

Cytat z linku jaki przesłałeś zachęca do singletonów przy bazach :-)

If you find that you want to use a singleton, you may want to consider 
your design, but there are times where it is useful.

For example, once I had to write an application that could have at most 
one database connection, to process thousands of requests. So, a 
singleton makes sense since I am resource constrained to having only one 
instance.

-- 
Pozdrawiam,
Marek
Technical Details
Message-ID: <p4dnnf$m5b$1@node2.news.atman.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
References: <2lhebv1xabri$.dlg@tyczka.com> <6d0bd754-9b46-46ce-98ff-c5265a9a93af@googlegroups.com> <chac9zcm8l6a.1gxug7ng6lbce$.dlg@40tude.net> <cd0f750f-2346-4016-bbbd-a72c386c561d@googlegroups.com> <slrnp6hci6.23ml.wojciech.bancer@pl-test.org> <fc6bfbc5-c858-4156-95c5-cb276d07067e@googlegroups.com> <slrnp6kee7.2lbk.wojciech.bancer@pl-test.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!newsfeed2.atman.pl!newsfeed.atman.pl!.POSTED!not-for-mail
From: Marek S <precz@spamowi.com>
Newsgroups: pl.comp.lang.php
Subject: Re: Dobre praktyki
Date: Fri, 26 Jan 2018 00:03:05 +0100
Organization: ATMAN - ATM S.A.
Lines: 22
Message-ID: <p4dnnf$m5b$1@node2.news.atman.pl>
References: <2lhebv1xabri$.dlg@tyczka.com> <6d0bd754-9b46-46ce-98ff-c5265a9a93af@googlegroups.com> <chac9zcm8l6a.1gxug7ng6lbce$.dlg@40tude.net> <cd0f750f-2346-4016-bbbd-a72c386c561d@googlegroups.com> <slrnp6hci6.23ml.wojciech.bancer@pl-test.org> <fc6bfbc5-c858-4156-95c5-cb276d07067e@googlegroups.com> <slrnp6kee7.2lbk.wojciech.bancer@pl-test.org>
NNTP-Posting-Host: 89-69-207-111.dynamic.chello.pl
Mime-Version: 1.0
X-Trace: node2.news.atman.pl 1516921391 22699 89.69.207.111 (25 Jan 2018 23:03:11 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Thu, 25 Jan 2018 23:03:11 +0000 (UTC)
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2
In-Reply-To: <slrnp6kee7.2lbk.wojciech.bancer@pl-test.org>
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit