--- Log opened Tue Jun 04 00:00:07 2019 |
00:09 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed] |
00:12 | | Kindamoody is now known as Kindamoody[zZz] |
00:12 | | Degi [Degi@Nightstar-i5u5nk.dyn.telefonica.de] has quit [Connection closed] |
01:02 | | himi [sjjf@Nightstar-1drtbs.anu.edu.au] has joined #code |
01:02 | | mode/#code [+o himi] by ChanServ |
--- Log closed Tue Jun 04 01:13:41 2019 |
--- Log opened Tue Jun 04 01:28:48 2019 |
01:28 | | TheWatcher [chris@GlobalOperator.Nightstar.Net] has joined #code |
01:28 | | Irssi: #code: Total of 30 nicks [22 ops, 0 halfops, 0 voices, 8 normal] |
01:28 | | mode/#code [+o TheWatcher] by ChanServ |
01:28 | | Irssi: Join to #code was synced in 15 secs |
01:29 | | Reiver [quassel@Nightstar-ksqup0.co.uk] has joined #code |
01:29 | | mode/#code [+ao Reiver Reiver] by ChanServ |
04:23 | | mac [macdjord@Nightstar-grpbnp.mc.videotron.ca] has joined #code |
04:24 | | mode/#code [+o mac] by ChanServ |
04:26 | | macdjord [macdjord@Nightstar-grpbnp.mc.videotron.ca] has quit [Ping timeout: 121 seconds] |
04:32 | | himi [sjjf@Nightstar-1drtbs.anu.edu.au] has quit [Ping timeout: 121 seconds] |
05:05 | | celticminstrel [celticminst@Nightstar-1kpqgc.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!] |
05:09 | | catalyst [Jessikat@Nightstar-5dv16h.cable.virginm.net] has quit [Connection closed] |
06:13 | | Vorntastic [uid293981@Nightstar-2dc.p8m.184.192.IP] has joined #code |
06:13 | | mode/#code [+qo Vorntastic Vorntastic] by ChanServ |
08:30 | | Kindamoody[zZz] is now known as Kindamoody |
09:59 | <@sshine> | does anyone have a reference to somewhere that says that an object-oriented idiom is that constructors shouldn't perform any computational work themselves? |
10:02 | | Kindamoody is now known as Kindamoody|out |
10:03 | <@TheWatcher> | I've run into that several times |
10:03 | <@TheWatcher> | All my useful reference books are at home, but give me a moment |
10:07 | <@TheWatcher> | I know I ran into a very emphatic discussion of it in one of the Game Programming Gems books |
10:09 | <@TheWatcher> | Where at least one author there was arguing that the constructor should be minimal, and any real work should be done in an init() function |
10:10 | | Degi [Degi@Nightstar-nuaul4.dyn.telefonica.de] has joined #code |
10:11 | <&[R]> | That sounds pretty anti-RAII |
10:12 | <&[R]> | Only benefit I see to an init() function is if you have multiple constructors |
10:12 | <@TheWatcher> | But then I've also seen things like http://misko.hevery.com/code-reviewers-guide/flaw-constructor-does-real-work/ arguing for minimal constructors and no init |
10:13 | | Degi [Degi@Nightstar-nuaul4.dyn.telefonica.de] has quit [Operation timed out] |
10:16 | <@sshine> | I don't know what the difference is between "init()" and a constructor. |
10:16 | <@sshine> | but I assume that if you need some kind of pre-work, like deserialization, that's the work of a static constructor, or what I think object-oriented pattern theorists call a Factory? |
10:17 | <@TheWatcher> | [R]: the argument in GPG is to not call init() from any of the constructors, but to use the constructor to simply create the object and set all its members to minimal known states (simple assignment or initialiser lists only) with no other allocations happening, then call init() later to do any heavyweight real setup |
10:18 | <&[R]> | That seems a bit silly, since you're forcing boilerplate code down the line |
10:18 | <&[R]> | With no advantage to the user of the code |
10:18 | <~Vorntastic> | Well... |
10:18 | <@sshine> | TheWatcher, thanks, that's an ample reference. |
10:19 | <&[R]> | Unless you had that in a Factory I guess, in which case the user still only has a single function to call |
10:20 | <&[R]> | But why even bother splitting it out into a separate function then? |
10:21 | <~Vorntastic> | Classic issue of load v process, I think |
10:23 | <@sshine> | [R], that Misko Hevery guy that TheWatcher linked to had some decent arguments. |
10:23 | <&[R]> | Also I think the style guide is trying to fix a symptom and not a root issue. If the constructor is so complicated that it can't be easily tested, then the rest of the class is likely designed the same way with very strong coupling. |
10:24 | <&[R]> | Especially at the "It Forces Collaborators on You" bit. Use Dependency Injection to fix that. |
10:27 | <~Vorntastic> | But like |
10:28 | <~Vorntastic> | If you do your loading and then process immediately you can take much longer because you alternate between cpu and io bound |
10:29 | <~Vorntastic> | By doing init separately you can do both at the same time |
10:30 | | * TheWatcher feels a Holy War coming on >.> |
10:31 | <&[R]> | Okay, so like you loop to construct a bunch of instances of the class, then you loop again to call all their init? |
10:31 | <~Vorntastic> | Similarly you can have complex data structures where all the bits work together |
10:32 | <~Vorntastic> | And there can be a computational advantage to "doing lots of inits together" or rather a bulk init |
10:34 | <@sshine> | and those computations make sense. just not inside "the constructor of a single object" thingy, but rather some static constructor / factory. |
10:34 | <&[R]> | TheWatcher: I don't care that much, I just think that having a function call that's required to complete initializing a class instance be put into the user's hands is bad API design (or really any pair of two functions that must always be called one after the other) |
10:38 | <~Vorntastic> | Consider for instance an object that registers itself to a sorted list of things; if you automatically register it on construction you're stuck with insertion sort |
10:39 | | Degi [Degi@Nightstar-nuaul4.dyn.telefonica.de] has joined #code |
10:39 | <&[R]> | Okay, a bulk init could make sense. But it's still effectively looping through after you looped to construct all the instances. |
10:41 | | himi [sjjf@Nightstar-v37cpe.internode.on.net] has joined #code |
10:42 | | mode/#code [+o himi] by ChanServ |
10:55 | | You're now known as TheWatcher[d00m] |
12:15 | | You're now known as TheWatcher |
13:11 | | celticminstrel [celticminst@Nightstar-1kpqgc.dsl.bell.ca] has joined #code |
13:11 | | mode/#code [+o celticminstrel] by ChanServ |
13:19 | | gnolam [lenin@Nightstar-hfrbpd.cust.bahnhof.se] has quit [[NS] Quit: SRF] |
14:12 | | Pink [user1@Nightstar-g7hdo5.dyn.optonline.net] has joined #code |
14:14 | | Degi [Degi@Nightstar-nuaul4.dyn.telefonica.de] has quit [Operation timed out] |
14:52 | | You're now known as TheWatcher[d00m] |
14:54 | | McMartin [mcmartin@Nightstar-ipm463.ca.comcast.net] has quit [Operation timed out] |
14:56 | | McMartin [mcmartin@Nightstar-ipm463.ca.comcast.net] has joined #code |
14:56 | | mode/#code [+ao McMartin McMartin] by ChanServ |
15:35 | | You're now known as TheWatcher |
16:52 | | catalyst [Jessikat@Nightstar-5dv16h.cable.virginm.net] has joined #code |
16:55 | | Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has joined #code |
17:57 | | Kindamoody|out is now known as Kindamoody |
20:48 | <&McMartin> | https://unix.stackexchange.com/questions/405783/why-does-man-print-gimme-gimme-gimme-at-0030 |
20:50 | <@TheWatcher> | ... |
20:51 | <&[R]> | It's a removed feature now too |
20:53 | | Vorntastic [uid293981@Nightstar-2dc.p8m.184.192.IP] has quit [[NS] Quit: Connection closed for inactivity] |
20:57 | <&McMartin> | Entirely or only when you use -w? |
20:59 | <&[R]> | Comments suggest entirely |
21:05 | <&[R]> | Yeah, it doesn't do it at all |
21:05 | <&[R]> | Confirmed with faketime |
21:30 | | Vorntastic [uid293981@Nightstar-6br85t.irccloud.com] has joined #code |
21:30 | | mode/#code [+qo Vorntastic Vorntastic] by ChanServ |
21:38 | <@TheWatcher> | So much yak shaving -_- |
21:39 | | ErikMesoy [Bruker@Nightstar-hhsrrl.customer.cdi.no] has quit [[NS] Quit: Leaving.] |
21:40 | | ErikMesoy [Bruker@Nightstar-hhsrrl.customer.cdi.no] has joined #code |
21:59 | <&McMartin> | Those yaks aren't going to shave themselves |
22:07 | | Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code |
22:07 | | mode/#code [+qo Vornicus Vornicus] by ChanServ |
22:43 | | Emmy [Emmy@Nightstar-9p7hb1.direct-adsl.nl] has quit [Ping timeout: 121 seconds] |
22:46 | | himi [sjjf@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds] |
23:32 | | Reiv [NSkiwiirc@Nightstar-ih0uis.global-gateway.net.nz] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client] |
--- Log closed Wed Jun 05 00:00:09 2019 |