71 points · by mmastrac · 7y ago · 65 comments
Obviously cdp only applies to the communication mechanisms relevant to control a browser — i guess what I’m musing about is wanting to Suss out - is there anything that will be lost (dx feature support, performance) if one attempts to implement ide features but using debug adapter protocol to adapt CDP? Is CDP one of the target integrations that debug adapter protocol will aim to support?
I think CDP is ridiculously important and likely to become more so ...
Has anyone used some of their abstractions elsewhere? How good are these protocols they are pumping out?
Adoption wise, I'd say it's a success. As for how good the protocol is, I'd personally have preferred something binary instead of json.
Documentation can be found:
http://develop.spacemacs.org/layers/+lang/python/README.html
Seems to work fine. Functionally it seems the same, maybe a bit faster. Haven't used it a whole lot.
Really tempted to try out the Microsoft PLS just so that I can say that I am using Microsoft in Emacs. Which is pretty close to being technically correct.
Brave new world.
Nowadays if I was forced to give up my Linux desktop and choose between Windows and OS X for work... Windows 100% of the time. Because I can then use WSL and get Linux nicely integrated into the base OS. Especially since Macbook Pros are not that nice anymore.
I didnt see how it works on Sublime Text yet. Feels like plugins on Sublime dont get the love and quality as plugins in VS Code or Atom.
Wonder if Spacemacs / Spacevim will natively support LSP and DAP. Would be really nice.
https://microsoft.github.io/language-server-protocol/specifi...
But what I would care about is that it's easy to create a protocol specification and to generate most of the boilerplate code out of it - so that the schema gets automatically verified and that developers can focus on building their application logic instead of getting the serialization right. That can be done with JSON too (e.g. with json-schema or by generating code out of typescript definitions). However I haven't yet checked whether LSP and the debug protocol make use of this.
JavaScript developers really do hold skewed ideas about what kinds of things are useful and worth the overhead that they incur.
Binary protocols are easier than JSON, to me, and to most people I would say, who have actually implemented a binary protocol or wrote code to read or write binary files.
JSON isn't really anything to do with JavaScript any more. It's a format that's used with practically every language. Any experienced developer should know that.
JSON has a lot to do with JavaScript. I don't know why you think JavaScript doesn't have anything to do with JSON. JSON and JavaScript are used together every day.
Especially not with broad vagaries like "Binary protocols are easier than JSON".
A computer program (an IDE in this scenario) talking to another computer program (the debugger) simply does not need to use JSON! By choosing to use JSON, a choice was made to make the protocol far more inefficient than it needed to be.
The result will be a slower than necessary debugging experience for all who use it. Debuggers already consume enough developer time per day! Choices should be made to make developer lives better, not worse.
Of course you do, something has to actually read the strings and parse them into JS data structures.
You don't need protobuf, you don't need json, you don't need any of these things that just add bloat and cost you performance.
Writing and reading binary is easy, and is FAR easier than JSON if you are using something like C.
Most languages have convenience methods for strings, yes, and those can be stacked on top of each other so that JSON libraries can be written, of course. Those libraries are FAR slower than just reading and writing bytes, and deserializing those bytes into structs or serializing those structs into a byte array, and the binary data is much smaller than a JSON document containing the same data would be.
People these days are acting like binary protocols are hard, or that they are suboptimal for one reason or another. I guarantee you that someone who was trying to find a bug in a JSON library will spend as much time or more than someone trying to find a similar bug in a method that reads or writes binary data, and at the end of it, the person who looked at the methods that handle binary data will FULLY understand what is happening in that code. The person debugging the JSON library will almost certainly not have a full understanding of the JSON library after finding and fixing a bug unless they wrote it to begin with.
It comes down to this - all computer programs do is process data. All UX problems, all usability problems, all computer problems boil down to problems transforming data. Transforming data is literally the only thing a computer can do. Any work spent writing code that does not directly solve the data transformation problem at hand is wasted time and work on the part of the developer. Any performance lost using code that does not directly solve the data transformation problem at hand is time away from the CPU for other tasks, time away from a consumer of that data, and so on. It adds up, and it adds up quickly.
(yes, there are 3rd party libraries that provide some or all of the above, but they may not be applicable for a variety of reasons, including API stability, maintainability, compiler support, host/target OS support, tooling support, C language version support and a bunch of others)
Yeah more or less that's true, but in typed languages especially it's pretty inconvenient (unless you circumvent the type system or dump directly into a hash table, but that's usually bad).
> It's easy to debug
There are tons of corner cases re: parsing JSON [1]. Plus things like canonicalization and duplicate keys are pretty confounding.
> You also don’t have any overhead for parsing in JavaScript based editors like VSCode and Atom.
JSON isn't JavaScript and parsing it with `eval` is super bad practice. And there is indeed parsing overhead [2].
[1]: http://seriot.ch/parsing_json.php#4
[2]: https://github.com/msgpack/msgpack-javascript#benchmark
Given all the other constraints on the product, how does making a binary protocol fit in? What trade offs will be made if they used a binary protocol?
This is a move toward being able to debug programs on Azure with VSCode remotely.
There's a lot of talk about fast C++ JSON libraries and how they can parse 1GB of JSON per second, and that's a lot of data, for sure, if you only count the data that's wrapped up in JSON. 1GB of JSON data contains a lot of waste that is not even usable data, and that's before you consider the textual encoding of what may better be represented by binary data, which inflates the size of a JSON file even further than the JSON syntax itself does. A binary file that is read at 1GB per second would contain far, far more actual data, and binary files can be read and written much more quickly than 1GB/s.
I'm really starting to lose patience with all the JSON and web technologies that are finding their way into non-web use cases. using binary formats and simple programs to handle them is really, truly, easier to rationalize about, easier to maintain, easier to write, and easier to replace when the time comes.
https://microsoft.github.io/debug-adapter-protocol/overview#...
Further popular counterexamples besides the NT kernel (cf. [2]):
- Java
- JavaScript
- .NET
- Qt
- Joilet file system (for CD-ROMs)
[1] http://utf8everywhere.org/
[2] https://en.wikipedia.org/w/index.php?title=UTF-16&oldid=9094...
As you can see in the examples, they are all (except perhaps the Joilet file system) still very actively used. I see no reason that they will disappear soon.
Also the decision to use UTF-8 under GNU/Linux is a decision that was similarly made about 20 years ago.
We can discuss how Emacs and VSCode compare to each other (and we can discuss the advantages and disadvantages of VSCode taking the electron approach until we're blue in the face), but VSCode is definitely not trying to compete with Emacs, rather aiming for a very different user base.
However, this article isn't even about VS Code proper. It's about Debug Adapter Protocol. If DAP achieves the same adoption as LSP, this will be a huge move forward in developer tooling across all sorts of tech stacks and domains. In between LSP and DAP, just about any editor is capable of becoming a lightweight IDE for an enormous variety of languages, and this is a Good Thing for everybody.
They just haven't been friendly much towards developers outside their ecosystem, as soon as they have monopolised the given ecosystem.
The thing is, it's the idea of Emacs that's important; you could argue that Emacs itself is an antiquated and idiosyncratic implementation of that idea. I'm fine with parallel attempts at programmable editors; seems like a win.
Both do not scale up to the needs of today (Windows support, Remote Support, solving the n x m problem, ...).