This is the textbook-ish way the process of computer programming is described:
- Identify the Problem
- Design a Solution
- Write the Program
- Check the Solution
Why would anyone think programming is hard? Four easy steps! I cannot remember one programming task I have done in 20+ years that I would map out like that as my flow.
Most of my processes fall under this sign (it’s one that still makes me wonder, what the heck did the sign maker have in mind?)
Then there are the time s what looks like a simple fix or addition ends up literally ripping out 90% of your sweater. Or you have worked so hard on the sweater, you forgot why the heck you were knitting it in the first place (hey, where did all these knitting metaphors come from?).
It’s been on my interest plane lately with my Creative Commons project to explore ways we can make use of the branching / collaboration features of GitHub as well as getting a better understanding of what’s possible with publishing sites from there. I outlined a bit earlier an experiment in trying to collapse / simplify a complex google spreadsheet into a single page interface and connect it to GutHub for editing or content suggestion.
And with a bit of tinkering I got something slick working:
Content was collapsed expanded using a tabbed interface on the left and a ______ load of accordions on the right, with the content for each node dynamically loaded via ajax form small HTML files.
I had a nagging problem. The functionality was provided (elegantly I might say) by two low price plugins I purchased Zozo Tabs and Zozo Accordions jQuery plugins. Were it on a standard hosted site, I’d be okay with the license terms.
But hosted on GitHub there is a problem, since anyone forking my repo could grab the plugins, and it likely violated the license terms (and yes, even on a public site, some one could worm their way into the source and download the files, but GitHub would make nabbing the files too easy).
Here are some failed end arounds / ideas:
- Putting a note on the README warning people they need to license the plugins. Probably not legally defensible. And the last thing I want to do in a Creative Commons affiliated project is something shady.
- Using .gitignore – this does things the other way, it prevents files on my local repo from going to a public one, not what I needed.
- Making the repo private – this accomplishes the protection, private repos cannot be accessed by the public, but their published pages are visible. The downside is we likely want public input into the process.
- Storing the licensed files on another server, protected by htaccess – This likely is workable, but my own efforts to set up the rules to allows access by my github domain all failed
Then I tried something I do not see mentioned in the computer science text books. I closed the laptop and went on a dog walk.
The insight I found was that I should have gone back to what I should have done before trying the commercially licensed plugins- look for open source / open licensed alternatives. The dread was (a) not finding something with the good functionality; (b) having to recode 90+% of what I had done; (c) Did you read (b)?
The Tabs were pretty easy to get working, and while I did not need it, there is a built in capability to load content to an open tab via ajax. But the Accordions were another issue; ajax content loading is not built in, and the solutions I found called for a bit more code rolling then I was up to doing.
So then I backed out again. On looking for a jQuery plugin with ajax content loading for accordions, I landed at jQuery EasyUI for Accordions and it seemed to be something I could use. And since they also have a tabs tool, I decided to lean it it for both functionalities.
Nothing was working, and maybe it was time for another break…
What a technical car crash were my programming attempts today. Gone dog walking….
— Alan Levine (@cogdog) April 27, 2016
Again, while away from the computer, I had a partial idea to change up some orders of operation. In some later hours last night, I got one small part of it working, and in a few hours of search and replace, and a lot of copy paste, I got it all updated.
I am not expecting anyone to really get this, but hey, this is my blog. But here is a bit of the functionality I am trying to achieve, or you can see it in action:
And the ironic thing is, I am not really sure if this will be something that will be used on the project. Someone is bound to say, “why don;t we just do it in a wiki?”
And thus, in my non textbook approach to programming, I am not always in this region purely to solve explicit problems. Sometimes its to experiment to find out what is possible. And so even if I never get to the golden nirvana of a finished project, there is a lot I picked up along the way in experience.
Frankly, Edison, 10,000 seems a low number to me. Try harder.
Top / Featured Image: My first 5 rounds of image searches went awry. I wanted something that looked like an irregular path, something that doubled back on itself. I tried in Google Images (filtered for images licensed to reuse, natch). I tried “irregular path” “irregular route” “random route” “zig zag” and “zig zag path” and …. (hey have you noticed that Google Chrome does not seem to store it’s own searches in history?).
Originally posted at CogDogBlog http://cogdogblog.com/2016/04/mapping-programming-logic/