Skip to main content

Home/ ProgrammingPages/ Group items tagged templating

Rss Feed Group items tagged

Navneet Kumar

Bruce Eckel's MindView, Inc: 3-10-04 Generics Aren't - 0 views

  • Generics seem to only solve the problem of automatically casting in and out of containers.
  • So if we write generic code that actually takes a "type of anything," that type can only be an Object, and our generic code must only call Object methods on it.
  • generics have no advantage. In fact, it's confusing if you see them used, because you scratch your head and wonder "why does he need a generic here? What is the advantage?" Answer: none.
  • ...3 more annotations...
  • Java Generics use "erasure," which drops everything back to Object if you try to say "any type." So when I say <T>, it doesn't really mean "anything" like C++/ADA/Python etc. does, it means "Object."
  • So generics are really "autocasting."
  • That's the way of the Java world, and we are going to miss out on latent typing (it's actually possible to simulate latent typing using reflection, as I do once or twice in Thinking in Java, but it's messy and much less elegant).
  •  
    bruce Eckel article on java generics, and how it does  nothing more than  autocasting. Also templating or parameterized type in C++, Ruby, Python
Navneet Kumar

Ken Arnold's Blog: Generics Considered Harmful - 0 views

  • this: Enum is actually a generic class defined as Enum<T extends 
  • When used in public interfaces, generics are also invaluable to enforce correctness, prevent bugs and reduce testi
  • generics is reifying type relationships that are otherwise implic
  • ...4 more annotations...
  • The problem is that generics don't get on with arrays. The solution is obvious: ditch arrays. From a practical point of view, there's not a great deal of point in returning arrays from methods instead of collections of s
  • Note the circular reference in "Unique<T extends Unique>" It means that the implementing class needs to provide another unique class as the namespace for it's Id's. The really freaky thing is that it can provide itself. :) These two interfaces enable a way to describe uniquely identified objects with heirarchical namespaces in a typesafe manner. How much complex code did that save?
  • ype". You only need generics in strictly typed function dispatch languages like C++ and Java. You don't need them in message passing dynamically typed languages like Smalltalk and Objective C. To work around the first rule - "strict static typing doesn't really work all the time", we get hacks like templates and generics
  • call the Elvis/Einstein b
  •  
    discussion on java generics, too complex, dangerous or useful, type safety, when n how to use
Navneet Kumar

Velocity - Velocity User Guide - 0 views

  •  
    user guide to velocity templating engine
1 - 3 of 3
Showing 20 items per page