Let me tackle dynamic typing for a moment. If you think the point is to save typing, then you don't get it. The point is to let the computer worry about types, instead of the programmer. I can't count the number of times that, during the development process, I've had to propagate massive type changes throughout the program, because of a relatively simple change in the design.
In Python, you only need to change code when semantics change, not types. This makes it very easy to adopt an evolutionary software model (which I find indispensable for *hard* problems) where you quickly develop a number of prototypes and see which desgn works the best. It also greatly aids in refactoring and extending the code, again because type changes to not need to be propogated.
I'd argee, though, that Java is reasonable suitable for cases where you have a detailed design 100% spec-ed out before hand, but in many cases, your problem is simply so hard or so new, that you cannot do that.
Actually, this is a myth. Modern GC methods do not introduce a huge amount of overhead, when you take into account a few things:
- Algorithms for allocating memory in a manual management scheme can be quite complicated. Look up on how large glibc's memory allocator is. Memory allocation algorithms for GCs tend to be much simpler, often as simple as a simple pointer increment.
- Deallocation algorithms for manual memory management are often even more complicated than the allocation algorithms. They are nearly always slower. Plus, objects are deallocated one at a time. Deallocation algorithms for GC can be simpler, but most importantly, the GC can deallocate large numbers of objects at once. This is, of course, more efficient.
- Copying GCs can compact holes in memory, which makes for better cache utilization.
Depending on the problem at hand, a GC can be a little slower or about the same. For a functional programming style (which has a particular pattern of memory usage) GC is usually faster than manual management. For programs that tend to operate in phases, allocating large numbers of objects gradually and freeing them at once, GC will also be faster.
The real problem with GC is that it affects latency. Modern GCs only freeze the app for a fraction of a second, but that's a large amount of time for something like a game or movie. There are some work arounds for this, though. Latency-sensitive apps can disable GC and use manual memory management. Or, they can use a real-time garbage collector, which has guaranteed latency, but does incur a large fixed overhead. Of course, these problems can be worked around, as evidenced by the fact that major PS2 games like Jak and Daxter were written in a GC'ed language (Common Lisp). Most proponents of GC will tell you that such work-arounds are a good deal easier than hunting down memory leaks and dangling pointers!
The people buying SUVs in my area don't know what unibody construction is, or the different handling characteristics of front-wheel vs rear-wheel drive. They buy SUVs because of the commercials. And they usually skimp on the engine because its cheaper, but doesn't affect the external appearance.
I'm not against buying SUVs and trucks. We used to have an SUV. But that was when we lived in Bangladesh and getting to some places in the countryside required going over poorly maintained dirt roads (if there were roads at all). In certain parts of the US, and for certain jobs, you need an SUV.
However, most of the people where I live (Northern Virginia) only go off-road if they're not paying attention and fall into the big ditch at the end of our street. For them, an SUV is simply excessive.
Someone has to be *really* comfortable with C++ to get the benefits of it. Especially, you have to forget all your standard C/Java techniques and embrace modern C++. Once I let go and just started writing code that naturally flowed around the STL, my productivity went up enormously. I constantly see myself doing things that just wouldn't be possible in Java. For example, I was writing a wrapper class for a C data structure. I didn't want to write and maintain a whole bunch of get/set methods, but I didn't want to make the variables public. So I just wrote a dozen-line template to auto-generate the get/set methods for me, and that was that.
On the other hand, C++ is still a very irritating language at times. Its biggest problems are: - Hairy syntax (a little bit better in Java) - Complex template semantics - The need to have to deal with "classic C++" interfaces - Lack of advanced features like lambdas, type inference, etc.
Its even more productive 6 months down the road, because you realize that the language's dynamic nature allows you to extend the program without having to fuss much with the existing codebase.
Dynamic typing is really cool. It allows a much more "organic" way of developing software. You experiment for awhile to get a feel for the problem space, and churn out a prototype. Then, you can take the prototype directly to the production phase by gradually adding features, error checks, etc. Dynamic typing is especially sweet in a language like CL or Dylan, where you don't have to bother with types while developing, but can insert type declarations once the design has solidified, to enforce interfaces.
All of this is helped out greatly by having the Python interpreter handy, where you can quickly develop and test new algorithms and get immediate feedback. We're talking test-driven design without the overhead of compiling and debugging tests. And debugging is a breeze, because the interpreter allows you to interactively manipulate the code. Its like a symbolic debugger, except you get the full power of the language while debugging.
And that's before taking into account all of Python's nifty language features that Java doesn't have.
Silver bullet? Hardly. But its a huge boost to your productivity!
A skilled Java programmer could write a typical piece of code just as quickly as a skilled python programmer -------- Only if he wrote the code in Python:)
Heh. I used to do graphics programming. When I say "divide" next to "Very fast" I burst out laughing. Divides were (probably still are) so slow that anything that includes one probably can't be very fast:)
SWT is far from native speed. Resizing Windows, has much more visible redraw, is much slower than, say, in Visual Studio. It also takes a long time to load, and menus items take a long time to respond while the thing gets JIT'ed.
There were a number of problems with this benchmark, which are addressed in the OSNews thread about the article.
Namely:
- They only test a highly specific case of small numeric loops that is pretty much the best-case scenario for a JIT compiler.
- They don't test anything higher level, like method calls, object allocation, etc.
Concluding "oh, Java is as fast as C++" from these benchmarks would be unwise. You could conclude that Java is as fast as C++ for short numeric loops, of course, but that would be a different bag of cats entirely.
Its not proof of anything. Its just proof that the JIT manages to handle JIT-ing properly. All of these were simple loops where the JIT could do its work and get out of the way for the rest of the program. They are not indicative of real-world performance, unless all you are doing are such loops.
Eugenia didn't do the benchmarks, and she uses XP Pro mainly. But these where low-level numeric benchmarks. Except for the I/O one, they wouldn't have changed due to linking against different libraries.
No. The SUVs became popular just in the last few years. And the only reason you think cars have become flimsy underpowered rattle traps is because GM, Ford, and Chrysler (in decreasing order of suckiness) couldn't build a solid car to save their life. I've had an old Toyota Camry and a new Dodge Caravan. When we sold the Camry, the only sign of age was some rust damage on the underbody. The Caravan started falling apart after two years. Its only five years old now and recently the fricking rearview mirror came off!
This may very well be the only good thing he has done while in office. I have a visceral hatred for the guy, but if he honestly believes in this initiative, than I have to applaud him for it.
This is stupid because there is no one (except perhaps/bin/laden and his ilk) who would find any joy in seeing Americans have to adjust their lifestyle a bit. Most of the rest of us either don't care or do our best to emulate it anyway. ---------- That's a stupid thing to say. As an American, I want the rest of my countrymen to moderate a little more. There are some things that are just complete excess. Where I live, half the cars on the road are SUVs, and many people use them for nothing more than driving a few miles to work and dropping their kid off at school! I don't know about other Americans, but I think its sick that we consume 25% of the world's energy, while having only 5% of the world's population.
I think there should be laws to at least provide a monetary incentive to pollute less. In some industries, corporations pay to pollute. If they pollute less than they paid for, they can sell that excess capacity to other companies. That creates a competitive market for pollution credits, which has had dramatic results in driving down pollution. I'd like to see the same thing applied to individuals.
And before anybody bitches at me about liberty, let me tell you that I'm the first one to regret additional government oversight. But we live in a republic, not an anarchy. Our society recognizes that some government restrictions are necessary, and most importantly, our economic system (capitalism) recognizes that certain things are outside the bounds of the free market. These are things like national defense and a clean environment, things that everyone benefits from. A free market will produce less than the efficient quantity of these things because everybody will want to let somebody else pay for it, because they know they can still get the benefits. Government oversight is unfortunately required for such things.
I also think that the Republican party's stance on Kyoto is laughable. They ask: why should we cut more than Thailand? The answer: because we pollute more! Compare this to the answer they give when we ask: why should the rich get larger tax cuts? Because they pay more taxes?
The market makes decisions. If companies make the wrong balance between CEOs and workers, then they'll go down in flames, as you say. And when that happens, more responsible companies will take their place.
If that's the case, then competitive companies will eventually realize that hiring more/better workers and getting rid of over-priced CEOs is the thing to do. A competitive market is naturally balancing like that.
I'm not suggesting we actively discourage education. I'm saying that we shouldn't keep salaries in a particular field artificially high just to encourage people getting advanced degrees in that field. There are plenty of other fields for people to get advanced degrees in. Over time, some of those fields may become commodity, but there will be new ones to replace those. That's who capitalism works!
Read what I said again. I'm not saying that people shouldn't get advanced degrees. I'm saying that if you choose a profession that pays a low wage, its pointless to get the advanced degree. You can either stay in that profession, and forgo the degree, or choose a profession where an advanced degree will bring you a higher wage.
We can't keep wages artificially high just to get more people to get advanced degrees. That would be stupid. We are simply coming to the point, that for a large percentage of the computer programming market, an advanced CS degree really isn't useful. There are plenty of other emerging markets where an advanced degree will be useful, however. Think biotech or nanotech. Eventually, those jobs too may become commodity. In that case, they'll be new markets to get advanced degrees in. That's just how capitalism works.
"Not necessarily. If a company sells a product for $100 and costs them $50 to make it, they're not going to drop the price if it suddenly only costs them $25 to produce."
The point is, they *are* going to drop the price because the market for DVD players is close to being perfectly competitive. How do you think they got this cheap to begin with???
If the entire market moves in a single direction (e.g., moving jobs to India), the effects on the marketplace between that and the effects of a monopoly are the same: no competition. ---------- Of course not. Its just an example of a competitive market at work. One company has found a way to cut costs, and now they are all rushing go catch up. Its just like finding a cheaper supplier for a DVD player's laser, eventually, everyone will be using the cheaper supplier.
Company A can't keep it's workers on American salaries because Companies B and C move theirs to India. ------- Why would Company A *want* to keep its workers on American salaries? They should do whatever it takes to maximize production and minimize costs. That's their role in society.
There's no way Company A can compete if those are the "rules" of the game. ------- Of course Company A can compete. It does like everyone else and sends its work to India.
Therefore, we need to modify the rules so the imbalance is kept in check. ------- No we don't. The rules of capitalism are working just fine. A competitive market is a self-correcting system. If companies find that the quality loss from sending work to India costs more than they save by doing so, they'll move back until an equilibrium is established. The last thing we need is more protectionist crap. Economists even have a theory for why the public will continue to eat up protectionism, even though it hurts the economy in the long run.
Protecting cheap labor from exiting the USA is dumb. There's no real return on your investment. Protecting hi-tech jobs is smart. ------- That's a really dumb distinction. The labor market consists of a range of skills. A web scripting person might consider a factory worker to be unskilled labor, while a physicist considers a web scripting person to be unskilled labor. Where do we draw the line? We don't! Because there is no economic advantage, to us, to protect jobs that other people can do better.
Let me tackle dynamic typing for a moment. If you think the point is to save typing, then you don't get it. The point is to let the computer worry about types, instead of the programmer. I can't count the number of times that, during the development process, I've had to propagate massive type changes throughout the program, because of a relatively simple change in the design.
In Python, you only need to change code when semantics change, not types. This makes it very easy to adopt an evolutionary software model (which I find indispensable for *hard* problems) where you quickly develop a number of prototypes and see which desgn works the best. It also greatly aids in refactoring and extending the code, again because type changes to not need to be propogated.
I'd argee, though, that Java is reasonable suitable for cases where you have a detailed design 100% spec-ed out before hand, but in many cases, your problem is simply so hard or so new, that you cannot do that.
Actually, this is a myth. Modern GC methods do not introduce a huge amount of overhead, when you take into account a few things:
- Algorithms for allocating memory in a manual management scheme can be quite complicated. Look up on how large glibc's memory allocator is. Memory allocation algorithms for GCs tend to be much simpler, often as simple as a simple pointer increment.
- Deallocation algorithms for manual memory management are often even more complicated than the allocation algorithms. They are nearly always slower. Plus, objects are deallocated one at a time. Deallocation algorithms for GC can be simpler, but most importantly, the GC can deallocate large numbers of objects at once. This is, of course, more efficient.
- Copying GCs can compact holes in memory, which makes for better cache utilization.
Depending on the problem at hand, a GC can be a little slower or about the same. For a functional programming style (which has a particular pattern of memory usage) GC is usually faster than manual management. For programs that tend to operate in phases, allocating large numbers of objects gradually and freeing them at once, GC will also be faster.
The real problem with GC is that it affects latency. Modern GCs only freeze the app for a fraction of a second, but that's a large amount of time for something like a game or movie. There are some work arounds for this, though. Latency-sensitive apps can disable GC and use manual memory management. Or, they can use a real-time garbage collector, which has guaranteed latency, but does incur a large fixed overhead. Of course, these problems can be worked around, as evidenced by the fact that major PS2 games like Jak and Daxter were written in a GC'ed language (Common Lisp). Most proponents of GC will tell you that such work-arounds are a good deal easier than hunting down memory leaks and dangling pointers!
Hmmmm...a new theorum is born:
Slashdotters can't spell theorem.
The people buying SUVs in my area don't know what unibody construction is, or the different handling characteristics of front-wheel vs rear-wheel drive. They buy SUVs because of the commercials. And they usually skimp on the engine because its cheaper, but doesn't affect the external appearance.
I'm not against buying SUVs and trucks. We used to have an SUV. But that was when we lived in Bangladesh and getting to some places in the countryside required going over poorly maintained dirt roads (if there were roads at all). In certain parts of the US, and for certain jobs, you need an SUV.
However, most of the people where I live (Northern Virginia) only go off-road if they're not paying attention and fall into the big ditch at the end of our street. For them, an SUV is simply excessive.
Hotspot is the name of Sun's JIT compiler. Just in Time compilation (JIT) is the technology, Hotspot is the brand name.
Of course. I was just thinking how different different peoples' idea of "very fast" can be!
Someone has to be *really* comfortable with C++ to get the benefits of it. Especially, you have to forget all your standard C/Java techniques and embrace modern C++. Once I let go and just started writing code that naturally flowed around the STL, my productivity went up enormously. I constantly see myself doing things that just wouldn't be possible in Java. For example, I was writing a wrapper class for a C data structure. I didn't want to write and maintain a whole bunch of get/set methods, but I didn't want to make the variables public. So I just wrote a dozen-line template to auto-generate the get/set methods for me, and that was that.
On the other hand, C++ is still a very irritating language at times. Its biggest problems are:
- Hairy syntax (a little bit better in Java)
- Complex template semantics
- The need to have to deal with "classic C++" interfaces
- Lack of advanced features like lambdas, type inference, etc.
Its even more productive 6 months down the road, because you realize that the language's dynamic nature allows you to extend the program without having to fuss much with the existing codebase.
Dynamic typing is really cool. It allows a much more "organic" way of developing software. You experiment for awhile to get a feel for the problem space, and churn out a prototype. Then, you can take the prototype directly to the production phase by gradually adding features, error checks, etc. Dynamic typing is especially sweet in a language like CL or Dylan, where you don't have to bother with types while developing, but can insert type declarations once the design has solidified, to enforce interfaces.
All of this is helped out greatly by having the Python interpreter handy, where you can quickly develop and test new algorithms and get immediate feedback. We're talking test-driven design without the overhead of compiling and debugging tests. And debugging is a breeze, because the interpreter allows you to interactively manipulate the code. Its like a symbolic debugger, except you get the full power of the language while debugging.
And that's before taking into account all of Python's nifty language features that Java doesn't have.
Silver bullet? Hardly. But its a huge boost to your productivity!
A skilled Java programmer could write a typical piece of code just as quickly as a skilled python programmer :)
--------
Only if he wrote the code in Python
Heh. I used to do graphics programming. When I say "divide" next to "Very fast" I burst out laughing. Divides were (probably still are) so slow that anything that includes one probably can't be very fast :)
SWT is far from native speed. Resizing Windows, has much more visible redraw, is much slower than, say, in Visual Studio. It also takes a long time to load, and menus items take a long time to respond while the thing gets JIT'ed.
Its definitely a joke. He put it under the GNU FDL for god's sake!
According to these benchmarks it doesn't.
The short of it is that GCC 3.2.1 is highly competitive with ICC 7.0, except for two cases:
FP-intensive code on the Pentium 4
Code that allows Intel C++ to auto-generate SSE vector code for it
There were a number of problems with this benchmark, which are addressed in the OSNews thread about the article.
Namely:
- They only test a highly specific case of small numeric loops that is pretty much the best-case scenario for a JIT compiler.
- They don't test anything higher level, like method calls, object allocation, etc.
Concluding "oh, Java is as fast as C++" from these benchmarks would be unwise. You could conclude that Java is as fast as C++ for short numeric loops, of course, but that would be a different bag of cats entirely.
Its not proof of anything. Its just proof that the JIT manages to handle JIT-ing properly. All of these were simple loops where the JIT could do its work and get out of the way for the rest of the program. They are not indicative of real-world performance, unless all you are doing are such loops.
Eugenia didn't do the benchmarks, and she uses XP Pro mainly. But these where low-level numeric benchmarks. Except for the I/O one, they wouldn't have changed due to linking against different libraries.
No. The SUVs became popular just in the last few years. And the only reason you think cars have become flimsy underpowered rattle traps is because GM, Ford, and Chrysler (in decreasing order of suckiness) couldn't build a solid car to save their life. I've had an old Toyota Camry and a new Dodge Caravan. When we sold the Camry, the only sign of age was some rust damage on the underbody. The Caravan started falling apart after two years. Its only five years old now and recently the fricking rearview mirror came off!
This may very well be the only good thing he has done while in office. I have a visceral hatred for the guy, but if he honestly believes in this initiative, than I have to applaud him for it.
This is stupid because there is no one (except perhaps /bin/laden and his ilk) who would find any joy in seeing Americans have to adjust their lifestyle a bit. Most of the rest of us either don't care or do our best to emulate it anyway.
----------
That's a stupid thing to say. As an American, I want the rest of my countrymen to moderate a little more. There are some things that are just complete excess. Where I live, half the cars on the road are SUVs, and many people use them for nothing more than driving a few miles to work and dropping their kid off at school! I don't know about other Americans, but I think its sick that we consume 25% of the world's energy, while having only 5% of the world's population.
I think there should be laws to at least provide a monetary incentive to pollute less. In some industries, corporations pay to pollute. If they pollute less than they paid for, they can sell that excess capacity to other companies. That creates a competitive market for pollution credits, which has had dramatic results in driving down pollution. I'd like to see the same thing applied to individuals.
And before anybody bitches at me about liberty, let me tell you that I'm the first one to regret additional government oversight. But we live in a republic, not an anarchy. Our society recognizes that some government restrictions are necessary, and most importantly, our economic system (capitalism) recognizes that certain things are outside the bounds of the free market. These are things like national defense and a clean environment, things that everyone benefits from. A free market will produce less than the efficient quantity of these things because everybody will want to let somebody else pay for it, because they know they can still get the benefits. Government oversight is unfortunately required for such things.
I also think that the Republican party's stance on Kyoto is laughable. They ask: why should we cut more than Thailand? The answer: because we pollute more! Compare this to the answer they give when we ask: why should the rich get larger tax cuts? Because they pay more taxes?
The market makes decisions. If companies make the wrong balance between CEOs and workers, then they'll go down in flames, as you say. And when that happens, more responsible companies will take their place.
If that's the case, then competitive companies will eventually realize that hiring more/better workers and getting rid of over-priced CEOs is the thing to do. A competitive market is naturally balancing like that.
I'm not suggesting we actively discourage education. I'm saying that we shouldn't keep salaries in a particular field artificially high just to encourage people getting advanced degrees in that field. There are plenty of other fields for people to get advanced degrees in. Over time, some of those fields may become commodity, but there will be new ones to replace those. That's who capitalism works!
Read what I said again. I'm not saying that people shouldn't get advanced degrees. I'm saying that if you choose a profession that pays a low wage, its pointless to get the advanced degree. You can either stay in that profession, and forgo the degree, or choose a profession where an advanced degree will bring you a higher wage.
We can't keep wages artificially high just to get more people to get advanced degrees. That would be stupid. We are simply coming to the point, that for a large percentage of the computer programming market, an advanced CS degree really isn't useful. There are plenty of other emerging markets where an advanced degree will be useful, however. Think biotech or nanotech. Eventually, those jobs too may become commodity. In that case, they'll be new markets to get advanced degrees in. That's just how capitalism works.
We were talking DVD players. I quote:
"Not necessarily. If a company sells a product for $100 and costs them $50 to make it, they're not going to drop the price if it suddenly only costs them $25 to produce."
The point is, they *are* going to drop the price because the market for DVD players is close to being perfectly competitive. How do you think they got this cheap to begin with???
If the entire market moves in a single direction (e.g., moving jobs to India), the effects on the marketplace between that and the effects of a monopoly are the same: no competition.
----------
Of course not. Its just an example of a competitive market at work. One company has found a way to cut costs, and now they are all rushing go catch up. Its just like finding a cheaper supplier for a DVD player's laser, eventually, everyone will be using the cheaper supplier.
Company A can't keep it's workers on American salaries because Companies B and C move theirs to India.
-------
Why would Company A *want* to keep its workers on American salaries? They should do whatever it takes to maximize production and minimize costs. That's their role in society.
There's no way Company A can compete if those are the "rules" of the game.
-------
Of course Company A can compete. It does like everyone else and sends its work to India.
Therefore, we need to modify the rules so the imbalance is kept in check.
-------
No we don't. The rules of capitalism are working just fine. A competitive market is a self-correcting system. If companies find that the quality loss from sending work to India costs more than they save by doing so, they'll move back until an equilibrium is established. The last thing we need is more protectionist crap. Economists even have a theory for why the public will continue to eat up protectionism, even though it hurts the economy in the long run.
Protecting cheap labor from exiting the USA is dumb. There's no real return on your investment. Protecting hi-tech jobs is smart.
-------
That's a really dumb distinction. The labor market consists of a range of skills. A web scripting person might consider a factory worker to be unskilled labor, while a physicist considers a web scripting person to be unskilled labor. Where do we draw the line? We don't! Because there is no economic advantage, to us, to protect jobs that other people can do better.