Jump to content
  • Advertisement


GDNet Emeritus
  • Content count

  • Joined

  • Last visited

Community Reputation

1682 Excellent

About Zahlman

  • Rank
  1. puddi puddi puddi puddi puddi
  2. Zahlman

    Ranting on the futility of dumbasses

    Quote:Original post by Tape_Worm Well clearly it's emacs for the win. Why do you hate Uganda? ;)
  3. Zahlman

    Ranting on the futility of dumbasses

    Quote:Original post by Driv3MeFar I agree on all points. I really can't stand OS/software/etc zealots. If you want to use Linux then go right ahead, but don't tell me about why it's sooo much better than Windows. You're not going to convert me (and why would you even care to try in the first place?), instead you just sound like a complete jackass. I especially can't stand the anti-Microsoft idiots who for some reason think that being a large corporation makes you unequivocally evil and out to get the end user. I use whatever I'm given, generally, but I still don't really *like* a lot of things that Windows does; and in particular I'm saddened by historical negative influence that it's had on the Mac OS. The latter has in the past done many things that were objectively more logical from a user interface perspective, but which were later scrapped (in favour of how Windows does things), presumably simply to be competitive. (Exhibit A: window close boxes right next to the minimize/maximize widgets; whereas older versions of MacOS put the close box at top-left, specifically to avoid accidental window-closing. After all, minimize and maximize can be easily undone, but close cannot - and asking for a confirmation dialog is annoying and actually wouldn't really help.) So, in a bad mood, I will often find myself writing things like "M$". I don't think I'm being particularly clever or original (how presumptuous!); I am merely registering my disappointment with how they do things. Anyway, projecting "tell me about why it's sooo much better than Windows" onto people who merely *complain* about windows is, well, not on. As for the last point, my understanding of the way the world works is that being a large corporation more or less legally requires you to be "unequivocally evil and out to get the end user". Because of, you know, the whole maximizing shareholder value thing. For what it's worth, I don't like Sun's licensing policies either (or a lot of design decisions in Java, or their coding practices), and eventually I developed a bad taste in my mouth even for Apple (although Motorola came first, after they screwed Apple over on the G4 processors).
  4. Zahlman

    Why my kids will be home-schooled

    :: stunned applause :: Have you considered polishing this up (in particular, noone could have enacted the glass-parking-lot scenario 100 years ago; 50 is somewhat more plausible) for, say, 2600 magazine?
  5. Zahlman

    Object Oriented Design

    "The singleton is actually what removes the complexity and overhead compared to throwing around statics. Mistakes/bugs with singletons are usually caught compile-time rather than statics which are normally run-time errors." I'm from Missouri(TM). Of course you should not throw static *data* around, but static *functions* should be just fine - and anyway, they don't get "thrown around"; you just write Namespace::doStaticThing(), and it somehow interacts with staticData which is not directly available to the rest of the code (you don't need the 'private' keyword provided by a class to do this; you can hide things by careful use of the C++ linker, too.) If anything, I would say the singleton approach is more prone to runtime problems (consider: someone caches a reference to the instance, then someone else destroys and recreates it), and yes it will catch things at compile-time, but it's also creating extra opportunities to mess up at compile-time ("oh, damn, I need to get the instance here, too...")
  6. Zahlman

    A Language Quandary

    Quote: There is a difference however. In C#, the generics are true generics. They are determined at runtime, and when the IL is generated, you get a type specialized for the input type. In Java, however, generics are just implicit casts. Thus Java generics give no inherit performance nor type safety1 bonuses. That superscript 1 suggests a footnote, but I cannot find one. In any case. I have heard this mentioned before, but I do not see what the practical difference is. Could you provide a minimal example? Quote: Cross-Platform: Heh, this seems to be the one big cornerstone of the Java world. To bad it's not true. I have yet to see any sufficiently complex Java application that didn't have hacks in it to get around operating system deficiencies. Even C# has these problems, and hence isn't cross-platform. For the most part, it's an issue of libraries. But, assuming you avoid such libraries (which can be very very difficult) you can presumably write applications which are “cross-platform”, good luck though. There are some interesting comments about this on Wiki: here and here. In particular, I draw attention to the following, which I believe as well: Quote:And just because the portability of Java (or anything else) isn't 100% perfect; doesn't mean we should abandon attempts to be portable. Where portability is important, code that is 99% portable is far better than code that is 50% or 20% or 0% portable.
  7. Zahlman

    Refactoring, Part 1

    Here's a rough attempt, even though I don't actually know C# :P // TODO: make a class for these, so they'll print an actual name at runtime. public enum Protocol { Tcp, Udp, Ip } public class ProtocolFilter { private Protocol prototype; private ProtocolFilter parentProtocol; public bool filter(Protocol candidate) { if (candidate == prototype) return true; if (parentProtocol == null) return false; return parentProtocol.filter(candidate); } // Non-PortProtocolFilters don't care about the port, so they ignore it. public bool filter(Protocol candidate, int port) { return filter(candidate); } public StringBuilder addName(StringBuilder sb) { return sb.Append(" ").Append(prototype.toString()); } public StringBuilder addPortInfo(StringBuilder sb) { return sb; } public ProtocolFilter(Protocol prototype) { this.prototype = prototype; parentProtocol = null; } public ProtocolFilter(Protocol prototype, ProtocolFilter parentProtocol) { this.prototype = prototype; this.parentProtocol = parentProtocol; } } public class PortProtocolFilter: public ProtocolFilter { private PortComparator portChecker; // A protocol filter which expects a port number will always reject a // connection via a protocol that doesn't specify a port. public bool filter(Protocol candidate) { return false; } public bool filter(Protocol candidate, int port) { return super.filter(candidate) && portChecker.filter(port); } public override StringBuilder addPortInfo(StringBuilder sb) { return portChecker.addInfo(sb); } public PortProtocolFilter(Protocol prototype, PortComparator pc) { this.prototype = prototype; parentProtocol = null; portChecker = pc; } public PortProtocolFilter(Protocol prototype, ProtocolFilter parentProtocol, PortComparator pc) { this.prototype = prototype; this.parentProtocol = parentProtocol; portChecker = pc; } } // Some sample protocol filters. Don't shoot me if they're not technically // accurate. ProtocolFilter IpFilter = new ProtocolFilter(Ip); ProtocolFilter TcpFilter = new ProtocolFilter(Tcp, IpFilter); ProtocolFilter UdpFilter = new ProtocolFilter(Udp, IpFilter); ProtocolFilter TelnetFilter = new PortProtocolFilter(Udp, IpFilter, new EqualTo(23)); ProtocolFilter HttpFilter = new PortProtocolFilter(Tcp, IpFilter, new EqualTo(80)); public class IPAddressFilter { private IPAddress addr; private IPAddress mask; public bool filter(IPAddress candidate) { byte[] IPBytes = candidate.GetAddressBytes(); byte[] AddressBytes = addr.GetAddressBytes(); byte[] MaskBytes = mask.GetAddressBytes(); for (int i = 0; i < IPBytes.Length; ++i) { if ((IPBytes[i] & MaskBytes[i]) != (AddressBytes[i] & MaskBytes[i])) return false; } return true; } public IPAddressFilter(IPAddress addr, IPAddress mask) { this.addr = addr; this.mask = mask; } public StringBuilder addInfo(StringBuilder sb) { return sb.Append(" ").Append(addr).Append(" ").Append(mask); } } // Todo: use delegates instead, or something? public class PortComparator { int comparisonPort; virtual public bool filter(int candidatePort); public PortComparator(int port) { comparisonPort = port; } virtual public StringBuilder addInfo(StringBuilder sb); } public class GreaterThan : public PortComparator { public bool filter(int candidatePort) { return candidatePort > comparisonPort; } public StringBuilder addInfo(StringBuilder sb) { return sb.Append(" gt ").append(comparisonPort); } } public class LessThan : public PortComparator { public bool filter(int candidatePort) { return candidatePort < comparisonPort;
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!