Wednesday, December 28, 2011

There is No Such Thing as Proprietary Client-side JavaScript

 



 About 3 years ago, I launched my first product. I built it with two fabulous partners, who continue to produce awesome things. It was a little app, and a tool I thought made for better web. It is no longer online, due to costs, it was a URL aggregator called bundl.it. It was a big deal for me, as it was something I made, and put online for others to use. It was a useful tool, and I'm still very proud of it.  


 

A year or so later an established website in the same industry launched a feature that was doing the exact thing that my app was made for. They even gave it the same name. 

 

When the news hit I was flooded with emails from friends and folks that had happened upon my site. "Hey, are you working with xxx?", "Did you see what xxx did? They totally copied you!", "How could they do that, I'm so sorry. You should do something.", "Are you going to go after them?"

 

At the time I was disappointed, not because my idea had been "stolen," or "copied" by a larger company. I was disappointed because I knew that had I put my all into this product, if I had followed through with support, focused more on marketing, and funneled my energy in this product there wouldn't be market to steal. 

 

In other words, it was my responsibility to make my tool the staple the internet needed. However, the field was wide open, because I left it open. There is no such thing as disruption from the couch, and that was the valuable lesson I learned from the experience. 

 

Another lesson I learned, is that people seem to think they own ideas on the internet. Or, in this case, that I owned my idea that I put on the internet. 

 

We have seen a lot of arguing back and forth about these issues as the landscape of the web is starting to be sheriff'd. SOPA, The Winklevii, and hundreds of completely absurd patent lawsuits. These issues has made the concept of ownership of 1's and 0's on the forefront of world issues we face every day. 


 

As the world of software development becomes en vogue, we are seeing this issue broached by new developers and veterans alike.  The idea of code "ownership." The idea that the method, or the algorithm makes you money, and therefore is proprietary.



 

Web pioneers like Torvalds, de Raadt, Stallman, and DeIcaza battled on this ground. They created the free software movement, GNU/Linux, Git, Open BSD, and GNOME and told big-co software companies to go screw as they opened up their code for fellow developers to learn from, to better their craft. The sharing of ideas for a better internet. 


 

Yet, still today, people sue over simple equations behind engines making millions of dollars. NDAs and invention agreements are everywhere and claim to cover websites, executables, webapps, modules, functions, and methods alike. 

 

However, in the midst of it all, lies client side JavaScript. I freaking love this shit. I'm here to say there is no such thing as proprietary client side JavaScript. Again, there is no such thing as proprietary client side JavaScript! 

 

You can protest, argue, call people thieves, stake the moral high ground, and point fingers all you want. There is no obfuscation, everything you have done is right out in the open for everyone to see. More importantly, everything you do is in the ecosystem for people to learn from. I think it's a great proof of concept as I've never heard anyone get angry at someone else for stealing something they have written for the DOM.

 

People don't run around copy -> pasting things they find elsewhere. For many reasons, mainly, your style comes through in what you write. Your code is your signature, and someone else's never can express your unique type of art. When it does happen (which it does), it is a matter of ethics, not law or government. Clientside JavaScript is policed by the JavaScript community, and if you're a thief that copies and pastes, people know. 

 


Not all of us write JavaScript clientside. So we all can't go about just assuming people can learn from the things we have created. So I have a few suggestions. 

 

Obviously, there is Github, and any startup that puts their code out there for people to learn from is an open web advocate in my book. That also means we need to stop signing agreements that include clauses about the ownership of syntax (I will from this point on not be signing such contracts). This means educating the people we work for about the developer community, how we help each other, and how being open puts you in a unique position to improve your standing, and help others. 


 

Funny enough, developers are now in a place of power that we haven't known before. Recently, I've seen a new form of currency sweeping the world of business. Developeronomics. From the lone startup founder, to the VC; from the Mom and Pop shop, to the Hedge fund douche bags, from the CEOs of big corp to the teachers of public schools, there is something they all need. Web developers, good ones. Enough to offer obscene salaries, equities, weekly backrubs, briefcases of cash, and sexy parties to the crack team of developers they employ to carve out their section of the internet. 

 

This puts the development community in a unique position. Do we copy the established business community in the money grab? Do we want to line pockets while cranking out "It's this for that's" with every nerd for his/herself on the terms of "my code, my product, my creation?" 

 

We've seen what that has done for the remnants of the industrial age, with huge corporations being the enemy of the individual. Where corporations battle each other in the media, and keep a tight grip on information, even if it means people losing lives. Where advancements are being retarded by a legal cat and mouse game, because the information companies hold dear could help all of us the world over if they would join forces. 

 

What a beautiful place we are at where we can make a conscious decision not to follow in their footsteps. While the internet and it's implications are still being formed every day. When we decide that the education and advancement of future developers, our children, and the history books are more important than lining our pockets (seriously, how expensive can comfy sweatshirts and Vibram Five Finger shoes be?) 

 

Where would we be now if John Resig decided to keep his little library to himself? If DHH kept his framework proprietary? How much further could we be if more people shared the way they did? 

 

I'm pledging to work for an open web and open code, a place where we can all share, learn, and invent together. I hope you will too. 

 



Thursday, December 15, 2011

Adding Profile Fields in Diaspora


I have a friend/client that is using a customized version of Diaspora to host a community and allow them to engage with each other. We have made some changes, in order to better serve our community. I'm not a Ruby developer, myself. Some of this stuff may be obvious to those of us who are. However, for the rest of us, I put together this little guide to demonstrate how to do these things on your own. 

Adding/subtracting fields from profiles. 
We wanted to add the fields: "company," "twitter ID," and "company URL." I found you can do so by following these steps



STEP 1: Add columns to profiles table in MySQL. 
    I'm going to assume that whomever's reading this doesn't know crap about mysql either (well, you have to be able to login, and get to a mysql prompt).        Give your new field an alias. I went with company_name, twitter_url, and company_url. Once you're logged in to mysql, you're going to want to point to the DB (either diaspora_development, or diaspora_production). The command is "use diaspora_development".     


Screen shot 2011-12-15 at 7.45.49 PM


  Then get information about the profiles table, using the command "DESCRIBE profiles"  (this is so you can see what's going on with the table in general, not a necessary step).       


Screen shot 2011-12-15 at 7.46.34 PM


You can then add your columns, by using the command


"ALTER TABLE `profiles` ADD `new_column` VARCHAR( 255 ) NOT NULL;"       


Screen shot 2011-12-15 at 8.26.37 PM


PLEASE NOTE: I am 100% sure there is a way to do this by altering the schema.rb file, however, I wasn't able to make that happen by just editing and re-migrating so this was easier for me. If you could instruct me on how to do that I will replace this section.         


 


STEP 2: Open up apps/models/profile.rb starting on line 17 you will see some XML Attributes being declared with like so "xml_attr :property" add yours to the bottom like so:
Screen shot 2011-12-15 at 8.28.12 PM

Add them yet again on line 42:


Screen shot 2011-12-15 at 11.59.57 PM

STEP 3: 
///NOTE REVIEWER: DON'T KNOW IF THIS IS NECC. OR WHAT IT DOES, THOUGHTS?
On line 82 of the same file, you will see a function called from_omniauth_hash, add your new fields to the columns like so:
Screen shot 2011-12-15 at 8.36.11 PM


STEP 4:
   Now you need to go into the language files and add your fields. Open config/locales/diaspora/en.yml (or, whatever language version you are using) and starting at line 616 you will see the aliases for the different profile fields, add yours like so:      


Screen shot 2011-12-15 at 8.47.36 PM


STEP 5:        Finally, you need to update your view. Go to app/views/profiles/_edit.haml add the new h4 with your fields in it. Now you are done!


Screen shot 2011-12-15 at 8.55.27 PM