Sunday, October 10, 2010

Stages of adopting open source mind-set


These are stages I observed for years from both people and organizations. I might miss something here, but before you think "this is not me/us" think again. I'll use person's perspective, because it always comes to a person. Be it your friend or some big corporate CTO or architect.

  1. Ignorance: open source doesn't exist. If anyone mentions it, you tell yourself "there are dragons there", "it is not secure", "licensing is viral", "I know this guy that once used open source and got sued" etc. Also you think, you can do better on your own.

  2. Waking up: you are doing this great PNG display library for months now and you have only 20 more known bugs to fix before you can start working on your great SSL implementation then some friend comes by and asks "have you tried libPNG and OpenSSL?". You try them and they seams to work. You start reading licenses.

  3. It's a wonderful world v1.0: The sun shines again. Now you know much about open source licenses. You are using as much open source as you can. In fact it's something like a big well and you can take as much as you like right? You start to understand some of the ideas behind. You also have a strong opinion about how those projects should be managed and what needs to be done next there.

  4. Open your heart: It's a big well but wouldn't it be great if you add something to it? You are looking at your own projects and start thinking - "should I open them?". You decide to try with caution. You open couple of your most unimportant projects. You select them because no one have time for them in hope that "it's a big community, there should be someone willing to add improvements". Now you consider yourself a full grown open source citizen and so is your company.

  5. No love for me: No one wants to work on your open projects. In fact no one cares. You are wondering what's wrong with the community. Looking at other open projects and comparing them to your own, you can see some differences. Maintaining an open source is not an easy task. Getting support from community comes with a price. And if you don't like and care for your projects, others won't too.

  6. It's a wonderful world v2.0: You start opening only your significant projects. Selecting those you are sure many people will find useful. It is important for those projects to have some unique features and/or be clearly better than similar open source projects. They need to be well documented, with clear license and build instructions. Some samples are useful too. Once you have that you will get community support. You understand that open source doesn't necessarily mean nobody gets paid to work on it. It just means it is open for others to look at the code and use it, and they might contribute. Now you can decide should you be the main contributor or just step out and leave it to the world to handle from now on.
     

Thursday, June 24, 2010

A smart phone dream of mine

I'm in a smart phone world for 2 years now, changing several phones and platforms, but this dream of mine is older. It's not a smart phone dream, it's a personal computing dream. I dream of having my PC with me wherever I go and a smart phone is a way to achieve it. In my dream there are peripheral stations (PS) consisting of bigger display (monitor, beamer ...), input devices (keyboard, mouse, joystick ...) and some power supply. You come to your home, plug your smart phone to your home peripheral station and work with your PC. You go to work plug your smart phone to your workplace's peripheral station, switch to work profile and work with your work PC. The device is one and the same you could switch profiles and even operating systems if this is needed. In my dream there are also public peripheral stations, where you could plug your smart phone/PC to work more comfortably, while recharging it at the same time. Those stations cannot harm your PC in any way as they don't have any storage to store viruses or any personal data. All storage is with you. Network connection can be provided by your mobile operator or by the station, it is your choice. At some point, when wireless connections become fast enough and power supply is taken from the sun or from your body heat and movement (for example), you could connect to the peripheral station without a wire. And of course you could always use the smart phone screen and keyboard to work with, in case there is no (free) peripheral station around.

The good news is this is coming closer to reality. Here http://sven.killig.de/android/N1/2.2/usb_host/ you can find a sample of taking the first steps in this direction.

Wednesday, May 19, 2010

A development learning story...

So here I am - trying to learn programming, surrounded by several of my university colleagues who know more about it than I do. I want to be better and I am getting better. Bit by bit. I start creating simple programs from scratch. No internet yet, no google. I’m searching inside several help systems I can get my hands on and I improve myself day after day. Time passes; I start to skip some of my university classes. Instead, I’m staying at home creating from scratch more and more complex programs. My colleagues are helping me. Sometimes with information, sometimes showing off, making me want to be that good and sometimes with words like “I’ve listened to you for the past 30 minutes and didn’t laugh because I know you don’t know things … but you are not right”. And this makes me want to be better again and again. I’m starting to isolate parts of my code making “libraries” of reusable code. Then get better at making libraries. I know how to make it extendable, how to document it and how to reuse it. Now I’m better than most of my colleagues and equal to the rest of them. They accept me, but I accept no one. No one’s code is good enough to be used. I’m creating everything I need and I’m good at it. I believe I can create something like Windows 3.11 for about 3-6 months all by myself and I believe myself. Slowly I’m starting to realize that things are deeper than they look and I have to start trusting other people’s code in order to create complex programs. I’m also starting to understand that more complex doesn’t make it better and now I’m creating simpler code. Make methods and functions smaller, make code blocks as clear as possible and always strive to keep it simple (but not stupid!). Somewhere in between I’ve started switching programming languages. Going from Pascal to Assembly, mixing it back with Pascal, then C, then C++, a little bit of Delphi, then Java, some Perl and the list goes on. With time I’ve switched programming APIs and concepts too: DOS, Windows, Embed development, POSIX. All of them came with their own charms and specifics. At this time better programming books got published, explaining concepts like design patterns. Too late, I’ve already discovered all these patterns by myself. It was funny someone spent time to collect those obvious ideas and give them odd names. I still believe design patterns book made more harm then it helped. People need to discover those things by themselves or they won’t truly understand them and know where to use them and more important when NOT to use them and why. Then I’m discovering next “library” level – modularity. It is dynamic, it can be switched on and off on the fly, it can be replaced with fixed/newer version without recompiling the rest of the code. After some concept polishing and learning how others do it, I’m starting my own product based on my own modular concept. It is small, it is clean, it is clear. It is a great piece of technology and none of my clients cares about this. Slowly I start realizing, that though modularity is great, it took at least 50% of my development time to plan it, make it that great and support it in the future development. This time doesn’t pay back – really! I also start understanding that I seldom use any piece of my code twice. I’m learning as I go and I almost always know a better way to do it after several months. The way sometimes involves using a new library and sometimes it’s just me knowing more. In either case I get my old code and rip a good part of it creating something new, instead of reusing it.

So here I am - creating more and more complex software, using the best I can find pieces of other people’s code and creating the rest on my own. Always try to keep it simple (and not stupid). Keep it small and clear. Don’t make a block of code do more than one thing and don’t make it bigger than one screen can display. Use comments sparingly and describe your context, reasons and ideas there. Don’t make reusable code unless you’re creating a library on purpose. And programming languages - they are just a way to express yourself. Programming concepts like functional and object oriented programming too. They don’t really matter. What matters is to understand the core idea behind them in order to use them effectively. Once you understand it, you understand that it is possible to create a complex solution with plain C as easy as you create it using Java, C#, C++ or whatever.

Wednesday, March 31, 2010

GWT GroupBox implementation

I was looking for a group box implementation for GWT recently and the only solution I've found was implemented by Svetlin Nakov. However it didn't work out of the box and I had to modify it, to make it compatible with GWT 2.0 (I guess it worked fine with older versions). I've used the same idea, plus most of his code and extended it to work with GWT 2.0. Here is my implementation:
package com.demosten.client;

import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.InsertPanel;
import com.google.gwt.user.client.ui.Widget;

public class GroupBoxPanel extends ComplexPanel implements InsertPanel
{
 private Element legend;

 public GroupBoxPanel()
 {
  Element fieldset = DOM.createFieldSet();
  this.legend = DOM.createLegend();
  DOM.appendChild(fieldset, legend);
  setElement(fieldset);
 }

 @Override
 public void add(Widget w)
 {
  add(w, getElement());
 }

 public void insert(Widget w, int beforeIndex)
 {
  insert(w, getElement(), beforeIndex, true);
 }

 public String getText()
 {
  return DOM.getInnerText(this.legend);
 }

 public void setText(String text)
 {
  DOM.setInnerText(this.legend, text);
 }
}

it can be used in UiBinder Templates:
<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
 xmlns:g='urn:import:com.google.gwt.user.client.ui'
 xmlns:d='urn:import:com.demosten.client'>
 
 <g:VerticalPanel>
  <d:GroupBoxPanel text="Account data">
   <g:HorizontalPanel>
    <g:Label>e-mail:</g:Label>
    <g:TextBox />
   </g:HorizontalPanel>
   <g:HorizontalPanel>
    <g:Label>password:</g:Label>
    <g:PasswordTextBox />
   </g:HorizontalPanel>
  </d:GroupBoxPanel>
  <g:HorizontalPanel>
   <g:Button text='Sign in' />
   <g:Button text='Register' />
  </g:HorizontalPanel>
 </g:VerticalPanel>
</ui:UiBinder>

Use it as you like :)

Wednesday, February 17, 2010

HTC Sync wonders

Recently I've installed HTC Sync v2.0.18 (PC sync software for Android based phones) and got quite surprised to find out how it works. It runs a process called something like FsynSrvStarter.exe. However here is how it works. It starts the executable mentioned above every few seconds (like every 3-5 seconds). The executable checks something - probably for Android connected device and quits. The version info of HTC Sync manager files, show "Teleca AB" as a company. It's strange HTC, whose products I use and love, is providing such poorly designed software to its users. This is a classical example of how the things should NOT be done. So here is what I have to say to those Teleca AB guys: "Do you have any idea how expensive is for the OS is to run a new process? Did you heard about the wonderful world of inter-process communications (known also as IPC)? How about using some named mutexes and/or events for a change? Please have some time to do things right and don't get you poor users pay for your lack of knowledge!"

Update: I've checked it on my work computer. The time between FsynSrvStarter.exe starts there is more like 30 seconds. Still not the right way to do it!

Sunday, February 14, 2010

How to transfer contact between different flavors of smart-phones

I was having this problem lately when I needed to transfer my contacts between Windows Mobile and XANDROID for HTC Touch Diamond. After a quick search I've found a solution and it appears that this could help others too. It's called Google Sync and can be used not only for synchronizing, but for transferring contacts and other data between smart-phones too. The good thing is that it support many smart-phone OSes. At the time of writing these are: BlackBerry, iPhone, Nokia S60, SyncML, Windows Mobile. The bad thing is, google now have my name, my contacts, my blog. Now I can only hope that "do no evil" policy is intact and will stay that way!

Friday, January 29, 2010

iPad as an e-book reader? Why?


Just after Apple presented their iPad device, there had been a lot of posts about how this device will revolutionize the e-book reading. Apple are great in making their product simple to use and great looking. They are also great in making fashion out of it. But how many of you will replace an e-book reader for an iPad? I definitely won't. So I just decided to drop here a simple reminder about the advantages of modern e-book readers. If you never used one before, it's tempting to grab this beautiful colorful multitouch display as your first e-book reading device. Well, there are things you need to know before you do so:
  • Displays: e-ink and e-paper displays are much more gentle to your eyes. They don't have back light. Their look and feel is very close to normal paper. It would be like comparing reading from a laptop or other similar display to reading from paper. Reading from e-ink or e-paper display requires additional light just as reading from a normal book does. And believe me this is good for your eyes! Also since none of them is touch capable, you won't read through the tracks of your fingers.
  • Battery life of e-ink and e-paper based displays is much better. Depending on usage, I recharge my lBook e-reader from once a month to once per 3 months. I know that for other e-book readers this time is more like once per week (my device don't have WiFi and/or 3G), but it is still far better than 10 hours which iPad promises.
If you're planning to use iPad primary as an e-book reader, think carefully before you do so. Otherwise I like the iPad idea. It might be useful.