<story><title>SVG: The Good, the Bad and the Ugly</title><url>https://www.eisfunke.com/article/svg-the-good-the-bad-and-the-ugly.html</url></story><parent_chain><item><author>simias</author><text>&amp;gt;Furthermore the XML-based syntax is pretty ugly and needlessly verbose. It’s tiring to write by hand and just as tiring to parse or generate automatically.&lt;p&gt;What&amp;#x27;s even worse is that because XML is a garbage fire of a format, SVG actually builds its own micro-DSL to work around limitations.&lt;p&gt;So for instance you have something like:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    &amp;lt;circle cx=&amp;quot;10&amp;quot; cy=&amp;quot;10&amp;quot; r=&amp;quot;2&amp;quot; fill=&amp;quot;red&amp;quot;&amp;#x2F;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
Ok, fair enough. Readable, self-describing.&lt;p&gt;But then you have:&lt;p&gt;&lt;pre&gt;&lt;code&gt;     &amp;lt;path d=&amp;quot;M 10 10 H 90 V 90 H 10 L 10 10&amp;quot;&amp;#x2F;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
Oh. You can almost hear the designer saying &amp;quot;well fuck it, we&amp;#x27;ll just jam it all into a string.&lt;p&gt;The fact that SGML-based formats managed to become as popular as they are is really proof that there&amp;#x27;s something fundamentally rotten in software engineering.&lt;p&gt;I do quite like SVG though. I mean, if the alternative is drawing with CSS, it&amp;#x27;s pretty amazing. I don&amp;#x27;t really agree that it&amp;#x27;s hard to generate programmatically either, you just have to decide what subset of the format you need, look at what inkscape generates and go from there. If you need to generate basic shapes it&amp;#x27;s fairly straightforward.</text></item></parent_chain><comment><author>colllectorof</author><text>Can&amp;#x27;t wait for the improved JSON version:&lt;p&gt;&lt;pre&gt;&lt;code&gt;   {&amp;quot;path&amp;quot;: {&amp;quot;d&amp;quot;: [&amp;quot;M&amp;quot;, 10, 10, &amp;quot;H&amp;quot;, 90, &amp;quot;V&amp;quot;, 90, &amp;quot;H&amp;quot;, 10, &amp;quot;L&amp;quot;, 10, 10]}}&lt;/code&gt;&lt;/pre&gt;</text></comment>
<story><title>SVG: The Good, the Bad and the Ugly</title><url>https://www.eisfunke.com/article/svg-the-good-the-bad-and-the-ugly.html</url></story><parent_chain><item><author>simias</author><text>&amp;gt;Furthermore the XML-based syntax is pretty ugly and needlessly verbose. It’s tiring to write by hand and just as tiring to parse or generate automatically.&lt;p&gt;What&amp;#x27;s even worse is that because XML is a garbage fire of a format, SVG actually builds its own micro-DSL to work around limitations.&lt;p&gt;So for instance you have something like:&lt;p&gt;&lt;pre&gt;&lt;code&gt;    &amp;lt;circle cx=&amp;quot;10&amp;quot; cy=&amp;quot;10&amp;quot; r=&amp;quot;2&amp;quot; fill=&amp;quot;red&amp;quot;&amp;#x2F;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
Ok, fair enough. Readable, self-describing.&lt;p&gt;But then you have:&lt;p&gt;&lt;pre&gt;&lt;code&gt;     &amp;lt;path d=&amp;quot;M 10 10 H 90 V 90 H 10 L 10 10&amp;quot;&amp;#x2F;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
Oh. You can almost hear the designer saying &amp;quot;well fuck it, we&amp;#x27;ll just jam it all into a string.&lt;p&gt;The fact that SGML-based formats managed to become as popular as they are is really proof that there&amp;#x27;s something fundamentally rotten in software engineering.&lt;p&gt;I do quite like SVG though. I mean, if the alternative is drawing with CSS, it&amp;#x27;s pretty amazing. I don&amp;#x27;t really agree that it&amp;#x27;s hard to generate programmatically either, you just have to decide what subset of the format you need, look at what inkscape generates and go from there. If you need to generate basic shapes it&amp;#x27;s fairly straightforward.</text></item></parent_chain><comment><author>cdrini</author><text>How is XML a garbage fire? In comparison to what? Also, representing paths succinctly as text is inherently complicated. You&amp;#x27;re trying to represent a very 2D thing in a linear 1D syntax. It&amp;#x27;s not a limitation of XML, it&amp;#x27;s a limitation of text being 1D.&lt;p&gt;XML&amp;#x2F;SGML are a very effective way of representing tree data (again, non-1D data) in 1D strings. And they&amp;#x27;re wonderfully extensible, while still keeping a well defined schema. Is there an alternative language that is better? How is it better?</text></comment>