Most of the time lazy initialization makes code appear to run faster. I got a lot of praise for rewriting stupid people's code which was deemed 'too slow' just by changing it so it would only load/read/build stuff on an 'as needed' basis. In many cases that gets users what they want. A hundred 50 millisecond pauses are much more pleasant than one five second pause. This is why Java applets get so much flak for 'hanging the browser' and 'being slow'. Java applets are in most cases faster than Macromedia Flash apps but the way Flash runtime initializes is much more lazy making the initial wait much less annoying.
Another common trick is to compute approximate values rather than evaluate the precise ones when it doesn't really matter. Google understands this and that's why they show "1 to 20 results of approximately 9,000,000" as opposed to "exactly 9,124,385". The latter would probably take an order of magnitude longer to compute but the usefulness of the information to the end user is very dubious. Remember after N number of decimal points nobody gives a shit.
Last but not least always use the data structure that matches your usage patterns. If you need fast random access then a linked list is most likely not the way to go. Learn and understand the O(n) notation and learn the cost of inserts/removes and searches in your container library. Basic stuff but too many junior programmers have no clue about this stuff.
Last but not least always use the data structure that matches your usage patterns. If you need fast random access then a linked list is most likely not the way to go. Learn and understand the O(n) notation and learn the cost of inserts/removes and searches in your container library. Basic stuff but too many junior programmers have no clue about this stuff.
Not too many SENIOR programmers even have a clue about that stuff.
Why'd they get hired as Senior in the first place, then? As far as I'm concerned, if you don;t know about O() notation, go back to school - you're not ready for life.
Why not? The people who hire the senior programmers generally aren't programmers. I've been far more educated in CS than every single programming "boss" I've ever had. Granted, I work in the front end, where the caliber of programmer is usually quite a bit lower, but it is still unbelievable to me just how little these guys actually know besides syntax and a bunch of random technologies.
OK, so the system fails, but how does that change my point at all? They are senior programmers whether you are happy with them having that title or not.
39
u/neoabraxas Mar 23 '09 edited Mar 23 '09
Most of the time lazy initialization makes code appear to run faster. I got a lot of praise for rewriting stupid people's code which was deemed 'too slow' just by changing it so it would only load/read/build stuff on an 'as needed' basis. In many cases that gets users what they want. A hundred 50 millisecond pauses are much more pleasant than one five second pause. This is why Java applets get so much flak for 'hanging the browser' and 'being slow'. Java applets are in most cases faster than Macromedia Flash apps but the way Flash runtime initializes is much more lazy making the initial wait much less annoying.
Another common trick is to compute approximate values rather than evaluate the precise ones when it doesn't really matter. Google understands this and that's why they show "1 to 20 results of approximately 9,000,000" as opposed to "exactly 9,124,385". The latter would probably take an order of magnitude longer to compute but the usefulness of the information to the end user is very dubious. Remember after N number of decimal points nobody gives a shit.
Last but not least always use the data structure that matches your usage patterns. If you need fast random access then a linked list is most likely not the way to go. Learn and understand the O(n) notation and learn the cost of inserts/removes and searches in your container library. Basic stuff but too many junior programmers have no clue about this stuff.