The pattern in your example is a simple Strategy pattern. As for the coding style, it kind of depends on what the syntax of the language allows... why not call it "Lisp style", just to remind devotees of functional programming that their latest fashion has been around for 50 years.
CurtainDog
Posts
-
Is this a known pattern? -
The SQL Injection Attack is alive and well.This ignores the fact that the exploit most likely comes from third-party code, so it's not at all easy to stop. The irony is that if you roll your own web framework your site might be much more secure even if your code much less secure by the virtue of the fact that no one will bother to try to hack you. I still wouldn't recommend it though.
-
.NET or Java?Daft or no that's the way things work in the software world. Jobs-wise there no point in having more than 5 years anything on your CV (maybe academia is an exception?).
-
Sort FunctionsI may have gone mad but this is a selection sort surely... Edit: my hesitation is due to the fact that (as pointed out above) you never see these sorts of sorts in the wild because there are much better sorts of sorts.
-
Cost Estimation???Sorry, but I tend to agree with your colleague. Think about what the project in question is/should be worth (which, again, you'll only know once you've been around the industry a few times) and then work to that. The alternative is finding a workplace where the requirements are always right the first time and you never get interrupted by other projects :P
-
Stupid Apple, againI had the same problem but with Firefox I was able to continue the download (even though Firefox crashed halfway through). 1. Go to your downloads directory and make a copy of the partially downloaded file. 2. Restart Firefox - this will start the download afresh and overwrite the partially downloaded file (thus step 1) 3. Pause the download 4. Copy the saved partially downloaded file (from 1) over the top of the file you are downloading 5. Unpause the download 6. Profit!! Hope this helps...
-
Oracle sues GoogleBut surely open source != fair game. I imagine a lot of (most?) open source projects would at least require some form of attribution. Even the use of public domain code could get you into trouble if you made misleading/deceptive claims about your authorship of the code.
-
Looking for advice in managing code in related applications (long)WRT version control a distributed system might work better for you, as this would enable you to have a production repository per client. WRT to the general nature of the original post - I'll have to echo the sentiments that have already been expressed: it's not a software problem and can't be solved in the software.
-
Difference between c# and VB.NetNot only rude, but indicative of a culture of not meeting expectations.
-
This is why I am starting to loathe programmingbjarneds wrote:
In previous versions of .NET, this problem could be illustrated simply by adding e.g. a DateTimePicker to Form2. The DateTimePicker subscribed to the UserPreferenceChangedEvent, so it was kept alive, and it's Parent reference to Form2 thus kept Form2 alive. This is not the case in .NET 3.5 - maybe they changed the design, or used some sort of weak reference?
So if the event used a weak reference instead the problem would go away?
-
This is why I am starting to loathe programmingDon't take it too personally, sometimes being right is an ends in itself.
-
This is why I am starting to loathe programmingIf the class creator wants it to be used in a particular way then they can build a factory for it. Up until that point I'll use the class however I want to.
-
dotNET Rant [modified].Net is the platform and C# is the language; in the Javaverse they're both called Java, which is highly confusing. As pointed out in one of the responses above the original code would behave differently in Java because Java caches Integer 0. I'm also a Java programmer and with the exception of generics I'm ambivalent about the language changes in 1.5 & 1.6
-
dotNET Rant [modified]Fair call, I must admit I was mostly thinking of literals when I made my comment. These of course would be able to be handled at compile time.
-
dotNET Rant [modified]The deeper question is why does auto boxing not return the same object.
-
10 CommandmentsSnide comment from an OO zealot: So what's FIRST_DAY_OF_WEEK * FIRST_DAY_OF_WEEK then? </snide>
-
10 Commandments100% percent agree. The other advantage of code reviews is that they force you to code with the knowledge that you're going to have to justify what you write to someone else.
-
Linux IDEs for web developmentIt was mentioned in the original post... but yes, netbeans is quite good and has improved by leaps and bound in recent iterations. For Java development Eclipse is still king, but you need to set aside half a day to get it set up. I use Netbeans for PHP and Javascript and it's usable right out of the box. (I have only run these two under Windows though so YMMV)
-
Do we really need Java runtime?But my favourite IDEs are Java! But, no, I don't know of any killer apps in the desktop space so you probably don't really need it.
-
I have no idea why I am genuinely saddened by thisI think being saddened is acceptable.. there wasn't much that was evil about sun. In any case I think it is a good fit between the two, so I expect a lot of stuff will live on.