On 2011-05-27 12:27, Jacob Carlborg wrote: > On 2011-05-27 16:38, Matthew Ong wrote: > > On 5/27/2011 9:37 PM, Jacob Carlborg wrote: > >> When coding my own projects (projects I've written from scratch and not > >> ported from other languages) it's a feature I rarely use, don't know if > >> I ever have used it. > > > > Actually from scratch is NOT a good approach and migration approach. How > > do you > > justify this to business management people or to your client? There are > > also your > > learning cycle time. > > Of course, from "scratch" can be interpreted in different ways. I use > the standard library and other libraries I need. But often when > developing tools for D one can't use already existing tools because they > don't support D or, in my opinion, aren't good enough. BWT, I don't have > to justify my own private projects to anyone. One last thing: what's > wrong with developing something from scratch just for the fun of it or > for learning something from it :)
Whether reimplementing from scratch or doing a more direct port makes more sense depends entirely on what you're doing. And when it's a personal project that you're doing for fun, it's that much more subjective than it would be when working on a project for work. It's definitely best to use as much knowledge as can be gained from the original code as best as possible when porting it to another language, but whether the actual code should be directly ported or just the basic ideas is very much dependent on the code and the situation. Sometimes it would be just plain stupid to rewrite the code, and in others, directly porting it would be a bad move. I recently started on a port of Haskell's Parsec library to D, since I think that it's an absolutely fantastic parsing library. And being as how the original library is in Haskell (which you're _definitely_ not going to port directly to D) and how I wouldn't necessarily want to use whatever the original license is, it just plain makes more sense to take the basic ideas (and to some extent API) of the original and create a D version that applies those. Porting the code directly would make no sense. With something like DWT on the other hand, doing a direct port and thus minimizing the effort of porting changes to it later would make a lot more sense (particularly since Java is a lot closer to D than Haskell). But whether "writing it from scratch" or not is the best choice depends very much on the code, your situation, and your goals for the project. It's not a black and white choice. - Jonathan M Davis
