| |
| |
| |
|
Page: 1 2 3 4 5
Comments:
<0> kmh: calling methods is more error prone? how is that? <1> Clackwell : since the common/intuitive t= new thread(); t.start(); will not work/yoield correct results <0> myMethod(int whatToDo, someGenericThingToKeepAllParametersForAllKindsOfUses) <0> now the developers uses a whatToDo that isn't defined... <1> ? <0> kmh: i thought we agreed that if you have one method as a starting point for n number of different tasks, that you need to p*** in the information as to what actually should be performed in the parameters. <1> Clackwell : yes <0> kmh: so how do you encode that? <0> do you use an int? <0> and what about the parameters then? <1> in the constructor <0> that answers the "where", not the "how". <1> you p*** the data containes the required info to the constructor <1> and code the behaviour according to the data in the run() methid <0> kmh: so you p*** in an arraylist and let the poor programmer analyse at runtime what you p***ed? <0> that's horrible, and far more error prone as far as i can tell.
<0> or do you p*** an Object, for full flexibility? <1> i'm not sure whether we are discussing the same scenario <1> you p*** data (in whatever form is appropiate) <0> kmh: you a cl*** that can perform 10 different tasks. you are only able to p*** parameters to the constructor and then make it perform what you want. <0> you have a, rather <0> kmh: so you encode what to do in the parameters themselves? or in their type? <1> Clackwell : you can have more than 1 constructor <0> kmh: so you write heaps of constructors with all possible varieties of parameters just to be on the save side? <1> yes the parameters carry the infos what to do (for the run mthod) <0> so that you cover all kinds of possible parameter combinations? <0> what if two tasks require the same set of parameters? <0> do you have an additional parameter further specifying what to do in that case? <1> yes or you combine it to a few more generic ones <0> MyThread(int whatToDoWithThisName, String name) ? <1> Clackwell : if 2 tasks require the same set of parameters you just p*** them and additional parameters carries the task information <0> kmh: and what type does that additional parameter have? <1> Clackwell : it does the same anyway than calling an additional method <0> kmh: and what type does that additional parameter have? <2> It may be more of a implementation issue, but does explicitly .dispose() of an object make it garbage collect any faster/better? <0> kmh: my point is that it doesn't and that "do it all" methods are bad because you keep cramming code for different purposes into them needlessly, unless you dispatch to other methods again, which is horrible around the corner. <1> the only difference is instead of calling an empty parameterless constructor and then an additional methid p***ing the info (like in your case), you give the parameters to the constructor <1> Clackwell : it is just combining to calls into one <1> Clackwell : it is not anymore "do it all" then your approach <0> kmh: the difference is that there is nothing to be done wrong with an non existing parameter. if you add a parameter which allows to p*** undefined values just for adding a little more centralization or whatever, the programmer CAN and WILL p*** in undefined values sooner or later. <0> kmh: and the code dealing with these calls does what two methods did before in a single method/constructor? or do you let your constructor dispatch the call into two different methods again? <1> Clackwell : no <3> Zeekius: no <1> Clackwell : you suggested constructor(); method(info); start(); <0> kmh: yes. i have seen this happening in my current project - and the "whatToDo" parameter is an int in our case, and the whole method was written by the same guy who got confused about which int values are valid. <1> i 'm just saying you _can_ combine constructor(); method(info); to constructor(info); <0> kmh: i suggested constructor(); methodForSchedulingTaskX(info); start(); <1> i c no need for an additional method <0> big difference. <0> clarity, less error prone. you claimed that my approach was more error prone, if i recall correctly. <1> Clackwell : ic no big difference here nor more "clarity" <0> kmh: well, that happens i guess. <1> all the time <1> nevertheless that's not the point <0> i gave an example of how someone got that "identifier that tells the method what to do" bit wrong all on his own. <0> if you can avoid such, do it, is my point. <0> if you can keep the parameters to be p***ed simpler, do it. <1> you are just switching a method name for a parameter but you buy it with an additional method call <1> which i don't see as an advantage <1> nor yielding more clarity <0> kmh: clarity, less abstraction, simpler parameters, simpler methods than your constructor, less chance for error with an additional "what to do" id used wrong. <0> phone <1> and the error potential moves from not p***ing the correct data to "forgetting" the required call of methid in addition to constructor(); start(); <2> kmh: when you implement constructor(info) instead of constructor; method(info), do you call method(info) or replicate the method code in the constructor? <1> Zeekius : i move the method code (i.e. replicate) to the constructor <0> kmh: using api docs is the daily bread of the java developer, and you need that to inform yourself about the "uh, how do i tell the thread what to do in the constructor again" bit anyway. <1> method (info) does not exist as a (public) method anymore <1> Clackwell : so ? <4> question: i deployed an EJB2.0 entity bean with both local and remote interfaces. i am trying to have a states session bean that is remote to the client create a new entity bean locally ... can this be done? <4> *stateLESS <4> i'm getting a cl*** cast exception in the stateless bean when i cast my JNDI-lookup result to the local home interface type <4> which leads me to believe that the JNDI-registered object is actually the remote interface type <4> which leads me to believe that you have to deploy the same entity bean twice, once for remote access and once for local access ... but that doesn't seem right ... any ideas? <1> Clackwell : my point is you've traded one error for another <5> Hey, I had to leave, I'm back, I've read your discussion <5> Is there a consensus as to which is the preferred approache for dispatching? <1> Clackwell : besides in any case either the constructor or your method needs to validate the data before run is executed (and the lack of that seems to be the problem of your programmer)
<1> Lorraine_ : strictly speaking bith approaches are "fine" (i.e. work) just pick what you are more comfortable with <1> Lorraine_ : it is roughly the same approach anyhow <5> Ok.. So essentially, my run method figures out which method of my cl*** to call based on parameters? <1> yes <5> ok, thanks folks, that clarified things <1> and you can p*** the info either to constructor alone or by an additional method call of another methid you implement <1> i.e. Clackwell and I suggested the same solution, but argued about an implementation detail <5> A function pointer would be nice in my opinion <1> which is as far as your program is concerned doesn't really matter <5> yeah <5> it has ugly things in it already anyway <1> Lorraine_ : you need no function pointer you p*** an object <5> Yeah I know <1> that comes with OOP no loose functions floating around <5> but if I understood correctly, I'm gonna have something like : <5> if(param == "somefunc") <5> execute somefunc <5> if(param = "someotherfunc") <5> exec someotherfunc <1> and actually note that the object offers more functionality/benefits than a function <5> Did I get it? <1> Lorraine_ : yes you could do it that may <0> void performTask(Task task) { task.perform(); } <- Task is an interface. <1> or you could hide that if statement by an inheritance scheme <0> that makes task into a function pointer (as it exists in java). <1> but than you would need to implements more than one thread cl*** <0> Lorraine_: command pattern <5> I think I'll make my threads work first, and worry about better design later ;) <5> thanks a lot <0> that's the spirit <0> microsoft spirit, i meant to say :> <1> Lorraine_ : and not that Task can even hold data and more (since it is not jujst a ,ethid but an object) <1> Clackwell : lol <5> yeah <1> Clackwell : actually afaik long designed phases are out again in the latest fashion <0> i'd go for one Thread subcl*** for each task to be performed, for simplicity reasons, at this point. <1> so i wouldn't blame it all on microsoft <0> adding another layer in form of Tasks and using Thread instead for executing all tasks seems not to gain much at this point. <0> kmh: yeah, it's a weak joke, since ms is a darn large bunch, of all sorts. not all of them plain **** at what they do. <1> ic <0> finally...i love autoupdates. if only they'd describe how to move your account to another machine/installation....:> <4> does anyone know why you can't set a JNDI name for a local entity bean in Sun Deploy Tool 8.2 ? <1> hmm no help for ntbeans problem, so i'm off <1> bbl <0> bye kmh <0> whodis: no clue. not very enterprisey in here <4> eek <4> thats where all the jobs are man <4> j2ee <0> i couldn't care less. <4> lol <0> i learn what i need for the job. <0> i don't learn in advance, and i am not a career programmer. <4> how do you get yourself hired then (if you don't learn in advance) <0> i concern myself with bloated crap like j2ee when the time comes (when i lose my current job), until then i rather keep my peace of mind. <3> Clackwell they do somewhere becasue i've done it(T-bird) <0> i do not, rather <0> sabre: yeah, me too, just that it never seemed as straight forward as copy, point to folder, done. <0> but that's how easy it should be. <0> sabre: i'll investigage again, maybe it's documented and i never managed to stumble over it. <3> Clackwell: Addressbook -> export <0> sabre: nope, i am not looking for exporting my address book. <3> oh just the settings ..dunno <0> no, everything (minus the t-bird executables, program files, etc.) <3> i just with they would give me their LDAP server address here at work...instead for that i still have to open Tao *gag* <0> sabre: what is tao? <0> enterprise address book? ;) <3> mail client similar to outlook <0> oh...urgs... <3> well more like Lotus really <3> conference scheduling, forms, etc <0> even worse... <3> heh no kiddin
Return to
#java or Go to some related
logs:
spring MVC submit array #javascript Nickii australia epitech hackers haq alla CreateFileMapping const char* cannot convert PHPCross domain session #MissKitten #AllNiteCafe #mysql
|
|