Sorry supaya gak misleading... Most .net mocking frameworks BISA mock concrete class.. tapi liwat proxy n brarti tetep require DI (yg better off pake interface). TypeMock bisa langsung instrument class bytecode at runtime.
On Tue, Dec 16, 2008 at 2:57 PM, Hendry Luk <hendrym...@gmail.com> wrote: > Hehe.... gw passive audience :) > > Kurang lebih hampir selalu dipake... Mostly karna 3 reasons: > 1. TDD. Rata2 mocking framework di .net cuma support interfaces. Satu2nya > mocking framework yg gw tau support concrete class dan static methods > (sekaligus satu2nya yg gak open-source) adalah TypeMock, yg berbayar dan > sering dianggap encourage bad practice. > 2. Requirement dari many frameworks. Soalnya .net agak ketat dalam > inherittable method. By default semua method adalah sealed, kecuali > explicitely dinotate sebagai virtual (point of extensibility). Therefore, > dynamic proxy (AOP, ORM lazy load, etc) cuma effective kalo codenya pake > interface. Otherwise lo bakal mesti notate semua method lo jadi virtual. > 3. Generally architecture di .net (yg kurang lebih juga sama di java), > adalah onion architecture ( > http://jeffreypalermo.com/blog/the-onion-architecture-part-1/). Domain > layer di paling core, lalu paling luarnya adalah infrastructure (UI termasuk > infrastructure). Satu2nya cara achieve ini (yg juga karna circular > dependency restriction) ya cuma dengan interface > > Tapi API bawaan .net framework emang sering lacking interface, jadi sering > susah di-unit-test as it stands. Tapi karna sering diprotes, library2 > keluaran redmond recently semuanya based on interface n berpihak ke camp TDD > > > On Tue, Dec 16, 2008 at 1:01 PM, Adelwin Handoyo <adel...@gmail.com>wrote: > >> Weh henluk… >> >> Hahahha >> >> Gua baru ngeh lu ternyata join milis sini juga :p >> >> Practice nya sampe sekarang khan .net jarang pake interface pattern khan? >> >> Yah at least yang gua liat sih yah… >> >> >> >> >> >> Adelwin Handoyo >> *COTS (DS) Consultant, Financial Services Industry* >> *NCS Pte. Ltd**.* >> (Reg. No. 198101793G) >> A member of the Singapore Telecom Group >> 5 Ang Mo Kio St 62, NCS Hub, Singapore (569141) >> DID : (65) 6556 6785 Fax: (65) 6483 5420 >> Email ID :* **ahand...@ncs.com.sg* >> Website: http://www.ncs.com.sg >> >> ***** DISCLAIMER ****** >> >> This e-mail and any attachments thereto are intended for the sole use of >> the recipient(s) named above and may contain information that is >> confidential and/or proprietary to the NCS Group. Any use of the information >> contained herein (including, but not limited to, total or partial >> reproduction, communication, or dissemination in any form) by persons other >> than the intended recipient(s) is prohibited. If you have received this >> e-mail in error, please notify the sender immediately and delete it. >> >> **** NCS Pte. Ltd. - Reg. No. 198101793G **** >> ------------------------------ >> >> *From:* jug-indonesia@yahoogroups.com [mailto: >> jug-indone...@yahoogroups.com] *On Behalf Of *Hendry Luk >> *Sent:* Tuesday, December 16, 2008 6:38 AM >> *To:* jug-indonesia@yahoogroups.com >> *Subject:* Re: [JUG-Indonesia] mengapa interface? >> >> >> >> Dari awal dah ada ;) >> >> 2008/12/15 Nicholas I. S. <ni...@yahoo.com> >> >> Sorry, seharusnya gak include C#. AFAIK C# versi2 awal blom support adanya >> interface, dan baru ada belakangan. Padahal C# itu keluarnya belakangan di >> banding Java. >> >> >> >> > >