It is *not* just as easy in Java to base your program on immutable objects. It is *possible* to program using immutable objects, especially for classes you wrote yourself but it's certainly not *just as easy*. GP is correct when he says that Java et al encourage mutable programming. Here are some examples:
1. Variable in Java are mutable by default. You can add "final" but that's not the line of least resistance. 2. All existing libraries use mutable objects. Good luck doing *any* Java without relying on *lots* of existing libraries. 3. All collections/data structures are mutable. Maybe you can find some immutable collections/data structures for Java but it's not exactly mainstream. And you won't be able to iterate over them since Iterator is inherently mutable. 4. Immutability interacts badly with inheritance. In your constructor, you call super and then you mutate. 5. Most of the advanced techniques for dealing with immutable structures really need to work with functions, which aren't a first class concept in Java (they're normally buried inside objects - to manipulate them you're normally looking at reflection or AOP).
It *is* possible to reduce your use of mutable objects compared with typical Java usage and it's a good idea to do so - by all means put "final" everywhere you can. But mutating objects isn't just a particular style in Java, it's pretty much mandatory.
And it's much the same in any OO language. On the JVM, if you want immutability you'd typically be looking at something more like Scala (its FP subset) or Clojure.
That's true but that's just because association lists are simple; they're rarely the most performant data structure.
In data parallel Haskell, which is there the difference between the two representations matters, the compiler will use the more efficient representation while letting you write code against the more convenient representation. Not an easy task for the compiler - for example, they had to implement Type Families as part of the project. Haskell's parallel support isn't fully-baked yet but it's leading the way.
Agreed, there's a lot in IntelliJ but not in VS. But Resharper gives VS most of the IntelliJ goodness. For example, in my copy of Visual Studio structural code search is on the "Resharper/Find/Search with Pattern..." menu.
I really really like IntelliJ - I'm using it in my current (Java) project all the time. But Visual Studio with Resharper (from the nice people who brought you IntelliJ) has all the good stuff from IntelliJ and that gives Visual Studio a comfortable edge in my opinion.
IntelliJ does have some useful features I can't seem to find in Visual Studio though - it can visualise WSDL no problem but I can't find the equivalent feature in Visual Studio.
2D messed up big time on PCs running Windows 7? I don't think so. WDDM *was* a mess in Vista, since it ate so much RAM but that's fixed in Windows 7 (by using the 3D hardware more). Sure, there are scenarios where Windows 7 needs to read back a bitmap from the GPU but it doesn't impact many people very often. In contrast, GPU-accelerated browsers (2D applications!) are a big win for most everyone.
Can you give me a scenario that's a problem for you?
I'd not heard of cssh, it looks cool. I'll check it out. Powershell's built-in job management looks pretty similar but of course it only works on windows (and even then you really need modern windows).
Some example Scripts:
Here's the script that's in my current directory right now. Wouldn't say it shows anything dramatic above bash though. param($projects = ("common", "ccs-common", "ihdcc"))
function build-project($project) {
$trunkDir = "$project\trunk"
if (-not (test-path $trunkDir)) {
ls | ?{ test-path "$_\trunk" }
throw "Project $project not found"
}
try {
pushd $trunkDir
mvn clean install war:inplace
if ($LastExitCode -ne 0) {
throw "Project $project did not build."
}
# "-Dmaven.test.skip=true"
#mvn eclipse:clean eclipse:eclipse
}
finally {
popd
} }
$projects | %{ build-project $_ }
Here's another one. It shows manipulating an XML configuration file. $configPath=c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config $cfg = [xml](cat $configPath) $cfg.configuration.connectionStrings.add.connectionString="data source=.\SQL" $cfg.WriteTo($configPath)
Extract the product name from the version stamp on any file in the current directory or child directories: ls -recurse | where { $_.psIsContainer } | select -expand versioninfo | select productname
If your incredibly valuable scripts run on xp, they'll run on 7. Powershell is available for xp but not installed by default - some things that powershell can access, such as wmi aren't as capable on xp. If you like writing vbscript or.bat or.cmd, go right ahead.
Powershell is only available on windows though, you're right about that. As for its relationship to the unix CLI experience, well it's got a lot of similarities but lots of differences too. The shell is dramatically better for scripting than bash, say. For a complex script you'd probably switch to perl/ruby at some point on unix or suffer the rather horrid bash syntax. I prefer tab completion on bash - powershell's is technically more powerful but bash's is more mature. The fact that every unix machine has ssh and is designed for terminals is a big win for unix. ws-management isn't open by default on windows boxes and the remote command-line's a bit laggy. On the other hand, powershell's built-in abilities to run a bunch of jobs on an array of machines and collate the results in the background is a pretty big win for windows - you're looking at either a management suite or a lot of scripting for that on unix (it's done on unix all the time of course but posh is pretty nice in this area).
I doubt microsoft are going to replace posh any time soon. Took them about 25 years to replace their previous command-line shell.
vbscript/COM scripts work in 7 too, don't they? But 7 has Powershell 2 installed by default and its wmi's far more capable and approachable than on xp. And wasn't your point that a unix shell was better at handling remote systems? Well it's much easier to manage large numbers of windows 7 boxes remotely than xp boxes (though with ubiquitous ssh and terminal handling, unix is probably still ahead, especially since admins are more used to scripting it).
They don't want mouse clicks in the same event queue as disk and network I/O. Windows is a bullshit design and it will never be adequate.
Back end data centre applications *don't* have mouse clicks in the same 'event queue' as disk and network I/O - even on Windows. Single-threaded GUI app, sure. But not server-based applications. Services and web apps don't even have message pumps to pick up mouse clicks. Windows messages do sometimes turn up in places where you'd not expect but it's nothing that'd make it 'inadequate'.
There are of course plenty of other reasons why one might reasonably choose another OS for your data centre but mixing mouse clicks and I/O isn't one of them.
It is *not* just as easy in Java to base your program on immutable objects. It is *possible* to program using immutable objects, especially for classes you wrote yourself but it's certainly not *just as easy*. GP is correct when he says that Java et al encourage mutable programming. Here are some examples:
1. Variable in Java are mutable by default. You can add "final" but that's not the line of least resistance.
2. All existing libraries use mutable objects. Good luck doing *any* Java without relying on *lots* of existing libraries.
3. All collections/data structures are mutable. Maybe you can find some immutable collections/data structures for Java but it's not exactly mainstream. And you won't be able to iterate over them since Iterator is inherently mutable.
4. Immutability interacts badly with inheritance. In your constructor, you call super and then you mutate.
5. Most of the advanced techniques for dealing with immutable structures really need to work with functions, which aren't a first class concept in Java (they're normally buried inside objects - to manipulate them you're normally looking at reflection or AOP).
It *is* possible to reduce your use of mutable objects compared with typical Java usage and it's a good idea to do so - by all means put "final" everywhere you can. But mutating objects isn't just a particular style in Java, it's pretty much mandatory.
And it's much the same in any OO language. On the JVM, if you want immutability you'd typically be looking at something more like Scala (its FP subset) or Clojure.
That's true but that's just because association lists are simple; they're rarely the most performant data structure.
In data parallel Haskell, which is there the difference between the two representations matters, the compiler will use the more efficient representation while letting you write code against the more convenient representation. Not an easy task for the compiler - for example, they had to implement Type Families as part of the project. Haskell's parallel support isn't fully-baked yet but it's leading the way.
Agreed, there's a lot in IntelliJ but not in VS. But Resharper gives VS most of the IntelliJ goodness. For example, in my copy of Visual Studio structural code search is on the "Resharper/Find/Search with Pattern..." menu.
So I see VS+Resharper as being ahead of IntelliJ.
I really really like IntelliJ - I'm using it in my current (Java) project all the time. But Visual Studio with Resharper (from the nice people who brought you IntelliJ) has all the good stuff from IntelliJ and that gives Visual Studio a comfortable edge in my opinion.
IntelliJ does have some useful features I can't seem to find in Visual Studio though - it can visualise WSDL no problem but I can't find the equivalent feature in Visual Studio.
2D messed up big time on PCs running Windows 7? I don't think so. WDDM *was* a mess in Vista, since it ate so much RAM but that's fixed in Windows 7 (by using the 3D hardware more). Sure, there are scenarios where Windows 7 needs to read back a bitmap from the GPU but it doesn't impact many people very often. In contrast, GPU-accelerated browsers (2D applications!) are a big win for most everyone.
Can you give me a scenario that's a problem for you?
Why would you think that? If parent poster did so, would you indeed engage with the argument? Looks to me like they don't think you would.
Perhaps it would be easier to debate a more limited statement: "Biology has a well known Liberal bias", perhaps?
http://www.gallup.com/poll/27847/majority-republicans-doubt-theory-evolution.aspx
I'd not heard of cssh, it looks cool. I'll check it out. Powershell's built-in job management looks pretty similar but of course it only works on windows (and even then you really need modern windows).
Some example Scripts:
Here's the script that's in my current directory right now. Wouldn't say it shows anything dramatic above bash though.
param($projects = ("common", "ccs-common", "ihdcc"))
function build-project($project)
{
$trunkDir = "$project\trunk"
if (-not (test-path $trunkDir)) {
ls | ?{ test-path "$_\trunk" }
throw "Project $project not found"
}
try {
pushd $trunkDir
mvn clean install war:inplace
if ($LastExitCode -ne 0) {
throw "Project $project did not build."
}
# "-Dmaven.test.skip=true"
#mvn eclipse:clean eclipse:eclipse
}
finally {
popd
}
}
$projects | %{ build-project $_ }
Here's another one. It shows manipulating an XML configuration file.
$configPath=c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config
$cfg = [xml](cat $configPath)
$cfg.configuration.connectionStrings.add.connectionString="data source=.\SQL"
$cfg.WriteTo($configPath)
Extract the product name from the version stamp on any file in the current directory or child directories:
ls -recurse | where { $_.psIsContainer } | select -expand versioninfo | select productname
Here's how to create Exchange mailboxes in bulk from a csv file.
http://www.exchangeninjas.com/BulkCreateMailboxes
Running commands against remote servers:
$servers = server1,server2,server
invokecommand -computer $servers { ls }
Using some arbitrary library object:
(new-object -com SAPI.SpVoice).speak(“Hello, I am a computer”)
A hash table:
$lookup = @{ "a"=1; "b"=2; "c"=5 }
$five = $lookup["c"]
If your incredibly valuable scripts run on xp, they'll run on 7. Powershell is available for xp but not installed by default - some things that powershell can access, such as wmi aren't as capable on xp. If you like writing vbscript or .bat or .cmd, go right ahead.
Powershell is only available on windows though, you're right about that. As for its relationship to the unix CLI experience, well it's got a lot of similarities but lots of differences too. The shell is dramatically better for scripting than bash, say. For a complex script you'd probably switch to perl/ruby at some point on unix or suffer the rather horrid bash syntax. I prefer tab completion on bash - powershell's is technically more powerful but bash's is more mature. The fact that every unix machine has ssh and is designed for terminals is a big win for unix. ws-management isn't open by default on windows boxes and the remote command-line's a bit laggy. On the other hand, powershell's built-in abilities to run a bunch of jobs on an array of machines and collate the results in the background is a pretty big win for windows - you're looking at either a management suite or a lot of scripting for that on unix (it's done on unix all the time of course but posh is pretty nice in this area).
I doubt microsoft are going to replace posh any time soon. Took them about 25 years to replace their previous command-line shell.
I still prefer grep to select-string though.
vbscript/COM scripts work in 7 too, don't they? But 7 has Powershell 2 installed by default and its wmi's far more capable and approachable than on xp. And wasn't your point that a unix shell was better at handling remote systems? Well it's much easier to manage large numbers of windows 7 boxes remotely than xp boxes (though with ubiquitous ssh and terminal handling, unix is probably still ahead, especially since admins are more used to scripting it).
Try googling "set computer name powershell".
set-computername "oldname" "newname"
See http://poshcode.org/541
vbscript is something you only have to work with on Windows XP.
They don't want mouse clicks in the same event queue as disk and network I/O. Windows is a bullshit design and it will never be adequate.
Back end data centre applications *don't* have mouse clicks in the same 'event queue' as disk and network I/O - even on Windows. Single-threaded GUI app, sure. But not server-based applications. Services and web apps don't even have message pumps to pick up mouse clicks. Windows messages do sometimes turn up in places where you'd not expect but it's nothing that'd make it 'inadequate'. There are of course plenty of other reasons why one might reasonably choose another OS for your data centre but mixing mouse clicks and I/O isn't one of them.
HTTP 1.1 is a big improvement over HTTP 1.0. That's progress. And CSS is a big step forward too. That's progress too.