Posted: February 13th, 2010 | Author: irv | Filed under: Apple, Cocoa, Companies, Objective-C, Programming, iPhone, mides | Tags: Apple, Cocoa, iPhone, ipod touch, mides | No Comments »
A few days ago I completed an analysis of what my profit and loss looked like for both of my applications. What I discovered was very disturbing, or would be to any entrepreneur.
I have to date put around 200 hours of work into Mides and around 90 hours into CycleMetrics. So far I have made less than $2,000 total on either of them.
Part of this is my fault, I started out with something of a flawed concept with the design of Mides because I was in love with the idea of nested code, self closing tags, and closures. This ended up eating away almost all of the devices’ memory, and was so recursive as to be nearly unmaintainable.
So I killed my darlings, went in for a heavy refactoring of the code without nesting, and ended up with a pretty decent mobile IDE.
However, at what my hourly rate is at this point in my career, based on my salary plus benefits, I am as of now, with all of my original plus ongoing effort into the software, about $30,000 in the hole on Mides, and $10,800 in the hole on CycleMetrics.
When I launched my app, shortly after the app store launched, I thought that I would be able to make back my money in 2 years and get positive. It has been 2 years, and I’m nowhere near making my investment back.
This is mostly O.K. since I have an awesome job, and I’m not missing a house payment or anything, but I think it is unwise to basically give away software that you keep shelling out effort on. I can’t let it die either, that doesn’t make sense, I love the idea of programming on your mobile, and I love the idea of being able to code on the apple tablet even more.
I also hate ads, and don’t want to do the ad driven thing. So while I’m still subsidizing the hell out of Mides at $9.99, it isn’t the slap in the face that $4.99 was.
So as a result, I have decided on $9.99 for Mides. I am putting in a fair amount of work to get to the tablet in an intuitive and sane manner, I also have a bunch of features planned. Some of which have been suggested by the awesome community at getsatisfaction.com/mides, and others that fit in with my dream of Mides.
I am still not sure what I want to do about CycleMetrics, but I have some online features that should be able to drive more reveneue for me. I don’t want to go to ads, and I don’t want to lock users in or try to steal their personal info to try to make a buck on it. That just doesn’t jibe with my philosophy.
We’ll see if the market thinks Mides is worth $9.99. I still think it is worth way more, but that is because I see it as it will be, not as it is. If people don’t think it’s worth $9.99, then they will later, but I can’t promise to keep the price there as I struggle to make it my dream of a fully featured mobile development environment.
Posted: February 8th, 2010 | Author: irv | Filed under: Apple, Cocoa, Companies, Google, Microsoft, Objective-C, Programming, iPhone | Tags: Apple, Cocoa, iPad, iPhone | No Comments »
This past weekend, I was thinking more about the iPad. One of the thoughts that kept coming back was about the iPhone / Cocoa Touch development ecosystem as a platform, and how that looks in comparison to existing platforms. The conclusion that I came to was a bit disturbing to me as a developer concerning the future of application development in general.
It is somewhat useful to quickly recap the development environments of the past to contrast them to today. First we need to talk about Microsoft and what a platform meant to them. To Microsoft, the computer was a tool for technical users. Even if their said goal was to put a computer on every desk, the engineers clearly have and had difficulty putting them into the place of their users.
As the computers’ abilities increased, so did their complexity, and the complexity of the OS. Doing simple tasks like taking a piece of text from a word processing program and putting it into your spreadsheet program in DOS was mostly ridiculously complicated. Windows made things a bit easier initially, but only for the most technical users. Doing what should be mostly simple tasks were still difficult, DOS was still around and necessary to do many common tasks. The thing booted from DOS which created no end of problems. It just wasn’t an optimal solution for the mass of computer consumers out there. This was evinced by a proliferation of “computer” classes which were supposed to take the burden of designing something that was easy off of the engineers who designed the system. That it did, and they proceeded to make a system that was even more of a tangle.
For those who would say that the Macintosh is much easier, I take issue with the word “much.” In reality Unix / Linux / Mac OS X.x is not terribly easy to use. To someone who has a good understanding of the computer, and conventions it is much simpler and more straightforward to use and manage. For a technical user Apple does a fantastic job of making most things that normal people want to do easy without preventing technical users from doing complicated things, but the underlying complexity is not without its cost to the typical end user.
Now, if you were designing a platform today, for millions of people worldwide, with different levels of technical ability, the issue of computer and operating system security looming large, and the ever increasing abilities developers have to make computers do insanely complex things in the blink of an eye, how would you develop it? Would it be like Windows, putting the burden of learning, understanding, and protecting themselves on the user? Would it be like Unix / Linux, putting the burden of everything on the user, but exposing incredible levels of customization to the user?
What you would do would depend on what your goal was, but if your goal was to provide the best possible user experience, you would likely ( I know that I would ) take it upon yourself to protect your users from viruses, phishing, hacking, malware, etc… You would likely make it difficult or impossible for developers working on your platform to make choices that would negatively impact the usability of the platform. You might choose a somewhat difficult language combination for development to make a barrier to entry for developers, to make sure that the developers that did create for your platform were of a caliber such that they could actually make compelling content for your devices.
You might establish a certification board of some sort to determine if the applications being developed for your platform met your requirements for ease of use, stability, and security. You may come to the conclusion that the only way to enforce your vision of the platform and be the ultimate consumer advocate, you would have to make sure that every application went through this board before they were available on your platform. Once available for your platform, you might make the installation and configuration experience as painless as possible for the user, even if it meant imposing further complexity of implementation on the developer.
Does any of this sound familiar. When I went through, designing a platform as a consumer advocate, what I ended up with was pretty much like what Apple has for the iPhone / iPad / iPod Touch development environment. With one exception, I was actually more stringent in that I wouldn’t allow wapletts ( web application applets ) on the platform. I would require those developers to just build a web application customized for the experience.
The funniest thing, or strangest if you don’t like that colloquialism, was that designing the platform as a developer, it didn’t look anything like this, in fact, it looked much more like the development experience around Ubuntu linux. Where I ended up is that perhaps as developers, we are heaping too much responsibility on the average user trying to use the platform. I think that Apple has the right mix with the app store experience for the types of devices that are running the Cocoa Touch framework on Objective-C.
That being said. I don’t like it. However, I understand it, and the UX / UI Designer at my heart rejoices at the emergence of this paradigm, where the responsibility for security and workflow consistency are on the developer, not the user. But the programmer in me rebels at having someone tell me how to design and implement what I want on my device. Having someone lord over me as to what is an acceptable software application is irritating to say the least. I think the UX designer, and consumer advocate in me wins, and there are platforms like Mac OS X that I can work on to satisfy the programmer urges in me.
I predict, however that Apple will do away with the use of the existing Mac OS X on the MacBook,the iMac, and the MacBook Air. I think they will start running this Cocoa Touch OS with all of the restrictions and HIG guidelines as the iPhone. I think that there will be an app store for these devices, and I think that it will be the only way to install software. Seeing iWork on the iPad is the first example of the migration of Cocoa Touch to a full fledged computer operating system.
Apple will probably, keep the MacPro line and the MacBook Pro, perhaps adding an iMac Pro running Mac OS X.x in the way we have always come to expect it, and it will likely become even geekier than it already is. The most floor slapping, hilarious thing is that Apple has come full-circle to an old Microsoft idea that was right on, however, big surprise, was improperly executed.
Originally Microsoft had its Windows Professional and Home lines, they had Windows 2000 for business and Windows 98 for home users. The concept was that they wanted to have a much simpler OS for normal consumers and a much more complicated, and powerful, platform for businesses to use. Apple has slightly turned this on its head, they, in my humble opinion, want to have a platform that is an awesome one for media consumers, and general consumers, and a platform for the programmer geeks that have made Apple what it is. It is for that reason that I anticipate a iPad Pro soon after the launch of the iPad, perhaps even as soon as WWDC ‘10. The iPad Pro would likely run a Cocoa Touch OS that was less restricted, and more like Mac OS X.x.
Ultimately, I think Apple wants, and will make everyone happy, but we are at the beginning of this incredible consumer platform, and I think that for its stated goals, the App Store, the “awful policies,” et cetera, are the best possible way to get to it. However, I think for its perception among geeks, Apple needs to communicate their strategy as soon as possible. If they intend to make all of their devices like the iPod Touch, then we have a problem. However, this is extremely unlikely. I can’t wait until WWDC this year!
Posted: February 3rd, 2010 | Author: irv | Filed under: Lifestyle, Programming | Tags: data, exercise, hardware, Lifestyle, metrics, Programming, software, weight loss | No Comments »
About 8 months ago I started running because I noticed that Nike+ was built into my iPhone 3GS. I had run in the past, but never very seriously. I started to lose a bit of weight, but it wasn’t coming off like I felt it should. I’ve always been heavy, except for the couple of times in my life when I went on a crash diet. Once I lost nearly 100 lbs, way back when I was 16 by eating every other day. Recently I think I have found something that works so A few days ago I felt motivated to indulge in telling my story on my blog since perhaps someone would find it helpful. Since my weight kept going up, and I kept exercising harder and harder, I thought that something must be wrong with me. At one point I was riding my bike to work, totaling over 200 miles a week and I didn’t lose an ounce.
Over the years, the lifestyle of a software engineer and a literature nerd took its toll on me and I gained back all of the weight that I had lost when I was 16, and then some. I signed up for one of Nike’s virtual running plans and started to run more and more. I was really enjoying analyzing the data that was coming out of my nike plus, that combined with the weather data from slowgeek. But I wasn’t really losing any weight. I just sort of settled into the fact that maybe I was just one of those people who were meant to be fat.
My wife wanted me to go to the doctor and ask for statins, which I did, because she was worried about my blood pressure and cholesterol, which I hadn’t checked in forever. My doctor agreed with me that something wasn’t right about the fact that I wasn’t losing weight, even though I was working out like a demon, that my blood pressure was so high, and that I was having allergy and miscellaneous immune issues. She didn’t want to give me any drugs, she is an awesome doctor, so she sent me over to get a lab done.
The cool thing about my doctor is that, much like a software engineer tracking a problem, she was able to string together a bunch of seemingly random data, anecdotal and otherwise, mix it with empirical data from the labs and quickly come to a working theory of what was going on. I had a chronic vitamin D deficiency. I know it sounds like a joke, and I thought it was pretty silly when she prescribed me high-dose vitamins, but my laughter in ridicule quickly turned into joyous laughter once the weight started dropping off. My cholesterol was fine, so that was the only thing. My doctor told me that a) everyone has a vitamin D deficiency, and b) since I was African American it was worse for me, especially living in the Bay Area. She said that vitamin D plays a role in, get this, metabolizing sugar. That without it your body has a hard time using the energy from sugar. Well most of everything we eat is sugar ( high-fructose corn syrup ), so this would explain why I couldn’t lose weight.
That wasn’t all either, I had been moody for quite some time, but the Vitamin D mellowed my moods and helped me to concentrate. About the same time I had been reading a book called The Omnivore’s Dilemma. I was becoming more conscious of what I was eating. I figured that since the iPhone was so awesome at capturing data with the Nike+ and that I always have it with me, if I could find something that would track my nutrients and calories on the iPhone I’d be able to see what was going on with my diet.
When I first started using LoseIt! (ITMS Link) I was shocked that almost all of my calories, between 4,000 and 6,000 a day were coming from carbohydrates. I was running at something like 90% carbs 2% fat and the rest was protein. Prior to using the program I was under the assumption that all I had to do was keep my fat down. With my Vitamin D deficiency preventing me from actually burning the massive carbohydrate load I was putting in, my body was just storing everything. Once I finally got the Vitamin D levels evened out with supplements, I started cutting down the calories.
Almost immediately I noticed that I started choosing the lower calorie foods with high protein such as eating a chicken breast, with no bread or rice, and a salad, instead of a salad and a horde of pretzels. The pretzels had an insane amount of calories, so did bread, and rice, so I stopped eating so much of those almost immediately. I started eating way more fat, and when I say way more, I mean that between 12% and 20% of my calories were from fat. I still eat way more fat than people say is good for you, all the while losing weight at between 1 and 3 lbs a week, with little to no ravenous hunger that doesn’t occur at mealtimes. Of course I avoid trans-fats and saturated fats, but I am not afraid to eat a steak or dark chicken meat. Once you get into training for endurance sports your needs will change, but at the beginning it is really good advice to follow Chris Carmichael’s : Eat Right to Train Right foundation percentages.
All this data was making me giddy, I could actually see what was happening to my body as I changed the mixture and quantity of what I was eating. As I fixed my diet, the constant hunger went away. LoseIt had me at around 2800 calories when I was at about 260 lbs, but now it has me at about 2060 at 200.
LoseIt works on a very simple assumption, that 3500 calories a week equals 1 lbs, so short 3500 calories a week, you should lose 1 lbs per week. With all the data I can now see, based on what I am eating, what is happening to me during races, long rides, etc… I have a much better understanding of why I am cramping up on rides, or during swims, or why I bonk, or can’t crank up the output on some days. I am learning which foods burn best for what.
Everyone thinks that the government has BMI and the diet guidelines all wrong, and to be fair, it is a bit off, but not as much as people think. People want to believe that they are just the way they are, and that they don’t need to, or can’t change. Many people think that they can be healthy while being seriously overweight, or that they are somehow special and the laws of thermodynamics don’t apply to them. Everyone is so focused on eating more “good calories”, etc… That is all bullshit. A calorie is a calorie. If you don’t burn it you will gain weight. Unless you are a triathlete, marathoner, etc… 3500 calories = 1 lbs period. First you have to fix any chemical or other issues in your way, but aside from physical biochemical issues, it is possible for everyone to be at a healthy weight, and it isn’t hard as long as you can be anal about tracking calories.
I would have lost 1 lbs per week had I not been running, picked up swimming, and started cycling more. Instead I was losing around 3 to 3 and 1/2 lbs per week. While doing all of this I was building my CycleMetrics application for the iPhone. Testing it was a monster, I had to do intervals to test the power output on the bike even when I wasn’t riding simply for fun. All the while aggregating my exercise data on Google Docs, and using LoseIt to count calories. Some people may think it is rude when I pull out my phone at dinner and start tallying up the damage before I eat it, but it helps me with portion control, and screw them if they don’t like it.
At the moment I have lost 60 lbs. I still have a bit to go to hit my ultimate goal, which is to hit the top end of the normal BMI range for my height and shoulder width, but now that I have a framework with which to control my weight and keep myself at peak physical and mental performance I am not concerned that I will hit them.
I would like to editorialize a bit and rant about the food industry. It is absolutely insane that I need this much technology to figure out what is in the foods that I am eating. I shouldn’t have to track every calorie this way, corn shouldn’t be in everything in the quantities that it is. The government shouldn’t tax fossil fuels, they should tax high-fructose corn syrup. Also, eating out is inordinately hard. I needed The Daily Plate ( Livestrong ) (ITMS Link) Application just to figure out how to approximate what I was eating and what the calories are in stuff at restaurants. They should really consider putting this on their menus voluntarily, and if they won’t the government should make them do it. Only because if they don’t everyone’s health care bills will rise.
With all of the money that we are looking at spending to improve health-care, I can’t believe that we don’t do something about the sugar / corn intake of people. Unless you look at what you are eating, the amount of calories that you can consume is really absurd. The bag of pretzels next to your desk that you munch on while coding and listening to glitch music is about 1400 calories, you’d be better off with two butterfinger bars. Better than that would be to eat a balanced lunch with fat, carbohydrates, and protein.
If I was reading this, and I was still where I was, I’d be saying to myself, yeah its all well and good that you found religion, but you are working out, eating right, and got quality medical care. It worked for you, but how can I know that it will work for me? Its a good question. I don’t know that it will work for everyone. However, what I do know is that for each of the people that I have given this app to who have seriously tracked what they ate, their results are the same as mine. Think about it this way, development without a framework is hard, it is tough to know where to start, and even harder to know when you have built enough.
LoseIt is like a framework, it makes the hard decisions about how much and what to eat. It lets you think about that fancy Lisp project that you want to build, instead of feeling guilty about eating too much, or wondering whether to eat this or that. Really it doesn’t matter much what you eat, if your goal is to lose or maintain a healthy weight. I still eat McDonalds, although I get a happy meal, I eat dominoes and drink copious amounts of beer. The difference is that either I work out to get rid of the excess calories or I stop eating and drinking when I hit my limit. That is not to say that you won’t have any health problems eating this stuff, it is just to say that your weight won’t be one of them if you stay within your calorie boundary.
As far as the exercise goes, there are so many different types of sports out there, even people who say they hate sports admit to not trying them all, who knows, you could have a desire to be a curling champion, or to do pole vault, etc… There is something for everyone.
If you capture the data, imagine the awesome analysis software you can write to find trends. Right now I am cross referencing my diet with the weather, and speed with altitude to see at which humidity and carb levels I perform best at with altitude. It isn’t so much that I care, it is mostly about the fun with analyzing the data. I never thought I would have so much access to the inner life of my body. Anyway, I this is about wrapped up. If you are having trouble losing weight look into Vitamin D, and if you haven’t already, grab LoseIt (free) and a copy of Omnivore’s dilemma, it will change your life for the better.
*UPDATE: 2/19/2010*
I forgot to write an additional thing that I am doing to control my weight. Since my father died a little over a year ago, I have been trying to get 100% of my fiber each day, somewhere between 25 and 30 grams. Coincidentally, I learned later that fiber plays an important role in helping you to feel full after meals, as well as helping your body dissipate excess calories. I would recommend that anyone increasing their fiber, however do it gradually or you might have some uncomfortable results.
Posted: January 25th, 2010 | Author: irv | Filed under: Apple, JavaScript, PHP, Programming, iPhone, mides | Tags: 1.7, code-completion, JavaScript, jslint, mides, PHP | 2 Comments »
I wrote Mides originally to help me to write web applications when I am on the go. A huge part of web application development is JavaScript. The iPhone / iPod is an awesome device for heavy client JavaScript apps. So as a result, I added JSLint in Mides 1.7 to make debugging JavaScript easier.
The main problem with the developer setting in Mobile Safari is that it is inaccessible to other applications. Since one of the main purposes of Mides is to enable development with either no, or an unreliable internet connection, it wouldn’t be possible for Mides’ internal HTTP server to run and serve the mobile safari application with content. This is the entire reason I wrote an HTTP server for Mides, so that JavaScript XHRs would work correctly for testing.
What I have done to help out with JavaScript debugging is to modify Douglas Crockford’s JSLint library slightly to make it work on the iPhone. It helps out with outright errors, but also with many excellent tips for writing safe and readable JavaScript applications. You can see the errors and optimizations by tapping on the burst and exclamation point icon when it appears over your JavaScript or HTML. This feature is optional and can be disabled in the iPhone settings.
Another issue I wanted to address with a new feature is that I always forget the argument, or the exact PHP method call that I want to use, especially around MySQL. I already had the documentation in there, but since it is a full-text search, it tends to take a while. So I added a new feature that allows you to look up just the method signature, that is the method name and the arguments to the method. I didn’t want to put a button in there for this, it just didn’t seem right. I tried for a while to come up with something usable, and I think I have figured out something that works. You just need to twist the phone to the right ( or left ) to do the code-completion on the method. If the text before the cursor matches one or more PHP method signatures, then it will add that value in context, in line into your code with the argument types. If it matches more than one, it will display a modal dialog that will allow you to choose from the top 5 PHP methods that match what you have typed.
One fix that a customer asked for on getsatisfaction.com/mides was that I make tabs parse properly. I also added that in Mides 1.7, now your tabs will be properly displayed. To create a tab, just space 5 chars into the document.
I am adding features both at the request of customers on the burgeoning community on getsatisfaction, as well as through my own usage of the product. I probably won’t implement all of them, but please keep the suggestions coming. They help tremendously. Some of them are really tough to implement, but if they make it more usable I’m all for it.
One of the main issues around Mides is moving files onto and off of the phone, Apple hasn’t made it easy, and FTP is not the best solution, it is a nightmare to support, and difficult for users to set up. I thought about having a small application that you could install on your Mac and PC that would make it much easier to transfer files with, but this didn’t seem like the best solution either. I am actively thinking through better ways, but nothing so far has really stuck.
At any rate, I am constantly trying to make Mides more useful, I know it has been rough, but I’m glad to see that some of you are starting to get real use out of Mides. I hope to keep making it better and eventually to rival and in some ways improve upon the desktop coding experience.
Posted: November 17th, 2009 | Author: irv | Filed under: PHP, Programming, Rails, Ruby | No Comments »
I am struggling mightily with this one. I love ruby and rails, but more and more I am resenting the constraints of the controller architecture, the router, and activerecord, and I miss writing and tweaking raw SQL. This is not to say that I don’t love rails for quick and dirty stuff, and it has done wonders for writing MVC web applications, but I miss being able to break that pattern where it applies and being able to understand the result. I view rails just like I view Cocoa Bindings. I love the magic that they do, but there is a performance cost, and it is suboptimal for me to have little to no visibility into how they do what they do.
My friends who are really into rails tell me of course, you can use it without those modules, namely ActiveRecord, but if my problem is with ActiveController, and its routing magic, along with the conventions then what is the point. I was looking at MERB, but it is difficult to say what the result will be in rails 3. But almost no matter how I consider the outcome of that Merb will inevitably become more Rails like. I mean, rails is the 800 lbs gorilla in the web dev space, who would argue with Rails and win?
Well, there are plenty of examples of ugly PHP sites, and there are some examples of almost elegant code in PHP. Better yet, there is no magic, I can avoid heavy frameworks if I choose and still have my choice of easy deployment options with mod_php. The rails community keeps saying that hardware is cheap, and it is if you have money to begin with. If I need to deploy on a $30 / month host, it is very hard to deploy a rails app with a homegrown framework on rack. I am sure they exist, but PHP hosting has gotten so cheap as to almost be an afterthought.
Some of the PHP code that I have written recently is quite clean and readable. Its using classes and MVC to a degree, but I have objects that implement a hydration base class that allow them to persist their contents by overriding some simple parameterized SQL via PDO in the subclass. That is really all of the database abstraction that I need. If I want to persist objects, I’ll just save them to disk. Ruby’s marshal works just fine for that, so does PHP’s serialize / unserialize. If I want to use a relational database, I’ll write SQL and let it play to its strengths instead of pretending that it doesn’t exist.
The functional and library support that PHP has is unparalleled in the web dev community. I would have to agree with Rasmus Lerdorf that I like my SQL to look like SQL, my JavaScript to look like JavaScript, and my implementation language to look like my implementation language.
This is not an anti-framework rant, despite the way it sounds. I love Rails, Cake PHP, Groovy, Struts, etc… I think they are a great way to get a project going quickly or as a way to learn good web development processes, but I also think there is a time where you need performance and control, and this is it for me. I think most web developers should start by learning one of these frameworks. Once they can understand the tradeoffs you make when using them, it is probably time to leave. I don’t differentiate, I think that JavaScript frameworks are the same thing. They are awesome until you are performance bound, or you are trying to express a design that the frameworks either didn’t consider, don’t support, or don’t match the framework creator’s view of the world. That is fine, I don’t want for DHH to accept that there are times when convention over configuration is too cumbersome and the performance tradeoff isn’t worth the simplicity, or that some things are better expressed in a functional way instead of an OO way. For those projects, I just won’t use his framework.
There are totally justifiable situations in which Rails is the absolute best choice. I work in Rails every day at work and love it for that particular problem domain. I just have started realizing that I have been seeing the world as Rails shaped nails. There is no one language, framework, design pattern, or library that is the end-all-be-all method for solving problems. It takes good practices and pragmatic choices to choose the best tool or tools for the job. I was getting away from that, now I am coming back.
Posted: June 7th, 2009 | Author: irv | Filed under: Programming, android, java | Tags: ast, compiler, descent, difficult, executor, Interpreter, mides, PHP, recursive, top-down | No Comments »
For the past couple of months, I have been struggling to write a PHP interpreter for an upcoming Android version of Mides. The tokenizer was fairly easy, building the Abstract Syntax Tree was relatively uncomplicated, but now we come to actually writing the executor. This is giving me pause.
I totally understand why Joel Spolsky says that there are two classes of programmers, one class that sort of hacks their way through life, and another that writes compilers for fun. I guess I am trying to blunder my way into the latter class. At first, it didn’t seem to be so difficult, but eventually it has gotten so hard that sometimes I feel like just dropping the whole thing entirely. However, when I feel like bashing my head into the desk, and / or throwing my MacBook Pro out a window, I know I am on the right track. That is how I felt when I was trying to learn Java and Objective-C a few years ago, or attempting to understand domain modeling as it pertained to Object Oriented Programming, before understanding Object Oriented Programming.
I guess these are just things that we all must get through, I also see why most CS majors don’t every actually finish their compilers. I, however have a dream that I can develop web applications without being encumbered by any sort of connections from my handheld.
The first part that slowed me down was that I was trying to approach the executor by compiling the program to opcodes and then running them against the system, sort of like the asm function in C. That won’t work with Dalvik, at least not in an elegant way. Then I asked this question on StackOverflow, and the answer made me think; I don’t think I quite got it immediately, but now I understand. It basically comes down to a large hashmap of keys ( variable names ) and their values, ( the statements to evaluate into them ). OK, I get that, but the new problem I am facing with the top-down recursive descent parser is how to handle classes and functions efficiently.
I realize that generally a class is just a new hashmap of values, scoped to a variable handle in the global hashmap, a function is similar in that it has its own scope that is not shared with other objects in the main hashmap. The recursion here can make your head hurt. The problem I am facing now is that if I have a statement ( series of tokens ) mapped to a variable, how do I handle, a ) parameters, and b ) not re-interpreting the tokens each time the class is instantiated. Another issue is how to keep the scope of a single instance different than another instance, unless there is a shared static variable in the hashmap between them. I am looking at V8’s source to try to understand the concepts behind their VM. I think that is how they boosted speed so greatly for OO based JavaScript applications. They must only parse those tokens once. There are all kinds of bugs I can see introducing into my fledgling interpreter by doing that.
I guess what I am understanding is why PHP has taken more than a couple years or more to get where it is today, why Ruby still has quite a few oddities to the language, and why Python basically needed a complete rewrite for version 3. This is not easy stuff, but nothing worthwhile is. I have never considered the possibility that this may not fully work in any practical sense. When I do release the Android Mides, the PHP parser functionality is likely to be beta. I did look at the code once for Quericus, but without some sort of object diagram, I can’t really understand what I am looking at. Much of the code is mixed up with the server code so it is difficult to figure out what is doing what. I have read a few pages of the Mak book and I’m thinking about buying it just to see how he implemented the parser, but I am not sure it will do me any good.
I may consider creating my own language for use with Mides, and then compilers that generate PHP and Ruby source code from it while I work on versions for Apache, Nginx, etc… In lots of ways I think it would be much easier, and I could offer type checking and other things from compiled languages that help build more robust code. I would maintain the PHP documentation that is present in Mides, and naturally you could FTP up the code to your server and test it there. But I think that would be copping out, and I don’t like to have something like this beat me. I do however have to realize that PHP wasn’t built in a day, and that this process will not happen immediately.
I keep asking myself what would Steve Jobs do, and the answer I keep coming up with is that he would go his own way, well I’ll keep stewing on it, and hopefully the end result is that I will become the sort of programmer that Joel would want to hire, although somehow I doubt I could ever achieve that level of software engineering excellence
.
Posted: May 7th, 2009 | Author: irv | Filed under: PHP, Programming, android, iPhone, java, mides | Tags: android, IDE, Interpreter, iPhone, mides, parser, PHP, Programming | No Comments »
For the past few weeks I have been working on writing a PHP interpereter for Mides. As I know that I am not allowed to do it for iPhone, as it would involve downloading and executing scripting code, which is not allowed. I have only been looking at the tokenizer for the iPhone, while I have been looking at the full monty for Android.
I actually have gotten to the point where the tokenizer is passing a lot of my tests, but there is a lot of ground to cover with PHP. Tommy Carlier’s blog on writing a parser has helped tremendously. Still, even after getting the tokenizer working, I have to write an interpreter to execute the tokens. This involves implementing the many methods that PHP has built in, so it will be a while until I get that completely done.
I am pretty frustrated with Mides for iPhone, actually, I wanted it to be a full PHP implementation and editor, but until the Terms and Conditions change it isn’t worth the effort to build an entire PHP interpreter just to have the app rejected. I am still improving the iPhone version, and the next update should be a huge improvement over what is currently there. I had to remove the nesting because I need the memory for documentation search as well as the PHP tokenizer that I am working on. Overall, the next update for Mides will make it better, it will be close to what I was hoping for, but it will never be completely what I was hoping for on iPhone.
The Android version of Mides on the other hand is shaping up nicely. The Android text view supports color so I have some syntax highlighting happening which doesn’t hurt performance on the G1 too badly. The tokenizer is mostly done, and now I am designing the interpreter. Development on Android is going a lot faster since I don’t have to worry quite as much about memory leaks, although if you try you can still make them happen.
At any rate that is why there haven’t been any updates for Mides in a while, I have been working on localization, parsers, and interpreters. I am spending most of my time on the iPhone version of Mides, but it seems that I am getting farther with the Android version, go figure.
Posted: April 16th, 2009 | Author: irv | Filed under: CSS, JavaScript, Programming | Tags: animations, css3, keyframe, patterns, web development | No Comments »
I understand the desire to push the development of web based applications to the next level, and allow them to truly compete with their desktop counterparts. I like the functionality with the new perspective properties, keyframe animations, transformations and the like. For years we enjoyed these features as part of Flash, which could never really figure out what it wanted to be. Was it a programming environment or some sort of design environment? We continually had poor tools that we made the best of to do some incredible things, but I think its time to take a step back and look at what we are actually doing, and where web application development should be.
For example, have a look at this syntax for defining a keyframe animation:
@-webkit-keyframes 'wobble' {
0 {
left: 100px;
}
40% {
left: 150px;
}
60% {
left: 75px;
}
100% {
left: 100px;
}
}
This is strange in that we are now defining properties in CSS. This is ultimately a named structure which defines the behavior of a function, that doesn’t exist to, and is not accessible from JavaScript, the supposed language for logic and control. The problem here is that we have variables and objects that are outside of the scope of the primary programming language. This creates a second language with overlap, and set of objects that controls and defines data for UI behavior. So far, the only functional code in CSS is via the pseudo-classes such as :hover which can then trigger the animation or transition outside of JavaScript, but it wouldn’t stretch the imagination to see a future where CSS is doing more.
With HTML 5 we are packing more functional logic into the “structured data” tier of our web applications, which undermines MVC and creates unique problems to developing web applications that traditional desktop application developers do not face. The complexity introduced by making developers use 3 different functional languages for UI, each with their own data objects, variables, and execution or functional code should not be underestimated, not to mention the complexity of the language they need to use for their application server and its interaction with JavaScript / CSS / HTML languages.
As more desktop applications are moved to the “cloud” the engineering effort required to build applications approaching the complexity of Eclipse for example would be daunting, and could perhaps be more expensive than developing it natively for each platform. This is due to platforms becoming less diverse as time goes on through things like Mono for ( C# ), Ruby and Java on Linux, these same things with native UI bridges on Windows and Mac OS X as well.
I don’t really want to see that happen, but for the web as an application development platform to mature, I think these languages need to be consolidated. Typically in a normal windowing environment, such as Windows, Linux, or Mac OS X, there are libraries that are typically written in C / C++ that drive the UI and access to the hardware. Previously, a developer would write code to that specific library on a specific platform for performance reasons, and be required to maintain multiple sets of controller / model code. The performance reasons for doing this today are fading, so abstractions like the Cocoa – Ruby bridge are becoming more prevalent. This allows a developer to implement most of their business logic once with a minimum of code dealing with specific platforms in the language of their choice. Most of this code is usually portable to other platforms, including web.
The increasing complexity in web development, and decreasing complexity and homogeneity of desktop platforms / hardware, is setting up what I believe will be a renaissance of desktop style development, or mono-language application development. I think, however that the new class of desktop / mobile native applications are different than the traditional applications in that their model may be in the cloud with just a data cache on the actual client.
I believe that this approach, having a cloud model with a less complex native client rendering content, represents the best of both worlds. A robust service based model that makes tables of data accessible to the client, whatever its configuration is optimal for keeping your options open on the UI implementation.
You get the power of the local CPU, a reduction in complexity by utilizing the same language on the back end as the front end ( possibly ), and the flexibility of having the data model in the cloud by writing native clients in Ruby | Java | C++ | Cocoa. There is a side benefit of being in closer compliance with the MVC pattern that should help reduce complexity and promote code reuse and readability.
Most web developers are doing this today, but they are doing it either by not using HTML / CSS and focusing all of their efforts on JavaScript, and treating HTML as the basic building blocks of a widget approach, building up the “windowing system” themselves, and then using another chunk of JavaScript as the “controller.” Or they are doing it by pre-generating the HTML / CSS / JavaScript on the server, and abstracting it away into their native language ( GWT as an example ). Both approaches are fine, and they work, but they do not address the increasing complexity of the resulting applications.
I think that the most effective method for solving the problem is, as always, to meet in the middle. XUL was an early attempt at this, but it still ended up requiring developers to use multiple languages. What I am hoping to find time to work on is a browser that does all of the existing standards compliant stuff, but in addition to that gives developers a method to use the native windowing system through a scripting language, sort of like using JavaScript to do desktop application logic, but that is downloaded from the server and cached on the client in the HTML 5 manifest method. The resulting application would use only that language for all UI and logic. The language would be required to bridge over the 3D engine ( OpenGL ), a widget interface that looks like native windows ( could still be web based behind the scenes ), and the sound APIs. More importantly it would have to handle binary data as native objects and streams.
I think that currently the languages that are good candidates are Ruby, Python, and JavaScript. Ultimately it would be best if the web application had access to the camera and other hardware with the user’s permission, but I don’t know if that is really required or desired, Flash currently does a good job of managing permissions around this stuff, but I think more sandboxing is needed for something of the scale I am thinking of. Microsoft tried it and failed with Active X, which was a good idea, but gave too much access to the local machine. I’m working on it, but I’m just one guy with a day job, so it takes me a long time. Eventually I’d like to make it an open source project, but I’m a long way off from it.
To sum it up, I think that for the web languages to keep going the way they are is courting disaster; making CSS more beefy and complicated isn’t a good solution. Already JavaScript, through the canvas tag, is impinging upon CSS’s supposed territory, but most of this display stuff should have been there exclusively from the beginning.
There is too much overlap between CSS / JavaScript and HTML. We will be stuck with fail whales everywhere because there are too many points of failure, and too many areas to specialize in. Even if IE fully embraces web standards the general development pattern will be too complicated to support the pace of development, and the complex feature sets available in desktop applications. If you look at the cost of hiring a CSS specialist, a JavaScript specialist, and a server side specialist, web startups will be more expensive than desktop or mobile native app startups. Hiring a “mono client” specialist that can do all of the things that previously required 3 people, it will reduce to cost of application development in the way that AJAX did originally, and keep the the more ambitious web startups viable. Today for example I saw a startup offering to do video editing through the browser, wow! The future is super bright for web development, but I think some refactoring is necessary to fuel the next surge of productivity.
Posted: April 8th, 2009 | Author: irv | Filed under: JavaScript, Programming | Tags: dom manipulation, framework, JavaScript, performance, speed, test | No Comments »
I have been wondering for a while which JavaScript framework is the fastest. I was thinking about writing some sort of test to try to determine which one had the best speed, but I have found one that seems to work. Mootools SlickSpeed Test is a good start.
It seems to focus on DOM manipulation / access / iteration speed, rather than testing the functionality built into the frameworks. I suppose that it would be tough since each framework offers different things. When I ran the test, Prototype 1.6.0.2 was the slowest, YUI 2.5.2 was the next slowest, MooTools 1.2 was next up from the bottom, JQuery 1.2.6 was the second fastest, and Dojo 1.1.1 was the fastest by a wide margin in Safari 4 beta, albeit with some errors.
In Google chrome 2.n beta, the results were as follows:
- JQuery 1.2.6
- MooTools 1.2
- Dojo 1.1.1
- YUI 2.5.2
- Prototype 1.6.0.2
In Firefox 3.0.6
- MooTools 1.2
- JQuery 1.2.6
- Prototype 1.6.0.2
- Dojo 1.1.1
- YUI 2.5.2
In IE 8 ( Wow IE 8 is slow )
- Dojo 1.1.1 ( many errors disqualified )
- JQuery 1.2.6
- YUI 2.5.2 ( a few errors )
- MooTools 1.2
- Prototype 1.6.0.2
iPhone Safari ( DNF / Could not run / Simulator)
- JQuery 1.2.6
- MooTools 1.2
- Dojo 1.1.1
- Prototype 1.6.0.2
- YUI 2.5.2
Android Browser
- JQuery 1.2.6
- MooTools 1.2
- Dojo 1.1.1
- Prototype 1.6.0.2
- YUI 2.5.2 ( Big Suprise )
What is interesting about these tests is that in general it seems that you should use JQuery if your development pattern involves heavy selector use. I still prefer Prototype because of the programming features that I get with it, even if the selector part is slow. IE 8 breaks a lot of the frameworks. Prototype and JQuery hold up the best it seems. I haven’t really looked at MooTools however.
On mobile devices, you should think long and hard about using any framework that involves added overhead since the devices are really slow. It seems that Dojo supports the built in Safari functions for dom navigation or something. It was wicked fast in Safari 4, but had a few errors. Overall JQuery is probably the best. I guess I’ll have to take a look at it, though reluctantly. I still need to write a test to check iterator performance though.
Posted: March 8th, 2009 | Author: irv | Filed under: Programming | Tags: careers, hiring, Programming | No Comments »
I was listening to the Stack Overflow podcast the other day and the discussion turned to hiring. I then thought about an ongoing issue with my family, basically it is endemic to good software engineers, “Why can’t you just stop when you get off work?”
The reason finally dawned on me today. The answer is that we are hired for what we are as opposed to what we do. This is what causes problems when companies hire people who think programming is something they do. Writing software is something that I can’t stop doing. I honestly feel depressed if I have some idea that I don’t work on.
As far as hiring is concerned, it makes sense for these companies to view hiring these types of programmer in the same way you would hire an actor, or an athlete. You are looking for someone who not only has talent, but who also has a natural obsession for solving problems. IMHO talent is useless without practice. I’d take a hardworking programmer with little to no talent over a talented programmer with no work ethic 10 times out of 10.
Realistically, companies don’t need for their whole programming staff to be of this type, but their lead programmers should be. Programmers who only work from 8 to 5 will be fine implementers, but no matter how much schooling they have, they just won’t have the experience to design great software, likewise they aren’t likely to have the passion to dream up the most creative solutions for your toughest problems.
This is why it doesn’t always make sense to pay all of your programmers the same amount, unless you hire only essential programmers, Google strikes me as a company like this. These programmers aren’t necessarily paid for their output, but more for their ideas, so they might often not appear to be doing much of anything. Then suddenly they will be taken with something and will work day and night on it.
In most organizations, the essential programmers are like lead actors, rockstars, and top artists, usually they are a pain, and you may often wonder if they are worth what you are paying them, but the project just wouldn’t go without them.
The key with all of this is to not mistake essential programmers for normal programmers and vice-versa. You will have problems retaining the essential programmer if you hire them to just be a programmer, and you will not get the performance you expect from a regular programmer in a role that should be occupied by an essential programmer.
Recent Comments