<?xml version="1.0" encoding="ISO-8859-1"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xml:lang="en-US">
	<title>KnitML</title>
	<link rel="alternate" type="text/html" href="http://www.knitml.com/blog/index.php" />
	<modified>2010-03-10T15:42:38Z</modified>
	<author>
		<name>Jonathan</name>
	</author>
	<copyright>Copyright 2010, Jonathan</copyright>
	<generator url="http://www.sourceforge.net/projects/sphpblog" version="0.5.1">SPHPBLOG</generator>
	<entry>
		<title>Hey! What&#039;s news?</title>
		<link rel="alternate" type="text/html" href="http://www.knitml.com/blog/index.php?entry=entry091102-081121" />
		<content type="text/html" mode="escaped"><![CDATA[I haven&#039;t posted since April, so you may be wondering what happened to me (and consequently the project). Well, after the last release, I decided to take a much-needed break and wait for some new people to take interest. That came in the form of <a href="http://blog.dictumsapienti.com/" target="_blank" >i0lanthe</a> last month.<br /><br />I know that there are a lot of people out there that want to help out but don&#039;t really know how to get started. Well, the <a href="http://www.ravelry.com/groups/knitml" target="_blank" >Ravelry KnitML Forum</a> has been abuzz in recent weeks, and the first-cut of a <a href="http://knitnuggets.com/tutorial" target="_blank" >first draft of a KEL tutorial</a> has emerged. I believe that this tutorial is a sorely needed stepping stone to boost involvement of the knitting community. Try it out and give us your feedback.<br /><br />In other news, now that both project source code repositories are being hosted at Google Code, I may try to move the bug tracker over there. It also appears that there is a Mylyn Connector for it (which, if it works, is the only thing that would be stopping me from migrating from Bugzilla.) I&#039;ll let you know.<br /><br />]]></content>
		<id>http://www.knitml.com/blog/index.php?entry=entry091102-081121</id>
		<issued>2009-11-02T00:00:00Z</issued>
		<modified>2009-11-02T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Using KnitML, Part Two: Customizing the Result</title>
		<link rel="alternate" type="text/html" href="http://www.knitml.com/blog/index.php?entry=entry090426-185525" />
		<content type="text/html" mode="escaped"><![CDATA[<a href="http://www.knitml.com/blog/index.php?entry=entry090324-130239" target="_blank" >Previously in this series</a>, I showed you how I converted Jenna Wilson&#039;s <a href="http://knitty.com/ISSUEwinter03/PATTbanff.html" target="_blank" >Banff sweater</a> to a KnitML pattern. In this post, I&#039;m going to show you how you can customize the pattern to your preferences.<br /><br />For those of you reading this post who are not involved with the KnitML Project, I&#039;m asking that you keep an open mind and not judge or dismiss this software based on its current limitations. Please remember that this is beta software, supported and nurtured by the knitting community. Your suggestions for improvement are most welcome (and, in fact, sought after). The software needs to be made better, and only you can make this possible. You can leave a comment on the blog, you can contact me privately (by clicking on the Contact Me link on the sidebar). or you can post a thread on the Ravelry KnitML group. Thanks!<br /><br />When I open up the KEL editor, notice that there are three different views of the KnitML pattern: Code, XML, and Pattern. <br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render01.png',1024,738,false);"><img src="http://www.knitml.com/banff-images/render01.png" width="512" height="369" border="0" alt="" /></a><br /><br />The Code View is where I get to work with and edit the pattern. The XML view shows the pattern in true KnitML format, derived directly from the Code View. If I were to publish this KnitML pattern online, this is the file I would share. The Pattern View shows how the pattern looks using my personal preferences.<br /><br />The pattern editor ships with a set of sensible defaults for the pattern view. Here is what Banff looks like out-of-the-box:<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render02.png',763,738,false);"><img src="http://www.knitml.com/banff-images/render02.png" width="512" height="495" border="0" alt="" /></a><br /><br />While this is certainly fine, it&#039;s not entirely to my liking. I can open up the Preferences page and make a few changes.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render03.png',483,175,false);"><img src="http://www.knitml.com/banff-images/render03.png" width="483" height="175" border="0" alt="" /></a><br /><br />I&#039;m not a huge fan of Arial. Garamond would look much nicer.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render04.png',1021,733,false);"><img src="http://www.knitml.com/banff-images/render04.png" width="512" height="368" border="0" alt="" /></a><br /><br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render05.png',1023,735,false);"><img src="http://www.knitml.com/banff-images/render05.png" width="512" height="368" border="0" alt="" /></a><br /><br />To get the pattern to re-render, I must navigate away from the Pattern View (either to the Code or XML View) and then back to the Pattern View. (There will be an easier way to do this in a future release.)<br /><br />Notice the gauge is expressed as a 4-inch swatch in stockinette stitch.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render06.png',763,459,false);"><img src="http://www.knitml.com/banff-images/render06.png" width="512" height="308" border="0" alt="" /></a><br /><br />You may recall that I expressed the gauge like this:<br /><code>Gauge &#039;stockinette&#039; {<br />      StitchGauge: 3.5 stitchesPerInch<br />      RowGauge: 5.25 rowsPerInch<br />    }<br /></code>The Pattern View does the conversion to a square for me. If you don&#039;t care for gauges written this way, you can uncheck the &quot;Describe gauge as a square&quot; option in the Preferences page.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render07.png',1023,734,false);"><img src="http://www.knitml.com/banff-images/render07.png" width="512" height="367" border="0" alt="" /></a><br /><br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render08.png',766,284,false);"><img src="http://www.knitml.com/banff-images/render08.png" width="512" height="190" border="0" alt="" /></a><br />We intend to support non-stockinette-based gauges in the future.<br /><br />If you are familiar with the original pattern from Knitty, you probably know that it did not come with charts. You also may remember that I did not type in anything that looked like a chart when I created the pattern in the Code View.<br /><br />I can tell the renderer to construct charts from the KnitML pattern. To do this, go to the Preferences page, expand the Rendering option on the left, click on Charts and then check the box labelled &quot;Enable chart creation for instructions.&quot; The renderer will make a chart whenever it can.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render09.png',625,535,false);"><img src="http://www.knitml.com/banff-images/render09.png" width="512" height="438" border="0" alt="" /></a><br /><br />Here is a part of the pattern that shows charts well:<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render10.png',765,565,false);"><img src="http://www.knitml.com/banff-images/render10.png" width="512" height="378" border="0" alt="" /></a><br />(The legend has some cleanup work slated for the next release.)<br /><br />By default, the renderer uses simple text art for its symbols (based on the Unicode character set). Since I have the Aire River Knitting Font installed on my machine, I could use those symbols instead.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render11.png',766,647,false);"><img src="http://www.knitml.com/banff-images/render11.png" width="512" height="432" border="0" alt="" /></a><br /><br />If I wanted to manipulate the chart further, I could copy and paste it directly into a spreadsheet.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render12.png',765,646,false);"><img src="http://www.knitml.com/banff-images/render12.png" width="512" height="432" border="0" alt="" /></a><br /><br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render13.png',518,279,false);"><img src="http://www.knitml.com/banff-images/render13.png" width="512" height="276" border="0" alt="" /></a><br />Note that if you don&#039;t use Windows and Excel, it may take a little more work to get it into this form. While the copy/paste with Firefox and OpenOffice does work, the font settings are not preserved. In order to get the Aire River font to look correct, you would have to re-apply that font to the cells of the chart.<br /><br />Notice that the charts are all right justified with respect to their &quot;no stitch&quot; elements. In a future release, the renderer will be able to infer whether to center, left, or right justify depending on conditions. This will help keep the chart looking more like the finished object. For more complex charts, however, auto-justification may not always be possible. A designer may choose to specify the placement of every &quot;no stitch&quot; element themselves to guarantee their own chart layout.<br /><br />So how do you write patterns in KnitML which were originally designed as a chart? Right now, the process to convert a chart to KnitML is manual (by writing out the appropriate KEL syntax). This is undeniably awkward. In the future, existing software (such as but not limited to Knit Visualizer) could make this a whole lot easier by creating the KnitML chart instead of you having to do it.<br /><br />I can also customize the instructions themselves. Here are the defaults for several common decreases:<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render14.png',907,632,false);"><img src="http://www.knitml.com/banff-images/render14.png" width="512" height="357" border="0" alt="" /></a><br /><br />Suppose I knit in combined style (or left-handed) and prefer all decreases to indicate their lean. I can edit my preferences to display RLD or LLD (right-leaning decrease, left-leaning decrease):<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render15.png',991,733,false);"><img src="http://www.knitml.com/banff-images/render15.png" width="512" height="379" border="0" alt="" /></a><br /><br />That will end up looking like this:<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render16.png',730,360,false);"><img src="http://www.knitml.com/banff-images/render16.png" width="512" height="252" border="0" alt="" /></a><br /><br />Suppose French is my native language. I can have the pattern rendered in French using international units:<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render17.png',623,537,false);"><img src="http://www.knitml.com/banff-images/render17.png" width="512" height="441" border="0" alt="" /></a><br /><br />It will render all of the non-custom instructions in French automatically.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/render18.png',762,560,false);"><img src="http://www.knitml.com/banff-images/render18.png" width="512" height="376" border="0" alt="" /></a><br /><br />A pattern designer can provide translation files for their customized sections. The Nutkin2 sample demonstrates how to fully internationalize a pattern. Future releases may be able to provide an &quot;auto translate&quot; feature if no translation is found for the given language.<br /><br />I&#039;ve touched on the major points of the Pattern Editor. If you have any questions, ideas, or thoughts, please feel free to comment here on the blog, <a href="http://www.knitml.com/blog/contact.php" target="_blank" >contact me privately</a>, or ask a question <a href="http://www.ravelry.com/discuss/knitml/topics" target="_blank" >on the KnitML Ravelry group</a> or <a href="http://answers.launchpad.net/knitml" target="_blank" > the public Answers forum</a>.]]></content>
		<id>http://www.knitml.com/blog/index.php?entry=entry090426-185525</id>
		<issued>2009-04-27T00:00:00Z</issued>
		<modified>2009-04-27T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Pattern Editor 0.2.0 and Core Tools 0.5.0 released</title>
		<link rel="alternate" type="text/html" href="http://www.knitml.com/blog/index.php?entry=entry090425-231050" />
		<content type="text/html" mode="escaped"><![CDATA[I am very pleased to announce the arrival of both the KnitML Pattern Editor 0.2.0 and KnitML Core Tools 0.5.0. This is the first truly usable version of the Pattern Editor.<br /><br />Features of this release include:
<ul>
<li>A great new look (thanks, <a href="http://www.2trees-media.com/">Susan</a>!)</li>
<li>A great new name (thanks, <a href="http://www.ravelry.com/">Ravelry</a>!)</li>
<li>A new sample: the <a href="http://www.knitty.com/ISSUEwinter03/PATTbanff.html">Banff sweater</a> (thanks, Jenna!)</li>
<li>A new help system</li>
<li>Customizable rendering preferences</li>
<li>Charting support</li>
<li>Stitch holder support</li>
<li>Knitting Expression Language improvements</li>
<li>French rendering (thanks, Kajin!)</li>
</ul>
Get yourself a copy <a href="http://sourceforge.net/projects/knitml" target="_blank" >here</a>, and feel free to bring any of the <a href="http://www.knitml.com/samples" target="_blank" >samples</a> into the editor to try out the tool.<br /><br />Thanks to everyone who made contributions!]]></content>
		<id>http://www.knitml.com/blog/index.php?entry=entry090425-231050</id>
		<issued>2009-04-26T00:00:00Z</issued>
		<modified>2009-04-26T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Very, very close to 0.5.0</title>
		<link rel="alternate" type="text/html" href="http://www.knitml.com/blog/index.php?entry=entry090421-225512" />
		<content type="text/html" mode="escaped"><![CDATA[At this point, both KnitML Core Tools and, more importantly, the KnitML Pattern Editor (formerly GPEC) are in Release Candidate 1 status. Visit the milestones links on the sidebar to download. (Sorry, the Pattern Editor at this time is only available on Windows. I don&#039;t expect it will be in RC1 status very long.)]]></content>
		<id>http://www.knitml.com/blog/index.php?entry=entry090421-225512</id>
		<issued>2009-04-22T00:00:00Z</issued>
		<modified>2009-04-22T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Looking Forward: A Request for Help</title>
		<link rel="alternate" type="text/html" href="http://www.knitml.com/blog/index.php?entry=entry090410-100605" />
		<content type="text/html" mode="escaped"><![CDATA[With KnitML Core Tools 0.5.0 coming out in the next few weeks along with the new Editor 0.2.0, it&#039;s a good time to stop and reflect about the project and where we want to go next.<br /><br />I&#039;ve learned quite a bit about myself over the years I&#039;ve worked on KnitML. (Yikes, has it really been years? It will be 2 years in September.) Anyways, there are some things I&#039;m good at, and there are some things I&#039;m just not all that great at (lousy, in fact). Sparing you my personality quirks, here is what I&#039;ve come up with.<br /><br />I feel that I&#039;m pretty good at:
<ul>
<li>Designing software for flexibility and change</li>
<li>Thinking through scenarios</li>
<li>Project Scoping</li>
</ul>I&#039;ve learned that I am inexperienced in the following areas:
<ul>
<li>Graphic Design</li>
<li>Pattern Design</li>
<li>Documentation</li>
<li>Internationalization (i.e. dealing with multilingual issues)</li>
</ul>
<a href="http://www.2trees-media.com/" target="_blank" >Susan</a> has helped improve the editor far past what I would have been able to do myself. While it&#039;s still very much a work-in-progress, version 0.2.0 of the editor is not only starting to pass for decently configurable software, but it&#039;s also starting to look and feel really nice. If you are a graphic designer (or you just have strong opinions about how your UI feels), please give us your thoughts!<br /><br /><a href="http://bigskyknitting.com/" target="_blank" >Janet</a> has brought the pattern designer&#039;s perspective to the project, and it&#039;s been extremely valuable (not to mention eye-opening). If you are a designer and have thoughts about the project, please make your voice heard!<br /><br />As for documentation, I can certainly write manuals in a way that I can understand them. This is, in fact, a pretty useless skill. :) Certainly the reference table for Knitting EL is comprehensive, but it&#039;s not clear to me that it&#039;s actually usable. I get the feeling that people want to learn about KnitML, but they open up the User&#039;s Guide, read a bit, and then just give up.<br /><br />If you feel you have good writing and documentation skills, and if you are curious about KnitML but have been unsure about where to start, this is your chance! I&#039;m looking for people to dive in feet first, ask any and all questions when they get stuck, and keep track of how they are approaching KnitML. Click <a href="contact.php" target="_blank" >here</a> to send me a note.<br /><br />Multilingual support is also an area I need help with. While the approach I&#039;ve been taking works, it&#039;s pretty clear I need a better system for long-term maintenance of language files. If you are a professional translator, I need to hear your perspective about translating documents and software. I&#039;ve been trying to glean some of these things by doing online research, but I really am not an expert here. Any advice at all would be most welcome.<br /><br />And, of course, I&#039;m always looking for programmers to lend a hand. Some previous Java experience is very helpful, but if you have skills in other technologies that you think can bring value to the KnitML Project, please share your ideas!<br /><br />Got other skills another area you can help out with? Just <a href="contact.php" target="_blank" >let me know</a>.]]></content>
		<id>http://www.knitml.com/blog/index.php?entry=entry090410-100605</id>
		<issued>2009-04-10T00:00:00Z</issued>
		<modified>2009-04-10T00:00:00Z</modified>
	</entry>
	<entry>
		<title>KnitML Core Tools 0.5.0 RC1 available</title>
		<link rel="alternate" type="text/html" href="http://www.knitml.com/blog/index.php?entry=entry090409-214821" />
		<content type="text/html" mode="escaped"><![CDATA[All issues slated for the 0.5.0 release have been resolved. This includes adding stitch holders, charting support in three fonts (text art, Knitters Symbols, and Knitting Font 2.00), HTML patterns, and much more. The XML schemas have been finalized for the 0.5.x series and have been uploaded to the web site.<br /><br />The graphical editor (formerly GPEC, soon to be called something else) will be released as 0.2.0 simultaneously with 0.5.0 final.<br /><br />You can download 0.5.0 RC1 from the <a href="http://code.google.com/p/knitml/downloads/list" target="_blank" >milestone releases page</a>.]]></content>
		<id>http://www.knitml.com/blog/index.php?entry=entry090409-214821</id>
		<issued>2009-04-10T00:00:00Z</issued>
		<modified>2009-04-10T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Last Call for Bug Submissions for the 0.5.0 Release</title>
		<link rel="alternate" type="text/html" href="http://www.knitml.com/blog/index.php?entry=entry090401-224718" />
		<content type="text/html" mode="escaped"><![CDATA[If you want your opinions put into an actionable plan, submit <a href="http://doublebock.net/bugzilla" target="_blank" >an issue</a> today. This is the last call before the list is frozen for the 0.5.0 relesae (and 0.2.0 of the GPEC release, which will include 0.5.0).]]></content>
		<id>http://www.knitml.com/blog/index.php?entry=entry090401-224718</id>
		<issued>2009-04-02T00:00:00Z</issued>
		<modified>2009-04-02T00:00:00Z</modified>
	</entry>
	<entry>
		<title>XText and KnitML</title>
		<link rel="alternate" type="text/html" href="http://www.knitml.com/blog/index.php?entry=entry090325-110627" />
		<content type="text/html" mode="escaped"><![CDATA[So I&#039;m here at EclipseCon 2009. Someone tipped me off about XText a few months back, so I thought I would go to the talk.<br /><br />It sounds like it has a lot to bring to the table for the Knitting Expression Language. It has a way to express the KEL grammar in a formal way, which means that it is also capable of providing content assist / code completion, syntax highlighting, and pattern formatting for the KEL format.<br /><br />XText would also enable the KEL format to take the form of an <a href="http://www.martinfowler.com/bliki/DomainSpecificLanguage.html" target="_blank" >external DSL</a>. As Martin points out, external DSLs traditionally take a lot of work. But XText looks like it could make this a lot simpler. At the basic level, all I need to do is write the grammar, and that gives me a base working set of tools as a starting point.<br /><br />I could also get rid of many of the curly braces. This, for instance:<pre>Directions {<br />  InstructionGroup &#039;make-back&#039; withLabel &quot;Make the Back&quot; {<br />    ...<br />  }<br />  InstructionGroup &#039;make-front&#039; withLabel &quot;Make the Front&quot; {<br />    ...<br />  }<br />}</pre> could look like this:<pre>Directions:<br />  InstructionGroup &quot;Make the Back&quot;:<br />    ...<br />  InstructionGroup &quot;Make the Front&quot;:<br />    ...</pre>Because the structure of the grammar at this level of the pattern is very formal, you don&#039;t really need open / closed curly braces. You can simply infer where one InstructionGroup starts by where the next one begins. This looks much more like a knitting pattern to me. But the current way the internal DSL is built (text polishing on top of Groovy), you really need the curly braces so that Groovy understands where these boundaries are. It sounds like XText could liberate us from unnecessary braces.<br /><br />XText will also be able to provide validation and feedback to the user about their KEL pattern. That&#039;s going to be extremely important, because currently the feedback that the conversion tool provides to the user is a stack trace (with a fairly cryptic error message).<br /><br />All of this hits home a point I have made before. If you are writing software to integrate with KnitML, please make sure you&#039;re coding to the XML specification and not the KEL syntax. The KEL syntax is really a tool to achieve an easy way to create a XML document. I would consider the KEL not stable for integration between versions. At least not at this point.]]></content>
		<id>http://www.knitml.com/blog/index.php?entry=entry090325-110627</id>
		<issued>2009-03-25T00:00:00Z</issued>
		<modified>2009-03-25T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Using KnitML, Part One: Creating the Pattern</title>
		<link rel="alternate" type="text/html" href="http://www.knitml.com/blog/index.php?entry=entry090324-130239" />
		<content type="text/html" mode="escaped"><![CDATA[With the upcoming release of KnitML Core Tools 0.5.0 (and the editor that goes with it), I wanted to show you how I approached converting an existing pattern, the <a href="http://knitty.com/ISSUEwinter03/PATTbanff.html" target="_blank" >Banff sweater</a> designed by Jenna Wilson, to a KnitML pattern.<br /><br />First, I created a project named Banff.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/step01.png',342,172,false);"><img src="http://www.knitml.com/banff-images/step01.png" width="342" height="172" border="0" alt="" /></a><br /><br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/step02.png',789,532,false);"><img src="http://www.knitml.com/banff-images/step02.png" width="512" height="345" border="0" alt="" /></a><br /><br />Then I created the KEL file...<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/step03.png',519,389,false);"><img src="http://www.knitml.com/banff-images/step03.png" width="512" height="384" border="0" alt="" /></a><br /><br />...renaming the default file name to banff.kel.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/step04.png',805,562,false);"><img src="http://www.knitml.com/banff-images/step04.png" width="512" height="357" border="0" alt="" /></a><br /><br />Here is what I started with. This is a template that highlights the basic structure of the document.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/step05.png',1021,741,false);"><img src="http://www.knitml.com/banff-images/step05.png" width="512" height="372" border="0" alt="" /></a><br /><br />A KnitML pattern consists of exactly one Pattern element. The Pattern element itself has a GeneralInformation, a Supplies, and a Directions element, and those in turn have elements.  If an element cannot be defined all on one line, its contents are indicated by curly braces.<br /><br />Then I took a look at the original pattern and put that information manually into this document. Since the pattern is given in two sizes, I picked the S-M size to convert.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/step06.png',1022,734,false);"><img src="http://www.knitml.com/banff-images/step06.png" width="512" height="368" border="0" alt="" /></a><br /><br />Elements like Name, Description, and Dimensions were fairly self-explanatory. I converted the square gauge (14 sts x 21 rows = 4 in) into decimal form (3.5 stitchesPerInch, 5.25 rowsPerInch). Knitters who like to read square gauge have an option to create their pattern that way, so I didn&#039;t need to worry about that.<br /><br />For sake of clarity and convention, items surrounded by double quotes are different from items with single quotes. Double quotes refer to literal text or a label. That is, they are written in a particular language (English in this case, as specified by the &quot;en&quot; value by the Pattern element). The values for Name and Description, for instance, are surrounded by double quotes.<br /><br />Single quotes refer to system IDs. These IDs provide a way to refer to the element upon where they appear in a different part of the pattern. It&#039;s a good idea to make them readable, but they don&#039;t have to be (they could be generated, for instance). IDs have a few restrictions. They must be unique in the pattern, and they cannot start with a number or cannot contain spaces. (They follow the NCName rules for XML IDs, if that means anything to you.) Additionally, an element cannot refer to an ID that is defined later in the document (elements are processed from the start of the file to the end). That is why they appear with dashes where spaces would normally be (&#039;yarn-type1&#039; or &#039;needle1&#039;, not &#039;yarn type 1&#039; or &#039;1st-needle&#039;).<br /><br />The original pattern has a section called Patterns. It defines three sets of instructions for use in the pattern directions. The 2x2 Rib pattern is a two-row instruction. RS Decrease Row and WS Decrease Row never appear apart, so I consolidated them into an instruction called Decrease Rows. Also, since the pattern needs to refer to Stockinette Stitch, I included that definition as well. To make these three instructions appear in the header, they went into the Directives and InstructionDefinitions elements, which appears directly under the Pattern element.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/step07.png',667,354,false);"><img src="http://www.knitml.com/banff-images/step07.png" width="512" height="272" border="0" alt="" /></a><br /><br />Notice that Row elements do not have to have row numbers; they are optional. When they appear in the header like this, if they are not provided, it is assumed that each instruction starts with row 1. (When they are in the body, row numbers will start with row 1 and continue upwards until they are reset.) Additionally, instructions in the header must specify how they are to be worked: flat or round.<br /><br />Next come the directions themselves. The original pattern is organized into major sections: Back, Right Shoulder, Left Shoulder, Front, Left Shoulder, Right Shoulder, Sleeves (2), and Finishing. In KnitML, each of these sections correspond to an InstructionGroup element. Each InstructionGroup gets an ID (to refer to) and a label (to display).<br /><br />An InstructionGroup element can be made up of Section elements. Each Section element corresponds to a paragraph in the original pattern. I did my best to make these correspond to the way the pattern was organized.<br /><br />Here is the InstructionGroup for the back:<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/step08.png',725,316,false);"><img src="http://www.knitml.com/banff-images/step08.png" width="512" height="223" border="0" alt="" /></a><br /><br />I consolidated a few things in this InstructionGroup. The original pattern has the 2x2 ribbing repeat listed as a 42-row repeat. To me, it seemed like the designer meant the ribbing to be repeated for 8 inches, since the row gauge was specified at 21 rows to the inch. I chose to express it by length because it seemed a bit more natural (and possibly more accurate in case a knitter was not getting the exact row gauge). I interpreted increasing 4 stitches &quot;more or less evenly&quot; across 86 stitches to mean k21, m1, k22, m1, k21, m1, k22, m1. (In the future, there may be a way to express an even increase like this, but right now the designer has to be explicit.)<br /><br />An InformationalMessage element provides a way for the designer to add helpful advice to the pattern. This can be anything from a detailed explanation of a technique to informal suggestions about altering the pattern. Additionally, there will be a way for an InformationalMessage to provide a &quot;summary&quot; explanation of more detailed knitting. In this case, the designer will provide the summary and then the details of the technique, and the knitter can choose to &quot;fold up&quot; the details if they don&#039;t want to see them (or the pattern can start &quot;folded up&quot; if they prefer it that way).<br /><br />Notice how some parts of the pattern have a &quot;State sts&quot; element, while others say &quot;State 34 sts.&quot; I did this mostly to show both ways of doing this. &quot;State sts&quot; will simply state the number of stitches currently being worked (whatever that number is). &quot;State 34 sts&quot; will do the same, but it will ensure that there are 34 stitches being worked and throw an error if it&#039;s not. This can help identify copy and paste errors.<br /><br />The next section is the back right shoulder.<br /><a href="javascript:openpopup('http://www.knitml.com/banff-images/step09.png',715,330,false);"><img src="http://www.knitml.com/banff-images/step09.png" width="512" height="236" border="0" alt="" /></a><br /><br />This section highlighted some deficiencies in the current KnitML specification. For instance, there is not yet a way to express putting stitches on a holder in KnitML. (This will change in an upcoming version of the specification.) As a result, there is an abnormal bind off / cast on combination in this InstructionGroup that doesn&#039;t quite follow the original pattern. Please forgive this section for now. :)<br /><br />I then went on to transcribe the Left Shoulder (Back), Front, Left Shoulder (Front), Right Shoulder, and Sleeves. The Sleeves required a level of detail which was merely summarized in the original pattern. Since KnitML needs to know exactly how to work the stitches, I had to derive the details based on the general instruction. (This will be implemented as a foldable instruction in the future.)<br /><br />Here is how I generally approached transcribing each row from the original pattern. I started out copying each row from the web site and pasting in into the KEL file. Then I did some minimal altering to make it fit into the KEL format. For example, the original pattern had a purl 1 through back loop expressed as &#039;p1tbl.&#039; In KEL this is actually &#039;p1 tbl&#039; (with a space). [RS] / [WS] also look like &#039;rightSide&#039; and &#039;wrongSide&#039; instead. Also, the desinger used spaces to delineate her row labels, whereas KEL expects colons. (At some point, some of this expected formatting may be able to be customized by the designer. We&#039;re not there yet, though.)<br /><br />Each row takes the form of:<br /><pre>Row [number(s)] (&quot;rightSide&quot; | &quot;wrongSide&quot;): operation(s)</pre> or <pre>Row [number(s)] (&quot;rightSide&quot; | &quot;wrongSide&quot;) {<br />  operation<br />  operation<br />}</pre>For instance:<pre>Row 1: k to end<br />Row 2 wrongSide: p to end<br />Row [3,5,7]: k to 2 before end, p2<br />Row [4,6,8] wrongSide {<br />  p to 2 before end<br />  k2<br />}<br /></pre>If you don&#039;t want the row number to appear, use the NextRow element instead. If you have a short row, use ShortRow.<br /><br />If you specify multiple row numbers that are not sequential (such as Row [4,6,8] above), you must surround the complete set of rows with an Instruction element. So the above rows would actually look like this:<pre>Instruction &#039;inst1&#039; {<br />  Row 1: k to end<br />  Row 2 wrongSide: p to end<br />  Row [3,5,7]: k to 2 before end, p2<br />  Row [4,6,8] wrongSide {<br />    p to 2 before end<br />    k2<br />  }<br />}</pre>The last InstructionGroup was the finishing instructions. The KnitML Specification currently doesn&#039;t have a good way to express picking up along an edge, so this section is done as InformationalMessages surrounded by Sections. Defining edges will be in a future spec.<br /><br />That is how I created the pattern. In the next post, I&#039;ll show you what I&#039;m able to do with the pattern once it&#039;s in this format.<br />]]></content>
		<id>http://www.knitml.com/blog/index.php?entry=entry090324-130239</id>
		<issued>2009-03-24T00:00:00Z</issued>
		<modified>2009-03-24T00:00:00Z</modified>
	</entry>
	<entry>
		<title>Why an Expression Language is Important to Get Right</title>
		<link rel="alternate" type="text/html" href="http://www.knitml.com/blog/index.php?entry=entry090318-124202" />
		<content type="text/html" mode="escaped"><![CDATA[I heard Martin Fowler give a talk a few weeks back about domain-specific languages (DSLs) and their role in software development of the future. He validated a lot of the assumptions I have been making along the way with the Knitting Expression Language (a DSL for knitting patterns), so it certainly feels good to know that I&#039;m on the right track.<br /><br />One of the most interesting points he made about DSLs was that they can enable people who don&#039;t think of themselves as programmers to program. His example was <a href="http://en.wikipedia.org/wiki/Cascading_Style_Sheets" target="_blank" >Cascading Style Sheets</a> (CSS). Web designers don&#039;t usually consider themselves to be programmers, but they are usually proficient in writing style sheets. Since CSS is a language that is targeted for a very specific purpose (describing presentation of HTML pages), it doesn&#039;t &quot;feel&quot; like a programming language. Yet that&#039;s what it is. It&#039;s not a turing-complete language, but that&#039;s one of its strengths.<br /><br />DSLs, in fact, aren&#039;t limited to computer languages; they can be relevant to language in general. Martin&#039;s example of this was the jargon required to order your favorite, multi-adjective drink from Starbucks. A Grande, Non-Fat, Vanilla, Decaf Frappuccino with Whip doesn&#039;t have much meaning outside of Starbucks, yet it is a concise way to communicate your specific drink preference to the barista. (By the way, this is <i>not</i> my favorite Starbucks <br />drink!)<br /><br />It should come as no surprise, then, that directions for any knitting pattern use terminology from an informal DSL. There are relatively standard abbreviations for knit, purl, slip, etc. Even though a legend is usually provided with the pattern, most knitters do not need to refer to it to understand that, for instance, <i>k2tog</i> <br />means &quot;knit the next two stitches together through their leading loops, creating one stitch out of two.&quot; We have to keep this in mind when creating a computer-based DSL for knitting patterns. Since there is already a DSL for expressing patterns, we should make our DSL look as much like the existing one as possible.<br /><br />I&#039;ve run across several knitting applications that claim to have &quot;pattern-like&quot; syntax, but in reality its expression is significantly hampered by the underlying programming language. This from the <br /><a href="http://knitter.sourceforge.net" target="_blank" >Knitter project</a>, for instance, still feels very much like a programming language:<br /><br /><code><br />sk fix(-3,0,0) co 7 fix(3,0,0)<br />turn k 8<br />turn k 2 k2tog k 2<br />turn toEndk<br /></code><br /><br />It would be fairly unreasonable to expect designers to express their patterns in this format.<br /><br />This <a href="http://chartgen.orangellous.com" target="_blank" >knitting chart generator</a> has much clearer syntax, yet the square brackets around many instructions make this a bit awkward:<br /><code><br />[k]8<br />[k]2,[k2tog]2,[k]2<br />k,k,k,k,k,k,k,k<br /></code><br /><br />The tool makes this somewhat easier to deal with by providing a graphics for create the chart. However, point-and-click solutions are traditionally not very fast. What if I were transcribing row-by-row instructions out of a book? In that case I can use type in the syntax, but now I&#039;m hampered by the square brackets. What if the pattern were published on a web site? I would want to copy/paste the directions, but short of coming up with a fancy regular expression, I would have to do this by hand.<br /><br />Now, I&#039;m not meaning to knock the work of the Knitter or Orangellous folks. They&#039;ve done a lot of work to create their software, and I&#039;m sure their programs will provide (or already have provided) value to the knitting community. And, to be fair, the usability of their syntax was not top priority. However, they may want to consider that an awkward syntax has the potential to get in the way of adoption.<br /><br />You may be wondering how close you can get to the look and feel of a real pattern while still writing something that a computer can understand. If you&#039;ve been reading this blog, you can probably guess. :)<br /><br />You could write the above directions like this in the KnitML Expression Language (KEL):<br /><br /><code>co 8 sts<br />Row 1: k8<br />Row 2: k2, k2tog twice, k2<br />Row 3: k to end</code><br /><br />This is indistinguishable from a real pattern. Yes, there is a bit of syntactic baggage to set up the pattern, and I need to take a closer look at improving some of it. In the interest of full disclosure, the full pattern would look like this:<br /><br /><pre><br />Pattern {<br />  Directions {<br />    co 8 sts<br />    Row 1: k8<br />    Row 2: k2, k2tog twice, k2<br />    Row 3: k to end<br />  }<br />}</pre><br /><br />It&#039;s also worth nothing that KEL patterns are not KnitML patterns, per se. Rather, they translate into KnitML patterns. KnitML is an application of XML, which represents a knitting pattern&#039;s canonical form. A canonical form is very important as an interchange format between software components, because the software processing is greatly simplified. Having a DSL sit on top of the canonical form gives us the best of both worlds. We get pattern readability up front, while programmers don&#039;t have to write software for every conceivable expression difference.<br /><br />To put it another way, KEL allows you to write patterns in a familiar way. In turn, it translates that into an internal standard that software of all kinds will rally around. Then any knitter can render the KnitML pattern in a form that&#039;s most familiar to the way they read patterns. Computer DSLs don&#039;t have to be syntactically perfect for them to be usable, but they should be clear enough to be meaningful and easy to use. The more meaning their syntax conveys, the less intimidating they will seem to the average user. Programmers can keep &quot;computery&quot; languages to themselves.]]></content>
		<id>http://www.knitml.com/blog/index.php?entry=entry090318-124202</id>
		<issued>2009-03-18T00:00:00Z</issued>
		<modified>2009-03-18T00:00:00Z</modified>
	</entry>
</feed>
