Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Sometimes there's a local minimum, where you really need to rethink the whole chunk you're working with to come up with a better design. If you're in this situation, which you can get to gradually, there's might be no easy way to refactor a piece at a time. But this isn't (ever in my experience, at least) because a super-length function is really the best solution, but because the design wasn't great in the first place.


When I last tinkered with PHP they did not have lexical scoping. That makes refactoring stuff out into separate functions a pain in the head.


They still don't.

And, as I pointed out above, we don't even use classes. This might seem crazy, but this project was started before PHP had actually decent objects, and now all the special workarounds have become part of the house style. So I'm living in a world of pure procedural programming right now. It's the 70s again.


I dunno about 10 years ago, but for a long time now, you could just use a class to avoid globals and still keep some handy variables around. It's slightly painful (I came from Python, and I still end up typing $objectname.methodname() and then going back and putting in '->'), but not nearly so much as I used to think before I had to work with PHP every day. :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: