Results 1 to 10 of 26

Thread: New language features have a place in game code?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Operator overloading and "for...in" loops are huge space/time savers and help to improve the readability of your code.

    However, I would advise to stay away from using generics. In most situations they are time savers on short-term, but they actually hurt the readability of the code and indirectly reduce non-functional quality attributes of the software you are working on. I personally avoid them like a plague.

    Quote Originally Posted by Super Vegeta View Post
    Generics are obviusly very useful for saving the trouble of copy-pasting code that is exactly the same in function, but intended to be used with different types.
    I don't agree. You can avoid copy-pasting by using refactoring properly, with the common techniques like class inheritance among others. Using generics is mostly a quick and dirty approach to a problem, so that you can quickly achieve something without proper architectural design and ignoring any existing software design patterns that may apply.

    I think generics were introduced to Pascal languages for marketing reasons, they were not really necessary. This is a similar issue to exceptions. I also rarely use exceptions myself and consider them unnecessary, similar to Joel Spolsky's opinion (he's co-founder of Stack Overflow).

  2. #2
    Of modern language features only generics are really useful.
    As it is really boring to copy/paste the same code just to create a hash map with different key/value types.
    From the other side, in Delphi generics are achievable without language support - there is an include-based approach compatible with older versions of Delphi and FreePascal.
    So I wrote a library with generic collections and algorithms based on the approach and have no need in a language support of generics.

  3. #3
    PGD Staff code_glitch's Avatar
    Join Date
    Oct 2009
    Location
    UK (England, the bigger bit)
    Posts
    933
    Blog Entries
    45
    Sorry for the potentially ignorant question, but how much of that is/will be supported by FPC?
    I once tried to change the world. But they wouldn't give me the source code. Damned evil cunning.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •