FIrst, apologies, this is just such an interesting experience I need to vent somewhere or go crazy I hope someone will find this piece entertaining or even perhaps helpful.
O.k. so I work as a contractor within embedded systems and web. Latest job started about three months ago, when one of the higher uppers managed to have a brilliant idea; They want to implement a web server management interface on The Productâ˘.
Now, The Product⢠is a highly specialized embedded system, used in an industry setting. After some back and forth on the subject, here are the basic specifications:
- The Product⢠is developed in C exclusively
- The webserver must be implemented as a single threaded task
- There is a TCP/IP stack implemented
- The hardware is tiny and is an integrated SoC with a few ports
- Available storage is 2 MB
- Available RAM is 256 kb, of which 100 kb is already used
- NO Open Source Software allowed, due to conservative company ideas
- Wants support for AJAX and responsive web design
- The Product⢠will not have Internet access of any kind
- Should allow for web interface device control
- Should be compliant with: HTML5, CSS3, ECMAScript 6, HTTP(S), SOAP
- Needs to support at least three browsers (Firefox, Chrome, Edge)
⌠And the best part, I was originally supposed to get a front-end developer to help me, but he quit 1 week before I started and they have yet to find a new one. Of course!
So, I have to write a full stack http server from the ground up that does a lot of heavy string parsing in C, make all of that work, then switch to JavaScript, and make the entire interface fit in like 50-60 kb of usable memory, with the assistance of perhaps 1 MB of flash storage. And no Internet Access! Wow. Just⌠WOW.
So, immediately all forms of unoptimized imagery is out the window, > 8 kb is pretty much useless to my purposes. Same thing with template files, I could develop a template engine but that would take time. O.k. time to look at the various frameworks available. Oh, I can barely use any frameworks due to the stipulation of no FOSS/unlicensed products. Ok then!
So I sit down, start to get the networking stuff up. Brush off my knowledge on sockets, poll() and select() APIs. Quite easy, actually, and I get something you can talk to the next day.
Next, developing an HTTP parser from scratch, designed to be small, lightweight, tiny and only support certain headers. This works fairly well, but takes time. A lot of time. Iâm stumbling through in the dark, and clock is slowly ticking away. I make improvements but after 6 weeks I get a call from the product manager who wonder why a prototype takes so long to develop. I explain to him that there are six orthogonal technologies involved here (TCP/IP, TLS, HTTP, HTML/CSS, JavaScript and SOAP) and that the frontend guy, who was supposed to do the three later parts, left. Week after, I am done with the first prototype. For something held together with duct tape, chewing gum and paperclips, it runs remarkably well.
Allright, now for the difficult part! Which, in my case, given I have done HTML/CSS/JavaScript for 10 years by now, actually is the easy part. The frontend. This only takes 3 weeks to get a good, decent prototype work going. Sure¸ not perfect, but the pages are displayed where they should be, MVC-ish design, and best of it all - the web resources only take up a total of 60 kb, images and all! Not easy to get it that lean and mean, but I did it.
But, after two weeks, the deadline is passed, which means corporate does not feel like renewing my contract. So, since I âcanât meet deadlinesâ (which were unreasonably set in the first place) apparently I now gotta find another assignment. Because I chose the hard but rewarding path of going the extra mile to make this portable to the related Dis Project⢠and Dat Projectâ˘, so basically all they need is one week integration work to save 8 weeks per project. Too bad they donât think far enoughâŚ
Maybe I am just too much of an architect and take too much pride in my work to be a good contractor? Ah well, not too sad about it, will definitely not miss parsing strings with C on this fun little project, but it was interesting for sure to finally build a full stack webpage from HTTP server and up. What I have is already delivered + integrated, and got another thing lined up in August too. Letâs see the next guy struggle with juggling all those tech together⌠Thinking about doing a from-scratch implementation and releasing that under a BSD-style license, but letâs see what happens!
Anyway, rant over. Carry on! Hope my little rant brightened up the day for someone!