Huawei is there, as well as several Beijing companies.
My emphasis on Chinese was tongue-in-cheek. They get a few days advantage to develop scanning signatures. Yes, some of them may go rogue or (more likely) some of the employees. I would think that is why they only get a few days head start and not several months.
Please be a bit precise here. What exactly is claimed have Microsoft and Google given to the NSA? And how exactly do we "know"?
Come on now. There's a powerpoint that proves it all.
It just needs a little imagination/fantasy and some extrapolation, then it is conclusive, irrefutable proof that the big companies have *all* of them given NSA direct electronic access to the companies' servers to perform any kind of snooping they desire with no judicial oversight.
MS gives advance information about security patches to AV vendors. The intention is to allow those AV vendors to create scanning signatures which will enable AV products to pick up the attacks. Attackers have show a lazy tendency to just reverse engineer patches instead of finding vulnerabilities themselves. Less than 1% of attacks are zero-day attacks these days.
Some of AV vendors that receive such vulnerability information are foreign companies. Yes. Some of those AV companies are Chinese.
Is it not reasonable to afford the NSA the same advance warning? The advance warning is a few days before the patch is made public, around the same time that the public receive advance notification (with less details than the AV companies and NSA). It is not like they have months to exploit it.
But tinfoil hatters and Microsoft haters always spin it as something nefarious. There is *nothing* to suggest that there are NSA backdoors in Windows or any other OS for that matter.
With the new Laravel PHP framework winning RoRs and CodeIgnitor converts by the thousands
Citation needed. Why does the summary contain this blurb which is not even relevant to the story. Me suspects that the submitter could be an advocate who just ceased on an opportunity to tell slashdot about his favorite PHP framework.
it has specifically licensing it to the public and has the capacity to shutdown Mono at any time.
*sigh* unfortunately this comment is going to attract a lot of MS chills repeating ad nauseam phrases like "community promise" and "estoppel".
You are obviously aware of it, so why do you continue to spread this FUD? I find it especially ironic in a discussion about comparison between Java and C#, where only one of the vendors have actually tried to sue. And it is not Microsoft.
The history with the community promise is that first Microsoft submitted C# and the core libraries to ECMA and ISO for standardization. In doing so Microsoft committed to offer license for any patents essential to implementation under RAND terms (Reasonable And Non Discriminatory).
"IT IS A TRAP" cried the FOSS community! "While they may be forced to license the patents they can still sue and open source projects cannot afford a trial against Microsoft, so they can still force Mono underground!!"
Microsoft then ALSO placed C# specification and core libraries under it's community promise. Such a promise has (as you pointed out) legal estoppel - which in layman's terms means that if Microsoft sues you can invoke the unilateral promise and have the case dismissed.
You may be correct that if we follow your wild FUD that Microsoft can sell off an essential patent and that way wiggle out of the estoppel promise. Then again you could very well be wrong, because the legal basis of the estoppel is that you acted in good faith. A buyer of the patent cannot change the fact that you acted in good faith.
But your FUD is a strawman anyway, since you have not explained how Microsoft could escape the patent grant they have given to anyone who implement C# and core libraries. Such grants cannot be revoked by a buyer of a patent.
The gist of it is that rather than an actual license MS published a statement, a (quote) "promise not to sue".
You are wrong. The promise not to sue came after MS granted anyone who requests it a free license on any essential patent necessary for the implementation of C# and/or core libraries.
And now get ready for the flurry of comments defending.NET most of which will fall in one of the following 4 categories.
With the amount of FUD, inaccuracies, speculation and free fantasy you should certainly expect to be corrected.
If you look at the lambda examples from Java 8 it looks like the collections API now mimic LINQ.
But still no expression trees and no ad-hoc anonymous types so nothing resembling LINQ to Entities, LINQ to Twitter etc.
Dynamic support in Java is called Invoke Dynamic and available in Java 7.
The dynamic support in Java is in the VM only. You cannot use foreign language objects as first class objects from within Java. Essentially, Javas dynamic support was created to make dynamic languages on the Java VM platform not suck. It is not a Java language feature.
C#s dynamic feature is support for dynamic languages the same way, but also lets you create objects in a foreign language and pass those to C# where they can be used as first-class objects.
As for async; Java has the concurrency package to make up for that.
Javas concurrency package is roughly on par with.NETs System.Threading.Tasks and System.Collections.Concurrent..NETs tasks are more elegant due to the ability to use lambdas
Async/await goes beyond that and introduces syntactical notation where you can write asynchronous code and let the code resemble the logical flow even though dynamically the code executes asynchronously, i.e. the thread leaves and execution continues later when the event that is being awaited occurs.
Especially since what it actually does, doesn't seem to match up with what they tell you it does. At least in the simple cases they use for examples.
Citation needed. Care to elaborate?
Grand Central Dispatch has had similar functionality. The key differences being that Await has more concise syntax for the simple cases, but it gets progressively uglier the more complicated your cases become (such as awaiting a group of tasks that can all be done in parallel to each other
You mean like await Task.WhenAll(task1, task2, task3); ? You find that too complicated? I am curious how you would make that code simpler in Java, Objective-C or C?
GCD's syntax starts off somewhat ugly
Indeed
..., but doesn't really change as you do more complicated things, partly because the syntax already assumes you probably want to use blocks/lambdas by default so you can spin off 2-3 lines of code that don't really need a full function.
Apart from being verbose and ugly, GCD still does not solve the problem with composability of asynchronous operations. GCD is the equivalent of TPL (Task Parallel Library) in.NET or Futures in Java.
To be fair async still uses threadpools and you have to be careful how you use it so you don't starve it
That is incorrect. async does not use thread pools. Async by itself says nothing about threads, and - more importantly - it will NEVER spin up a thread or take a thread from a threadpool by itself.
It is true that you can start parallel execution yourself and then use async/await to synchronize, but async/await is really a more fundamental concept compared to threads.
95% of those java bugs are for the browser plugin. Last time I checked, activeX didnt have a great track record either. They both find about the same amount of server issues..Net just sells their extra vulnerabilities to the NSA rather than fixing them.
No they are not. They are all over the runtime and library: Libraries, Hotspot, JavaFX, AWT (many), 2D, serialization, reflection, JAXP, RMI, beans, JAX-WS, etc etc. They are amplified by the fact that many of them are indeed in a library/feature that can be accessed through applets from remote. But the vast majority of the vulnerabilities exists isolated from the applet and could be exploited through other channels.
ActiveX has nothing to do with.NET.
And even so, there has been precious few vulnerabilities in ActiveX. The problem with ActiveX was that the model allowed foreign code to execute non-sandboxed on your machine, so that a bug in a control could have (and had) dire consequences. In that regard, ActiveX resembles SUID on *nix: You check at the gate and if the subject appears to have legitimate papers you let him in and assume that he'll be well-behaved. Just like with SUID where a bug in a SUID root tool may lead to system compromise, a bug in an ActiveX control could let the attacker run his own code with your credentials.
Microsoft has also had the benefit of Anders Hejlsberg being the lead architect, one of the best minds in the industry. There are maybe a handful of people in the industry today that can stand at the same level as him, and none currently alive that can stand taller. Hiring him away was a major boon to Microsoft and a crushing blow to Borland.
As much as I love to code in C#, I think that Martin Odersky is at least as smart and knowledgeable as Anders Hejlsberg. I've seen them debate each other and IMHO Martin came out looking somewhat better. And Scala is no small feat.
"Generator methods" I'm assuming you're talking about re-implementing common framework service implementations, and if so Java has a ton of non-standard techniques to do this that most developers work with. It'd be nice if they were more consistent of the implementation though.
No, I'm talking about the ability to create methods that use the yield return and yield break syntax to implement infinite sequences or just allow me to yield items of a sequence and allow the consumer to process each item as it is produced rather than creating the entire sequence before returning.
Async/await are language extensions that allow you to write asynchronous code as if it were synchronous. Note how it is NOT about parallel/threads (although that is also a use case) but a much more fundamental concept of asynchronicity. As such you can compose asynchronous calls with branches, loops, try-catch blocks etc. Without such language support you will have to rely on futures/promises that are implemented in separate methods. Thus, you cannot easily loop over such futures/promises as they span method boundaries. Add try-catch blocks to the mix and it becomes unwieldy.
C# async/await solves the problem elegantly and allows you to compose async methods in a straightforward manner.
The big limitation is tail processing in java, but there are third party frameworks that make resuming blocks easier (though not a first class language feature). When you introduce this to a top level, you have to handle what to do with that now parked thread stack and how to clean it up when something bad happens. Its not a trivial problem, but hopefully one that lambda expressions will iron out in Java 8.
You can hope. Meanwhile the problem has been solved in C#: There is no "parked thread stack" as there is no extra thread. Instead the compiler will perform some really clever rewriting and turn your code into a state machine to implement the logical flow while allowing the thread to exit out of the code (to be continued at the same state later).
I don't use C#, however last I looked all of its features were borrowed from other preexisting languages, same as Java. Is there something new and Microsoft for once in its life has done something novel?
LINQ is a pretty big deal. I don't know of any language that has something similar. LINQ itself is comprised of a number of language constructs such as expression trees, extension methods, type inference, anonymous types.
Async/await is huge! Right there, MS looks to leapfrog other platforms by allowing developers to create robust, asynchronous programs that doesn't need to spin up threads (or use threadpools) to achieve perfectly composable asynchronous methods.
Dynamic support (statically typed to be of dynamic type) allows the best from dynamic languages to be used from within C#, even interop'ing with dynamic languages and e.g. use an object created in Ruby as a first-class object in C# (or vice versa).
OK... so is what you're saying that there is a greater difference between the two runtimes than what TFA says, because.NET doesn't have the possibility of heap pollution? Something like that?
Type erasure foregoes a number of constructs available with reified generics in C#:
* Support for primitive/simple and value types without boxing/unboxing overhead * Ability to use typeof() operator (.class in Java) on generic parameters * Ability to create new instances of generic parameter types (with the C# new() constraint) * Ability to declare, throw and catch generic exceptions. * No per-realization static scope. Statics behave strangely in Java generics as all realizations share static members.
There are other more esoteric restrictions because of Java type erasure (yes, heap pollution is one of them).
Also consider that C# generics are fully verified at compile/load time, whereas Java generics need to perform downcasts at runtime, every time you return something that is of a generic parameter type.
None of them huge restrictions - until you hit upon them and realize that you will have to create strange code to circumvent them.
I'm wondering how C# async methods got skipped. Because there's nothing similar in Java?
Async/await is huge. It makes composing async methods as terse as regular synchronous code. Unlike with the library defined task/future models, async/await adds a composable model which lets you write async methods that can loop, branch, try-catch etc. while staying perfectly async.
Um, as someone who is somewhat (but not only somewhat) familiar with generics in both systems, I don't see anything in TFA's explanation which is misleading or incorrect, nor contradicted by your link. Care to elaborate on what you mean?
I can help. The author claims this:
Java, however, uses a method called type erasure. Essentially, the type checking only happens at compile time. The actual container types internally could still hold any type, but the compiler explicitly stops you from attempting to put other types into the containers.
That is wrong. In Java, type checking happens at *runtime*. During the type erasure the compiler will add downcasts into the code which will be evaluated at runtime. When a collection has been declared with item type as Person, you can insert Person specializations into it, like Student or Teacher. But because of type erasure the collection will in reality be a Object collection. Hence, when you read from the collection the compiler must ensure that it is indeed a Person being read.
Nevermind how the authors hastens to apologize for the shortcomings of type erasure. He also fails to mention one very big difference: Java generics do not support primitive/value types. Storing Integers in collections incur a significant overhead compared to int's because of boxing, heap allocation, unboxing and garbage collection.
Huh? I thought java did have multidimensional arrays.
No, Java allows you to declare arrays of arrays - also called "jagged" arrays because not every "sub-array" need to have the same length (you can assign different arrays after initialization). Arrys of arrays are not multidimensional arrays, however.
C# allow you to declare both "jagged" arrays of arrays as well as true multidimensional arrays.
In some (limited) situations the true multidimensional arrays will slightly outperform jagged arrays. This happens if you mostly access random cells of the array. In that case the true multidimensional array will only require a integer multiplication and an array indirection. Jagged arrays will always require two array indirection accesses.
Async methods (huge!) Generator methods Partial classes/methods Reified generics LINQ (as in LINQ to objects, LINQ to Entities, LINQ to XML - all part of the core framework) Dynamic typing and -interop Value types Operator overloading Implicit/explicit type conversions
The broadcast just need to be signed using a private key. Every handset can hold the public part. If the private key is 2048 bits or longer you can assign the IDs sequentially if you prefer; faking the broadcast will be as hard as it is to break the 2048 bit key - which takes *a lot* of time for 2048 bit keys.
Tell them to make a version of DBT_DEVICEARRIVAL that doesn't require you to have a window handle to get the callback to the message pump so that you don't have to poll using PeekMessage().
AddDevice routine is used by device drivers to be notified when their device arrives at the bus (e.g. an USB bus).
Services can use the RegisterDeviceNotification function to register to receive device notifications. If a service specifies a window handle in the hRecipient parameter, the notifications are sent to the window procedure. If hRecipient is a service status handle, SERVICE_CONTROL_DEVICEEVENT notifications are sent to the service control handler. For more information about the service control handler, see HandlerEx.
Really!
The notifications need to be able to go to windowless services.
Yes, agree. But they can. It is right there in the documentation.
Then tell them that RegisterDeviceNotification() is useless for detecting new iPod/iPhone/iPad devices because it require matching a GUID that has not been defined at the time that the service was written, and that having to update the service by having to update iTunes each time you buy a new device before the plugged in device is recognized as launching iTunes because you don't get a broadcast notification in that case, which you can then use to open up the device temporarily to probe it further ("Hi, USB device, are you an Apple Device?") rather than using a stinking GUID.
That's the thing with GUIDs: It is perfectly safe to choose them during *development*. Generating a guid for a device or an event virtually guarantees that no other device or event will use the same ID. The main problem with GUIDs is that such "well-known" guids needs to be documented. But if Apple writes the device driver that broadcasts the event, surely they can find a way to use the clipboard and use the same GUID during notification registration.
Then you can call up Motorola, and tell them so they can update their PhoneTools Software, because they have the same problem.
I wasn't aware that they are eating CPU like iTunes. Citation?
... the DataPilot folks, who have no idea in heck what the phone GUID would be when you plug in your stupid random phone, particularly if you are using their DataPilot Universal PRO Kit, which connect up to almost all the phones from Apple, Motorola, LG, Samsung, Sanyo, Sony Ericsson, and Audiovox.
I have more concrete examples, but I think you get the point.
not really, no. Do they eat CPU cycles polling like the crApple software?
The current Microsoft APIs do not solve this general problem; they require either an open application window, or they require a service which polls.
Wrong. Read the documentation. I linked to it and quoted it above. It really is not that difficult.
You still have not told us where Microsoft recommends polling, as per your claim:
And worse? Some of the documentation specifically says they want it that way! On purpose!
[HAL] it's a nightmare of convoluted and badly-documented objects and methods. I won't go as far as to say whoever decided to go with polling instead of event-driven made a great design choice, but I can understand how, after days and days of pouring over bad documentation, he decided it was either ritualistic suicide or go with the better-documented interface...
Windows device driver development has an entire site devoted to it. In there there is architectural guides, tools, development kits, samples, articles, process guidelines and best-practices. I really don't know what you'd expect? Would the source code be better documentation and provide better guidance?
but I can understand how, after days and days of pouring over bad documentation, he decided it was either ritualistic suicide or go with the better-documented interface...
I can't
1. iPhone connects over USB. Which means that Windows already has a bus driver in place which will notity the PnP manager about device arrivals on the USB bus. What one would need to create is probably a Function Driver. If iPhone used some standard protocol one could probably do with a built-in driver, but I suspect that some proprietary protocol are at work - so therefore a function driver.
2. The PnP manager will activate and notify the function driver upon device arrival. It will do so through the AddDevice message.
3. From the looks of it, what the iPhone requires is probably aptly covered by a user mode driver. Which flies in the face of your previous assertion that
Microsoft's hardware abstraction layer is a terrible, horrible, implimentation that makes every access from userspace terribly expensive
What exactly is it you feel is not documented? What is the documentation you are missing? You did download the Windows Driver Kit, right?
Still waiting for citation for Microsoft recommendation of polling...
Some of those AV companies are Chinese.
Care to list out the name of the AV companies which are owned and/or operated by the CHINESE ??
I am interested in factual information, not fear mongering !!
The MAPP program is public. You can find the list of MAPP partners at Microsoft Security Response Center
Huawei is there, as well as several Beijing companies.
My emphasis on Chinese was tongue-in-cheek. They get a few days advantage to develop scanning signatures. Yes, some of them may go rogue or (more likely) some of the employees. I would think that is why they only get a few days head start and not several months.
Please be a bit precise here. What exactly is claimed have Microsoft and Google given to the NSA? And how exactly do we "know"?
Come on now. There's a powerpoint that proves it all.
It just needs a little imagination/fantasy and some extrapolation, then it is conclusive, irrefutable proof that the big companies have *all* of them given NSA direct electronic access to the companies' servers to perform any kind of snooping they desire with no judicial oversight.
They at least get early Zero-Day access. I'm guessing they have more.
http://arstechnica.com/security/2013/06/nsa-gets-early-access-to-zero-day-data-from-microsoft-others/
MS gives advance information about security patches to AV vendors. The intention is to allow those AV vendors to create scanning signatures which will enable AV products to pick up the attacks. Attackers have show a lazy tendency to just reverse engineer patches instead of finding vulnerabilities themselves. Less than 1% of attacks are zero-day attacks these days.
Some of AV vendors that receive such vulnerability information are foreign companies. Yes. Some of those AV companies are Chinese.
Is it not reasonable to afford the NSA the same advance warning? The advance warning is a few days before the patch is made public, around the same time that the public receive advance notification (with less details than the AV companies and NSA). It is not like they have months to exploit it.
But tinfoil hatters and Microsoft haters always spin it as something nefarious. There is *nothing* to suggest that there are NSA backdoors in Windows or any other OS for that matter.
Thanks!
With the new Laravel PHP framework winning RoRs and CodeIgnitor converts by the thousands
Citation needed. Why does the summary contain this blurb which is not even relevant to the story. Me suspects that the submitter could be an advocate who just ceased on an opportunity to tell slashdot about his favorite PHP framework.
it has specifically licensing it to the public and has the capacity to shutdown Mono at any time.
*sigh* unfortunately this comment is going to attract a lot of MS chills repeating ad nauseam phrases like "community promise" and "estoppel".
You are obviously aware of it, so why do you continue to spread this FUD? I find it especially ironic in a discussion about comparison between Java and C#, where only one of the vendors have actually tried to sue. And it is not Microsoft.
The history with the community promise is that first Microsoft submitted C# and the core libraries to ECMA and ISO for standardization. In doing so Microsoft committed to offer license for any patents essential to implementation under RAND terms (Reasonable And Non Discriminatory).
"IT IS A TRAP" cried the FOSS community! "While they may be forced to license the patents they can still sue and open source projects cannot afford a trial against Microsoft, so they can still force Mono underground!!"
Microsoft then ALSO placed C# specification and core libraries under it's community promise. Such a promise has (as you pointed out) legal estoppel - which in layman's terms means that if Microsoft sues you can invoke the unilateral promise and have the case dismissed.
You may be correct that if we follow your wild FUD that Microsoft can sell off an essential patent and that way wiggle out of the estoppel promise. Then again you could very well be wrong, because the legal basis of the estoppel is that you acted in good faith. A buyer of the patent cannot change the fact that you acted in good faith.
But your FUD is a strawman anyway, since you have not explained how Microsoft could escape the patent grant they have given to anyone who implement C# and core libraries. Such grants cannot be revoked by a buyer of a patent.
The gist of it is that rather than an actual license MS published a statement, a (quote) "promise not to sue".
You are wrong. The promise not to sue came after MS granted anyone who requests it a free license on any essential patent necessary for the implementation of C# and/or core libraries.
And now get ready for the flurry of comments defending .NET most of which will fall in one of the following 4 categories.
With the amount of FUD, inaccuracies, speculation and free fantasy you should certainly expect to be corrected.
If you look at the lambda examples from Java 8 it looks like the collections API now mimic LINQ.
But still no expression trees and no ad-hoc anonymous types so nothing resembling LINQ to Entities, LINQ to Twitter etc.
Dynamic support in Java is called Invoke Dynamic and available in Java 7.
The dynamic support in Java is in the VM only. You cannot use foreign language objects as first class objects from within Java. Essentially, Javas dynamic support was created to make dynamic languages on the Java VM platform not suck. It is not a Java language feature.
C#s dynamic feature is support for dynamic languages the same way, but also lets you create objects in a foreign language and pass those to C# where they can be used as first-class objects.
Take a look here
As for async; Java has the concurrency package to make up for that.
Javas concurrency package is roughly on par with .NETs System.Threading.Tasks and System.Collections.Concurrent. .NETs tasks are more elegant due to the ability to use lambdas
Async/await goes beyond that and introduces syntactical notation where you can write asynchronous code and let the code resemble the logical flow even though dynamically the code executes asynchronously, i.e. the thread leaves and execution continues later when the event that is being awaited occurs.
Especially since what it actually does, doesn't seem to match up with what they tell you it does. At least in the simple cases they use for examples.
Citation needed. Care to elaborate?
Grand Central Dispatch has had similar functionality. The key differences being that Await has more concise syntax for the simple cases, but it gets progressively uglier the more complicated your cases become (such as awaiting a group of tasks that can all be done in parallel to each other
You mean like
await Task.WhenAll(task1, task2, task3); ?
You find that too complicated? I am curious how you would make that code simpler in Java, Objective-C or C?
GCD's syntax starts off somewhat ugly
Indeed
..., but doesn't really change as you do more complicated things, partly because the syntax already assumes you probably want to use blocks/lambdas by default so you can spin off 2-3 lines of code that don't really need a full function.
Apart from being verbose and ugly, GCD still does not solve the problem with composability of asynchronous operations. GCD is the equivalent of TPL (Task Parallel Library) in .NET or Futures in Java.
To be fair async still uses threadpools and you have to be careful how you use it so you don't starve it
That is incorrect. async does not use thread pools. Async by itself says nothing about threads, and - more importantly - it will NEVER spin up a thread or take a thread from a threadpool by itself.
It is true that you can start parallel execution yourself and then use async/await to synchronize, but async/await is really a more fundamental concept compared to threads.
C# does not appear to have 40 Critical bug fixes every quarter like Java does either.
Sure they do
You need to do better than that. Try secunia:
Silverlight 3: 2 vulnerabilities
Silverlight 4: 7 vulnerabilities
Silverlight 5: 4 vulnerabilities.
Hardly the swiss cheese that is Java applets.
95% of those java bugs are for the browser plugin. Last time I checked, activeX didnt have a great track record either. They both find about the same amount of server issues. .Net just sells their extra vulnerabilities to the NSA rather than fixing them.
No they are not. They are all over the runtime and library: Libraries, Hotspot, JavaFX, AWT (many), 2D, serialization, reflection, JAXP, RMI, beans, JAX-WS, etc etc. They are amplified by the fact that many of them are indeed in a library/feature that can be accessed through applets from remote. But the vast majority of the vulnerabilities exists isolated from the applet and could be exploited through other channels.
ActiveX has nothing to do with .NET.
And even so, there has been precious few vulnerabilities in ActiveX. The problem with ActiveX was that the model allowed foreign code to execute non-sandboxed on your machine, so that a bug in a control could have (and had) dire consequences. In that regard, ActiveX resembles SUID on *nix: You check at the gate and if the subject appears to have legitimate papers you let him in and assume that he'll be well-behaved. Just like with SUID where a bug in a SUID root tool may lead to system compromise, a bug in an ActiveX control could let the attacker run his own code with your credentials.
Microsoft has also had the benefit of Anders Hejlsberg being the lead architect, one of the best minds in the industry. There are maybe a handful of people in the industry today that can stand at the same level as him, and none currently alive that can stand taller. Hiring him away was a major boon to Microsoft and a crushing blow to Borland.
As much as I love to code in C#, I think that Martin Odersky is at least as smart and knowledgeable as Anders Hejlsberg. I've seen them debate each other and IMHO Martin came out looking somewhat better. And Scala is no small feat.
"Generator methods"
I'm assuming you're talking about re-implementing common framework service implementations, and if so Java has a ton of non-standard techniques to do this that most developers work with. It'd be nice if they were more consistent of the implementation though.
No, I'm talking about the ability to create methods that use the yield return and yield break syntax to implement infinite sequences or just allow me to yield items of a sequence and allow the consumer to process each item as it is produced rather than creating the entire sequence before returning.
http://msdn.microsoft.com/en-us/library/vstudio/9k7k7cf0.aspx
"Async methods (huge!)"
NIO / NIO2 ? I'm not sure what you're referring to. You can write anything you like with things like Runnable or Executor's.
Not even close.
Async/await are language extensions that allow you to write asynchronous code as if it were synchronous. Note how it is NOT about parallel/threads (although that is also a use case) but a much more fundamental concept of asynchronicity. As such you can compose asynchronous calls with branches, loops, try-catch blocks etc. Without such language support you will have to rely on futures/promises that are implemented in separate methods. Thus, you cannot easily loop over such futures/promises as they span method boundaries. Add try-catch blocks to the mix and it becomes unwieldy.
C# async/await solves the problem elegantly and allows you to compose async methods in a straightforward manner.
The big limitation is tail processing in java, but there are third party frameworks that make resuming blocks easier (though not a first class language feature). When you introduce this to a top level, you have to handle what to do with that now parked thread stack and how to clean it up when something bad happens. Its not a trivial problem, but hopefully one that lambda expressions will iron out in Java 8.
You can hope. Meanwhile the problem has been solved in C#: There is no "parked thread stack" as there is no extra thread. Instead the compiler will perform some really clever rewriting and turn your code into a state machine to implement the logical flow while allowing the thread to exit out of the code (to be continued at the same state later).
I don't use C#, however last I looked all of its features were borrowed from other preexisting languages, same as Java. Is there something new and Microsoft for once in its life has done something novel?
LINQ is a pretty big deal. I don't know of any language that has something similar. LINQ itself is comprised of a number of language constructs such as expression trees, extension methods, type inference, anonymous types.
Async/await is huge! Right there, MS looks to leapfrog other platforms by allowing developers to create robust, asynchronous programs that doesn't need to spin up threads (or use threadpools) to achieve perfectly composable asynchronous methods.
Dynamic support (statically typed to be of dynamic type) allows the best from dynamic languages to be used from within C#, even interop'ing with dynamic languages and e.g. use an object created in Ruby as a first-class object in C# (or vice versa).
OK... so is what you're saying that there is a greater difference between the two runtimes than what TFA says, because .NET doesn't have the possibility of heap pollution? Something like that?
Type erasure foregoes a number of constructs available with reified generics in C#:
* Support for primitive/simple and value types without boxing/unboxing overhead
* Ability to use typeof() operator (.class in Java) on generic parameters
* Ability to create new instances of generic parameter types (with the C# new() constraint)
* Ability to declare, throw and catch generic exceptions.
* No per-realization static scope. Statics behave strangely in Java generics as all realizations share static members.
There are other more esoteric restrictions because of Java type erasure (yes, heap pollution is one of them).
Also consider that C# generics are fully verified at compile/load time, whereas Java generics need to perform downcasts at runtime, every time you return something that is of a generic parameter type.
None of them huge restrictions - until you hit upon them and realize that you will have to create strange code to circumvent them.
I'm wondering how C# async methods got skipped. Because there's nothing similar in Java?
Async/await is huge. It makes composing async methods as terse as regular synchronous code. Unlike with the library defined task/future models, async/await adds a composable model which lets you write async methods that can loop, branch, try-catch etc. while staying perfectly async.
Um, as someone who is somewhat (but not only somewhat) familiar with generics in both systems, I don't see anything in TFA's explanation which is misleading or incorrect, nor contradicted by your link. Care to elaborate on what you mean?
I can help. The author claims this:
That is wrong. In Java, type checking happens at *runtime*. During the type erasure the compiler will add downcasts into the code which will be evaluated at runtime. When a collection has been declared with item type as Person, you can insert Person specializations into it, like Student or Teacher. But because of type erasure the collection will in reality be a Object collection. Hence, when you read from the collection the compiler must ensure that it is indeed a Person being read.
Nevermind how the authors hastens to apologize for the shortcomings of type erasure. He also fails to mention one very big difference: Java generics do not support primitive/value types. Storing Integers in collections incur a significant overhead compared to int's because of boxing, heap allocation, unboxing and garbage collection.
You can add lambda expressions as well, although, that's coming in JRE 7, no, 8 maybe.
Yup. I actually forget how often I use those.
Recently we have also seen expression trees put to good use, e.g. in Entity Framework code first to define relations, keys etc.
Huh? I thought java did have multidimensional arrays.
No, Java allows you to declare arrays of arrays - also called "jagged" arrays because not every "sub-array" need to have the same length (you can assign different arrays after initialization). Arrys of arrays are not multidimensional arrays, however.
C# allow you to declare both "jagged" arrays of arrays as well as true multidimensional arrays.
In some (limited) situations the true multidimensional arrays will slightly outperform jagged arrays. This happens if you mostly access random cells of the array. In that case the true multidimensional array will only require a integer multiplication and an array indirection. Jagged arrays will always require two array indirection accesses.
There are ciritical fixes released for the .net API every so often via windows update. Neither are flawless in that regard.
True, neither is flawless.
But one of them appears to have been considerably better designed (or better QC):
.NET 4: 34 vulnerabilities Released 2010-04
Java 1.7: 216 vulnerabilities Released 2011-07
or the previous incarnations:
.NET 2: 53 vulnerabilities Released 2006-12
Java 1.6: 432 vulnerabilities Released 2006-01
Java experiences 6-8 times the number of vulnerabilities, even over shorter time frames.
Async methods (huge!)
Generator methods
Partial classes/methods
Reified generics
LINQ (as in LINQ to objects, LINQ to Entities, LINQ to XML - all part of the core framework)
Dynamic typing and -interop
Value types
Operator overloading
Implicit/explicit type conversions
The broadcast just need to be signed using a private key. Every handset can hold the public part. If the private key is 2048 bits or longer you can assign the IDs sequentially if you prefer; faking the broadcast will be as hard as it is to break the 2048 bit key - which takes *a lot* of time for 2048 bit keys.
You do that.
Tell them to make a version of DBT_DEVICEARRIVAL that doesn't require you to have a window handle to get the callback to the message pump so that you don't have to poll using PeekMessage().
AddDevice routine is used by device drivers to be notified when their device arrives at the bus (e.g. an USB bus).
But if you read the documentation for the RegisterDeviceNotification function carefully, you should notice this:
Really!
The notifications need to be able to go to windowless services.
Yes, agree. But they can. It is right there in the documentation.
Then tell them that RegisterDeviceNotification() is useless for detecting new iPod/iPhone/iPad devices because it require matching a GUID that has not been defined at the time that the service was written, and that having to update the service by having to update iTunes each time you buy a new device before the plugged in device is recognized as launching iTunes because you don't get a broadcast notification in that case, which you can then use to open up the device temporarily to probe it further ("Hi, USB device, are you an Apple Device?") rather than using a stinking GUID.
That's the thing with GUIDs: It is perfectly safe to choose them during *development*. Generating a guid for a device or an event virtually guarantees that no other device or event will use the same ID. The main problem with GUIDs is that such "well-known" guids needs to be documented. But if Apple writes the device driver that broadcasts the event, surely they can find a way to use the clipboard and use the same GUID during notification registration.
Then you can call up Motorola, and tell them so they can update their PhoneTools Software, because they have the same problem.
I wasn't aware that they are eating CPU like iTunes. Citation?
... the DataPilot folks, who have no idea in heck what the phone GUID would be when you plug in your stupid random phone, particularly if you are using their DataPilot Universal PRO Kit, which connect up to almost all the phones from Apple, Motorola, LG, Samsung, Sanyo,
Sony Ericsson, and Audiovox.
I have more concrete examples, but I think you get the point.
not really, no. Do they eat CPU cycles polling like the crApple software?
The current Microsoft APIs do not solve this general problem; they require either an open application window, or they require a service which polls.
Wrong. Read the documentation. I linked to it and quoted it above. It really is not that difficult.
You still have not told us where Microsoft recommends polling, as per your claim:
And worse? Some of the documentation specifically says they want it that way! On purpose!
[HAL] it's a nightmare of convoluted and badly-documented objects and methods. I won't go as far as to say whoever decided to go with polling instead of event-driven made a great design choice, but I can understand how, after days and days of pouring over bad documentation, he decided it was either ritualistic suicide or go with the better-documented interface...
Windows device driver development has an entire site devoted to it. In there there is architectural guides, tools, development kits, samples, articles, process guidelines and best-practices. I really don't know what you'd expect? Would the source code be better documentation and provide better guidance?
but I can understand how, after days and days of pouring over bad documentation, he decided it was either ritualistic suicide or go with the better-documented interface...
I can't
1. iPhone connects over USB. Which means that Windows already has a bus driver in place which will notity the PnP manager about device arrivals on the USB bus. What one would need to create is probably a Function Driver. If iPhone used some standard protocol one could probably do with a built-in driver, but I suspect that some proprietary protocol are at work - so therefore a function driver.
2. The PnP manager will activate and notify the function driver upon device arrival. It will do so through the AddDevice message.
3. From the looks of it, what the iPhone requires is probably aptly covered by a user mode driver. Which flies in the face of your previous assertion that
Microsoft's hardware abstraction layer is a terrible, horrible, implimentation that makes every access from userspace terribly expensive
What exactly is it you feel is not documented? What is the documentation you are missing? You did download the Windows Driver Kit, right?
Still waiting for citation for Microsoft recommendation of polling...