Hacker Newsnew | past | comments | ask | show | jobs | submit | curiousCoffee's commentslogin

Can you expand on "We're in the best market since forever."? Just interested


Does anyone write in style C and then refactor to style A/B? That gives you all the benefits of both styles..


No, the problem with style A and B is that smallFunction() might have only been correct under the context of it executing inside largeFunctionA(). IMO this risk is actually increasing even more if it originates from a refactoring from style C, since you didn't design smallFunction() from bottom up considering all possible use cases, you most likely just highlighted a random block in largeFunctionA() because it was getting too big and clicked "extract method" in your IDE.

Imagine two months later someone writing largeFunctionB() is browsing around the code and finds smallFunction(), thinking it will do the job he requires but actually it has a hidden bug that was never triggered under the context of it executing in largeFunctionA or under the limited input range that largeFunctionA was using.

See in particular this paragraph from the article:

    Besides awareness of the actual code being executed, inlining functions also 
    has the benefit of not making it possible to call the function from other 
    places. That sounds ridiculous, but there is a point to it. As a codebase grows 
    over years of use, there will be lots of opportunities to take a shortcut and 
    just call a function that does only the work you think needs to be done. There
     might be a FullUpdate() function that calls PartialUpdateA(), and 
     PartialUpdateB(), but in some particular case you may realize (or think) that
     you only need to do PartialUpdateB(), and you are being efficient by avoiding 
     the other work. Lots and lots of bugs stem from this. Most bugs are a result 
     of the execution state not being exactly what you think it is.


Oh yeah I see what you mean. Do you think all smallFunction()s should be generic/reusable?

Seems like it's the fault of the second developer for using the smallFunction() without understanding what it does.


Flexibility. I always start using travel sites but their formats are always so rigid that I'm forced to change the way I do things or I am forced to stop using it.

I always go back to excel.


What is hot swapping?


Replacing code while it's running. Currently this is possible but quite limited in the official JDK, you can only replace the contents of method bodies.

Edit: Demo of it in action here, notch is rapidly developing a game in Eclipse by changing the code while it's running: https://www.youtube.com/watch?v=rhN35bGvM8c


notch is rapidly developing a game in Eclipse

He's modifying the Swing object tree from the main thread! Don't do that, Swing isn't thread safe ;-)

https://www.youtube.com/watch?v=rhN35bGvM8c#t=1454

http://docs.oracle.com/javase/7/docs/api/javax/swing/package...


There's always JRebel!



Oh, damn! I just started using jrebel.. (I know I asked what hotswapping was but I was curious if the OP meant hotswapping in the same way as jrebel or something else)

edit: Wait, that is liverebel, not jrebel


Ah, sorry! I though liverebel was the new name.


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

Search: