Fellow devs - if you have a "repository"-like object that only has a single implementation do you do this? If so - why?pic.twitter.com/GRogvFc7qu
I've got a need to make things - apps, websites or dad jokes. Sometimes they work. Currently building & growing @thankbox to $10k/month and beyond.
Możesz dodawać lokalizację do Twoich Tweetów, jak miasto czy konkretne miejsce, z sieci lub innych aplikacji. W każdej chwili możesz usunąć historię lokalizacji swoich Tweetów. Dowiedz się więcej
Umieść tego Tweeta na swojej stronie, kopiując poniższy kod. Dowiedz się więcej
Umieść ten film na swojej stronie, kopiując poniższy kod. Dowiedz się więcej
Umieszczając treści z Twittera na Twojej stronie internetowej lub w Twojej aplikacji, potwierdzasz, że akceptujesz naszą Umowę dla programistów i Zasady współpracy z programistami.
| Kraj | Kod | Dla klientów |
|---|---|---|
| Stany Zjednoczone | 40404 | (dowolny) |
| Kanada | 21212 | (dowolny) |
| Wielka Brytania | 86444 | Vodafone, Orange, 3, O2 |
| Brazylia | 40404 | Nextel, TIM |
| Haiti | 40404 | Digicel, Voila |
| Irlandia | 51210 | Vodafone, O2 |
| Indie | 53000 | Bharti Airtel, Videocon, Reliance |
| Indonezja | 89887 | AXIS, 3, Telkomsel, Indosat, XL Axiata |
| Włochy | 4880804 | Wind |
| 3424486444 | Vodafone | |
| » Zobacz krótkie kody SMS dla innych państw | ||
Na osi czas spędzisz najwięcej czasu, czytając wiadomości o sprawach, które Cię interesują.
Najedź kursorem na zdjęcie profilowe i kliknij przycisk Obserwowany, by przestać obserwować dowolne konto.
Gdy widzisz Tweeta, którego lubisz, dotknij ikony serca — jego autor dowie się, że jego wpis przypadł Ci do gustu.
Najszybszym sposobem na udostępnienie czyjegoś Tweeta jest podanie go dalej. Dotknij ikony, by to zrobić.
Powiedz, co myślisz o Tweecie, odpowiadając na niego. Znajdź temat dyskusji, który Cię interesuje, i dołącz do rozmowy.
Bądź zawsze na bieżąco i obserwuj publiczne dyskusje.
Obserwuj więcej kont, by widzieć więcej wiadomości na tematy, które Cię interesują.
Zobacz najnowsze rozmowy na dowolny temat.
Bądź na bieżąco z najciekawszymi historiami.
Fellow devs - if you have a "repository"-like object that only has a single implementation do you do this? If so - why?pic.twitter.com/GRogvFc7qu
In my opinion it's much better to avoid the needless interface and just do this instead. Before anyone mentions tests and mocking - good mocking frameworks can mock classes no problem - you don't need an interface, so what else is it?pic.twitter.com/oS1pA6ddlq
The CS answer is The Dependency Inversion Principle (the D of SOLID). Relying on abstractions, using a DI framework and whatnot. In reality I think you'd want the interface as a way to force consistency when you inevitably add a second Repository and you want the two to match
"when you inevitably add a second Repository and you want the two to match"
I have never had to do that.
And even if you did have to do it, what's the problem of extracting an interface *at that point* rather than before.
The inevitability depends on scale I guess. If you're certain you'll never need a second repo then don't bother.
The only harm I can see in creating the interface later is that it'd mean a change to a bunch of unrelated code. You'd have to update other places to rely on the new interface instead of the class. I guess it's planning for a possibly complex future or thinking YAGNI.
I really just think "YAGNI" when I see this. I've started tending to favour overt simplicity from the beginning until I absolutely need the extra complexity.
Twitter jest przeciążony lub wystąpił chwilowy problem. Spróbuj ponownie lub sprawdź status Twittera, aby uzyskać więcej informacji.