When you should and should not use the 'new' keyword?

Posted by skizeey on Programmers See other posts from Programmers or by skizeey
Published on 2011-10-24T18:02:50Z Indexed on 2012/12/11 17:23 UTC
Read the original article Hit count: 366

Filed under:
|

I watched a Google Tech Talk presentation on Unit Testing, given by Misko Hevery, and he said to avoid using the new keyword in business logic code.

I wrote a program, and I did end up using the new keyword here and there, but they were mostly for instantiating objects that hold data (ie, they didn't have any functions or methods).

I'm wondering, did I do something wrong when I used the new keyword for my program. And where can we break that 'rule'?

© Programmers or respective owner

Related posts about testing

Related posts about unit-testing