Fear and Frustration

I was going to only title this post “Fear,” and write about how hard it has been to finish up my worksheet generator project, because I knew I was close to having something finished that I could show to my friends and colleagues and get them to beta test it.

I had a timeline — I’d have the website up by the end of the week, show it to a close friend and fellow teacher next week — and be using it by the weekend, while soliciting other beta users. By Christmas, I wanted to be running Google ads.

Fear

The basic premise of this post was planned in a few parts:

  • Pointing out that I often talked about just wanting to have something finished
  • Talking about how it feels to tell people, as an unqualified EFL teacher, that you’re working on a coding project
  • A brief summary of the challenges of converting a project that had been working in Tkinter into a Django application
  • And, last but not least, the surprising feeling of having to force myself to do the things that needed to be done to get the project ‘ready for deployment.’

It was strange to not want to work on the project. But I’d set myself a deadline and my classes will be starting back up. I want to use the website version.

With a bit of time and reflection, I realized that I was afraid of the next steps. Soon, I’d be exposing myself to the possibility of learning that other people don’t think my app is amazing. How strange.

Knowing that, it was easier to push through it. Which brings us to part two of today’s post.

Frustration

I don’t know why I think of Django development as ‘simple,’ what with the heartache and frustration I’ve experienced. Partly, I suppose, it’s because each of the problems I’ve had has been solvable though Stackoverflow and patience. And, probably, because they mostly amounted to me making a silly mistake.

And then I tried to deploy my app.

It was working fine, using the development server on my notebook and, even though it would be a long time before I ran out of tweaks to add, it was time.

So, I did the following:

  1. Paid for an account at Github
  2. Bought the domain I wanted on hover.com
  3. Paid for an account at Linode
  4. Spent hours in telnet and with various tutorials
  5. Paid for an account at djangoeurope.com
  6. Went back to experimenting with Linode, because there are more tutorials specifically for them
  7. Opened some red wine
  8. Seriously considered no longer coding
  9. Googled ‘django deployment’ just once more
  10. Realized I probably ought to be blogging rather than doing this

The power of words

Now that I’m on my second glass of wine and have been thinking about it for a while, I realize that I’m confronted with two problems:

  1. I don’t know anything about servers, of what I have to do to get them working
  2. I don’t know what I don’t know about servers, in order to google it.

That’s the thing about coding, half the battle is just knowing what the coding community calls the thing you’re trying to do. Once you know that, you can use some patience and elbow grease to get it going.

But now? Now I’m stuck. And I’m frustrated.

Advertisements

Django!

So, I reached a milestone without ever blogging about it: I ‘perfected’ the desktop version of my software.

Note the quotes. Obviously, there’s a lot more it could do, and the interface couldbe a little less clunky (you can tell I just tacked things on as I made them), but the software does what I wanted it to do when I started writing it: It creates PDFs of vocabulary workhsheets for English learners, entirely using hand-made material, but re-using material that’s been used before.

In fact, someone had the idea to add crosswords and wordsearches, and that wasn’t difficult at all. In addition, it will make a nice, alphabetized vocabulary list for the vocab a group has learned.

Arguably, it does more than I had intended for it to do when I got started. And that can only mean one thing:

It’s time to do the django. Since I got about halfway into the desktop version, I realized that it made more sense as a service than anything else, and that the web was the right vehicle for distribution. Imagine if material that I made for my classes could be used in other classes. Imagine if material that my friends and colleagues create for their classes could be leveraged in my classes?

The goal, pure and simple: make it seem like I’m working harder for my students than I am. And the web is the way to do that.

So, I’ve started trying to create a web interface using django. And I’ve been mostly successful. It seems as though very little that I wrote for tkinter can be directly ported without extensive re-writing, but, since I already know how it ‘works,’ I don’t have to figure out how to do it, I just have to adjust it.

Right now, a lot of basic functions have been taken care of, and I have to do a lot of the ‘filler’ work that isn’t so much difficult as… plentiful.

So, look for me to write a bit more about that as time progresses. As well as my insecurities as I go from the pride of working with software that I created myself, to the insecurity of asking my friends to take my software for a spin.

How XML Works

So, this will obviously not be an explanation of how XML works. Instead, this will be a short explanation of “what I think about when I think about XML.” And, I want to begin by saying that I am happy that this page here exists, as that’s where I went to double-check my vocabulary and, in the process, learned quite a bit.

XML basically is a standard by which your computer (or a Python library, to be specific) knows how to put information into text format to save to a file. If you’ve ever done much by way of HTML encoding, the basic formats will look familiar.

How to write XML.

Remember in the last bit where I said that I think of XML data as a pile of folders, some containing other folders? Well, basically, each folder is an Element. It has this format:

<ELEMENT /> or <ELEMENT>…</ELEMENT>

They both are elements named ‘ELEMENT’ (I don’t know why I do so much in all caps in my own XML, I guess it’s so that I know I’m writing for a computer and not a person.)

Of the two, the first is a self-closing tag. (That’s just the way of saying that no second tag is required to ‘close it’, like in the second example.

In the second example, the first tag ‘opens’ the element, the second ‘closes’ it.

The reason for opening and closing the element is pretty simple. Remember my example of a bundle of nested folders? Well, if we have an element meant to represent a user, it might also contain things like grammar this person has worked on, or a list of vocabulary that they’re using.

To include another element in an element, you open the element, create the other elements, and then close the element again. Like this:

<USER NAME=”Toby the Amazing”>

<VOCAB_LIST WORDS=”XML, pizza, whining” />

<PRACTICED_GRAMMAR>

<GRAMMAR NAME=”Simple Past” />

<GRAMMAR NAME=”Simple Present” />

</PRACTICED_GRAMMAR>

</USER>

(I’m sorry for the formatting, but I’m not willing to do all the weird stuff required to make it look nice with WordPress.)

So, if you look at what I have above, there is a user, and inside the user element (the first and last lines open and close the element) there is an element containing a vocabulary list, as well as another element for practicied grammar which contains more elements, each for a specific grammar that has been practiced.

If you look at the different elements in my example, within the tags, or within the opening tags, you’ll see where I wrote NAME=”Toby” or WORDS=”XML…”. These are attributes in the element.

Going back to my paper metaphor, I think of opening and closing tags as the folder that contains something, and self-closing tags as individual pieces of paper in that folder. So far, so good. The thing is, the attributes are what you’ve written on each folder/paper. So, in the folder you might have a hundred copies of a form that gives information on a grammar practiced (I could not name a hundred forms of grammar, that’s a bad example.)

But, just as it makes no sense to have a folder on which you have “Name: Toby” and “Name: Liam” written (which name is it?!) you can’t have two attributes with the same name in XML. I don’t know what happens when you manually write XML that way, but in the python library I’m going to write about next, it would just change the name.

Remember this: If you want many of something — grammar forms, words, users — what you want are elements. If you want to define your elements with unique properties, name, height, level of charm, then you want attributes.

Don’t worry, you won’t have to write XML

I went through all of that, and you’ll probably never write XML in your life (though I do write the initial tags in the XML files that I use, mostly because I’m too lazy to do it with code.)

In the next little bit that I write, I’m going to explain how I do XML in Python, and you’ll need to know the words element and attribute, but you’ll never have to worry about how to write it. After all, the goal is to have your computer do the work, not you.

Still, one of the great things about XML is that you can manually edit it, and I think it’s good to know how it’s put together.


This is something I’m writing mostly for my nephew in support of the Typing Tutor challenge that I’ve issued to him. I imagine all of this information has been explained better elsewhere on the Internet.

So why are you reading this?

Why I like XML

So, I haven’t been programming long enough — and certainly not well enough — to be allowed an opinion on what other people should do. But, I do think I can share why I recommend using XML to other new programmers.

It’s fair to point out that I’m talking about programming in Python with the Element Tree library.

It behaves like you’d think.

I didn’t fall in love with programming until I discovered object-oriented programming. It’s just easier for me to abstract out the idea of the different parts of a program as ‘objects’ that interact. (I can write a bit on object-oriented programming, if you’d like, too!)

A lot of my programs are just collections of objects. I have a dictionary object that manages so many word objects, for example, in my ESL worksheet application. And, when I need to save all this as a file, it’s nice to have a format that makes sense.

The way that it makes sense to organize all this data, to me, in the physical world, would be a great big folder or binder with lots of other folders and binders in it. But also, with thousands of loose pages.

There would be a binder that is labeled “Dictionary” and that binder would probably have a name and, because I record dates unnecessarily, the date when it was created. Inside, each word would be a folder that contained information on the word, its German translation, space, maybe for other languages, as well as things like what part of speech it is and if there are other words that have the same text. (A real example from my teaching: I teach in one company where ‘forks’ normally mean the parts of your bicycle that hold the front wheel, but I also teach a lot of people who also think that a fork is something to eat with. Obviously, it’s going to make a difference in the worksheets.)

And these word entries should have a unique label of some kind (so the different kinds of ‘forks’ can be referenced later) and, of the other binder full of sentences contains a good example sentence for this word, I might want to store the unique label of that sentence.

That’s all the data I have in this binder, right? (In your typing trainer, the binder might be for a single user — with records on the letters they’re learning, another with a list of keys they often miss…) And what’s great about XML, is that it gives me a way to save data in this format, if I only think about it the right way.

Even more than just saving it in this way, the Element Tree library gives me objects (they’re called Elements and SubElements, when I write about using Element Tree I’ll write more about it.) that behave this way. That means I can assign an entire Dictionary to a single variable and pass it to a function or a method.

In fact, a lot of my programming is basically writing objects that take a single XML object and ‘bring it to life’ by adding methods to work with the data in it.

You can read it.

Here’s the other thing about XML: I can use it to store data and then, when I realize I’ve made a mistake (there’s a typo in a word, or students say a definition I wrote is unclear), I don’t need to write up a bunch of code to access that data and change it — though I should and eventually will — but instead I can open the file in any editor and edit the file.

I don’t think it’s possible for me to overstate how thankful I am that I can read and directly edit the information I have stored in XML. Even more than being convenient, it’s reassuring to me that I can fix my mistakes without too much effort.


This is the first in a small series I’m doing on XML for my nephew who is also a new coder. He recently wrote me that he’d rather just set up a text file for the Typing Challenge I set him. Of course, he can do what he wants, but I think it’s the prerogative of an uncle to send long, rambling dissertations on his opinions.

Working with Working Code

This is a tales of pros and cons. I set myself the goal of creating my worksheets this (academic) year using my worksheet generator. The results have been mostly positive — the students don’t know it, but I’m proud as hell of the worksheets I hand out, the students are benefitting from the way vocabulary is repeated, and even the errors are room for good, spontaneous discussion — but mixed.

Basically, I’m leaving PyCharm open all the time, because if I’m at my computer, it’s either to improve the code (i.e., do some coding) or to use the code for its intended purpose. Somehow, I feel like I’m a one man example of the idea of producing “banana software,” developing features as I need them, often under a deadline which, though it may be self-imposed, feels ominous. (Right now, I’m taking a break from coding a new type of exercise which is called for in next week’s lesson plans — sure, I could just cancel it [I have a great relationship with the customer], but that would mean admitting defeat.)

The pros:

Basically, what’s great about what I’m doing now is that I keep realizing that my planning was incomplete. It’s in the usage of the software that I realize  how much more it could do. Some changes are just inserted as TODO comments in the code like “It would be great if this worked with that” others I implement immediately, because I realize it makes no sense to code the rest of the features if these basic things are going to change.

Even more, it keeps me at coding. Knowing that this stuff has to be finished by next week keeps me at my keyboard when maybe I’d like to be in a hot bath. And that keeps everything fresh in my mind. Great.

The cons:

Obviously, the pressure is a double-edged sword, but I generally embrace it. However, it does mean that I feel this pressure to code forwards, rather than backwards.

I don’t know if coding has directions. What I basically mean is that I feel the need to add the features, rather than improve how past features work. An example is from the exercise I’m coding. It’s being coded as an object and I’m copying and pasting so much from other exercises that, even though there is a base class that they all inherit from, there should be a second base class for this category of objects.

And I could get that done in less than an hour, probably. But I don’t have that hour.

The thing is this: I know me. I’m proud of accomplishments that I can see. I don’t know that I’ll ever come back to this once everything is working, because cleaning up code doesn’t feel like an accomplishment the way that writing code does.

Maybe, I need to work on myself as much as on the code.

 

It doesn’t have to be on your phone

After completing the django girls workshop — I still want to do the part with authentication — I’ve been looking for a ‘minor’ project to code as a web app. (That’s in quotes, because I think they all grow.)

I’d thought about a beer calculator — for brewing, how much grain to how much water, that sort of thing — but there are plenty of good ones out there.

And then I realized, in my lifetime (not that long!) we’ve gone from assuming things will be websites (“Ha, you could call it ‘myidea.com’!“) to assuming they’ll be apps (“That’d be a great app!“) But that’s probably because we read more about apps.

I’d had the idea for the Fantasy Pilgrimage for a while. Of course I imagined it as an app — after all, I think like many other people — but there was nothing to say that it would have to be.

Here’s the idea (of course, read the page on Fantasy Pilgrimage). But, it seems like a rough draft of the site would be a success if it could do a few basic things:

  1. Use the Google authentication service
  2. Connect to Google Fit to get fitness data.
  3. Calculate total distance traveled since a given date, towards a total.
  4. Display that as a percentage.

Of course, with time, I’d like to use Google Maps and display the progress. But, hey, first thiings first.

What my App does

I had an inspiration last night. I realized — after working on it for the better part of two years, including several reboots — what it is that my app does. I’m talking about the worksheet generator, which seems closer to becoming something now than it ever has before.

First, I think I have to mention what it isn’t.

What the worksheet generator isn’t

It isn’t just another application or website that promises to relieve you of the burden of preparing for your classes. I pay for such websites, and I think they have their place, but I’m not going to be able to compete with them, even by doing the job marginally better.

The worksheet generator will not be just one more place that you can go because you didn’t prepare a lesson and you want to print something out for that class that is starting soon.

Working just as much – or more – for more results

I realized that, if I had to tell another ESL/EFL teacher what it was that my app did, it would be to say that it does a lot of the ‘stupid work,’ so that the energy I invest in prep goes farther. There are a couple of ways that this manifests itself.

  • Organization: Never my strong point, this is what the project originally was supposed to help me with. The idea is to have a virtual record of what you’ve done with each group, in terms of grammar and vocabulary. The strength of this organization will be in helping to review regularly. And that brings me to the second thing:
  • Permanence: Maybe this is just one aspect of organization, but it’s something I’ve known that I’m bad at. I’m great at creating a single, excellent, engaging lesson. I’m not so great at tying them together into a series that makes sense in a meaningful way. The extent of my understanding of ‘permanence’ has been to say that, if we’re working on the simple past, I can do a series of lessons about the past.

    What I’d like to do in the future is to have a more clear sense of repetition, by which vocabulary that came up once is reviewed again and again in the exercises of the following week. Even more, I want to say “hey, we practiced this structure three weeks ago, let’s do it again with the vocabulary from last week.” And that brings me to the last main point:

  • Modularity: I don’t know if it’s just me, or if every teacher is lazy, but I suspect it’s the latter. If you’ve ever had a teacher, you probably know what I’m talking about. I’m talking about teachers who create one set of PowerPoint slides and then teach them forever. Or,  in my case, who prepare an exercise for one class and then modify it only slightly for another (generally to realize that I overlooked an inside joke meant for the first class and completely without meaning for the second).

    The thing is this: Most of the worksheets I create in OpenOffice are great for the class they’re created for, and only the top half of page two is really great for the next class. So, I could just copy and paste but, inevitably, searching through everything I’ve made to get enough material feels like more work than creating a wholly new worksheet.

    When I talk about modularity, I’m talking about defining — in XML or in code — the basic structure of some exercises and stringing them together (simple past is comprised of these 10 or so modules, some are text explaining regular, irregular and the ‘be’ verbs in the past, others are exercises practicing them…) and then just saying to my app “hey, we’re starting this block on the simple past” and it adding one module to each worksheet until the block has run its course.

    It’s important to note here that this is going to be in addition to the other ‘modules’ in each lesson’s worksheet — whether they’re vocabulary review or a reading text to take home as homework. And, further, that a module is going to define how the exercise is created, but I’ll still be prompted to generate new content for it (“Enter a sentence in the simple past using word ‘ginormous’.”) (Fun fact: I’ve never taught that word in my lesson.)

Looking at what I’ve written, I’m beginning to think that maybe the unordered list might not have been the best way to get that done. Still, I think that summarizes what will eventually make the worksheet generator different from the “we do the work so you don’t have to” websites.