Design Patterns: From Monkey to Man – Part I

Recently we here in Bangalore were discussing different ways of doing things to make our software and work environment better. We were all convinced that one way to make our code better was for us all to help each other out to make our own work environment more fun to work. This was just one thing we all were convinced about anyway! Something to celebrate, Hurray!! :-) Of course, there were many different opinions about what it means to make it “better”.

At first sight we thought that it was our work processes that can make a difference in the way we write and perceive our code. Though, this influence can never be ignored, we believe that for a rapid growth company like ours, we programmers and developers also need to improve the way we think about code. We of course should be proud of what we have accomplished so far, but we got to remember as Olle would say, “it’s a marathon we are running for God’s sake!”. We need constant energy and effort to get it across the finish line.

We thought that for us and our code to look better, we got to think better. We got to be code designers and not monkey like application programmer. We need to get constant inspiration and fuel from other code writers and designers out there. We believe that the wheel has been already invented, i.e., someone else in the world would have already solved our problem at hand earlier and probably has a better solution! We just need to google for the right idea and steal it.
Steve jobs once remarked “Good artists copy and great ones steal!”

We steal better designs to be better designers!

So with the initiative from Jayesh we bought this book called “Design patterns: Elements of Resuable Object-Oriented Software” written by a geni called Erich Gamma (and 4 others).  Ganesh started reading it first and gave us a nice 25 minute presentation this Monday morning when our internet line got down. We thought that it was a good start and wanted to continue evangelising our thoughts around code design.

We are thinking of doing a 3 blog series of “From Monkey to Man” depending on the popularity of this article. So please do give us feedbacks and counter arguments to encourage us write more on our reflections on Erich Gamma’s book.

Okay, thats enough of background info. Lets now jump start into what Erich sees in patterns…

Designing object-oriented software is hard, and even harder is designing reusable object oriented software.

How many times have you had the dejavu – that felling that you have solved a problem before but not knowing where or how? If you could remember the details of the previous problem and how you solved it, then you could reuse the experience instead of re-inventing the wheel again? The purpose of Erich Gammas book is to record that experience as “design patterns”

Gamma goes, design patterns capture solutions that have developed and evolved over time. Hence they are not the designs people tend to generate initially. They reflect untold re-design and re-coding as developers have struggled for greater re-use and flexibility in their software. Design patterns capture these solutions in a succinct and easily applied form.

Good object oriented designers will tell you that a re-usable and flexible design is difficult if not impossible to get it “right” the first time. Before a design is finished, they usually try it themselves, reuse it several times, modify it each time and then finally, you have a design that is “good enough” One thing great designers know NOT to do is to solve every problem from the scratch or from the first principle. Rather they want to re-use solutions that have worked for them and others in the past. When they find a solution to be “good enough” they use it again and again. Such experience & thinking is what makes them part of the greats.

Design patterns are NOT about designs such as a dictionary or a tuple or linked lists or queues that can be encoded in classes and reused as it is. Nor, are they complex, domain-specific designs for an entire application. They are descriptions of communicating objects and classes that are customized to solve a general or generic design problem in a particular context.

For instance, take the example of database connectivity, people have solved this in many ways and we do have our own standard. But do we really follow through the standards in all the places? Nope…the basics are that we need to connect to the DB once and only once per request and that it should be void of injection vulnerabilities. Why don’t we use singleton design pattern for this problem and the pattern will itself make sure to create only one connection even though your code attempts again and again?

The design patterns require neither unusual language features nor amazing programming skills or tricks. It can be implemented in Python although it might take a little more work than an ad hoc solution. But the extra effort invariably pays dividends in increased flexibility and re-usability. So, the question if is should we write the operation and function files in a procedural way? Nä, this is monkey work!

If we start designing our code with the back-drop of patterns in mind then we create more robust, re-usable and testable code.

Below are the arguments from Erich to use design patterns:

  1. Patterns make it easier to reuse successful designs and architectures.
  2. Expressing proven techniques as design patterns makes the codebase more accessible to new developers.
  3. Reduces the need for documentation
  4. Easier to maintain the system
  5. Put simply, design patters help a designer get a design “right ”faster and thus helps him/her reach the customer faster

I will stop here for now. In my next blog, I will talk about the details involved in design patterns…Erich has a solution for the three tier architecture (Model/View/Controller)!

Stealing is NOT bad afterall, it is clever! ;-)

,

12 Comments

ThoughtWorks conference on Scaling Agile

As some of you might know, four of us here in Bangalore went to a conference/seminar at ThoughtWorks on ”Scaling Agile”. For those of you who do not know much about ThoughtWorks, they are a successful company with over 1000 employees in six countries. They are the fore-runners when it comes to Agile project management. ThoughtWorks also sells an Agile project management software called Mingle.

 

During the conference, it was very exciting to see how similar our work framework was to theirs. Does this mean that we are on the right track? Oh yes; not only by following one of the Agile principles of “reach the customer faster” but also by following some of our core values very effectively.

 

Right, below is what ThoughtWorks had to say about how someone whom they call an Iteration Manager should try to establish in his/her team (this role is bundled in the role that Lena and Jojo are doing at present…)

 

Iteration Manager should work toward a professional and accountable work environment. Such environments exhibit proper behaviors and mannerisms, such as the following:

  • Mutual respect is displayed for self, others and customers
  • Successes are celebrated
  • Mistakes are treated as learning experiences

 

Strikingly relevant to what we already have, isn’t it? I will post you this book today.

 

Okay, going back to the conference, below are the key points we learned from there

 

  • Programming is an art and software development is a social activity – Improve the conversation and you improve the software
  • Embrace change – Dare to make a difference
  • Rapid feedback – Develop to make your MUST HAVE work faster. Get rapid feedback from the customer. In our case, UxD and Test
  • Continuous Integration – Check-in your code often. Create a test harness like Unit test and functional test simultaneously
  • Face to face communication is a must – ThoughtWorks does it using video conference, chats, etc
  • Make yourself easily accessible
  • Make dev. Environments close to Production.

 

 

Apart from these, ThoughtWorks stresses on the importance of graphing out our project activities so that the Project Team and the stakeholders can find out the bottlenecks in the project now and then. I do not think that we do it today but they talked about the importance of maintaining charts which can be discussed on a weekly basis. This chart becomes more interesting especially during the retrospectives, if not immediately.

 

It was interesting to see how they keep track of the number of check-ins a day through a graph. At ThoughtWorks they say that they have a general rule that whenever a developer checks in a code, s/he is responsible for the aftermaths. If a bug is found in the recently checked-in code, it’s the developer’s responsibility to see to it that the bug is fixed or the code is rolled back within 5 hours.

 

When it comes to practicality, I would like to jot some things on the Continuous Integration part. I think that we have completely missed out on this part when we moved to the new Harvest model. ThoughtWorks has MOSCOW requirements in the product backlog. When the project is under implementation, the development team discusses the design aspects and implements the most important MUST have ASAP. They check-in their code (they said 20 times a day) to the main branch, and write unit test and functional test simultaneously and make sure the automation test passes really at the beginning. The test and the design team then picks up the task and works with them. Thus overcoming the “continuous waterfall” pitfall in the development cycle. The dev, design and test team work simultaneously on the tasks. Fantastic!!

 

We tried something similar to what they suggest here May sprint and it seems to have worked well for us. But again, we all in our roles need to make ourselves more accessible, else we will end up in the continuous waterfall.

 

Below are what ThoughtWorks thinks are challenges and options to overcome when it comes to scaling Scrum

 

Challenges

Options

Limited face to face

Formal and scheduled communication channels like meetings chats, video conference

Consistent view of big picture

Scrum of Scrums

Lack in clarity of responsibility/ownership

Information radiation

  • Program updates
  • Collaboration tools like Mingle

Decision making

Improve escalation points

Knowledge sharing

Communities and forums

 

Below are the key take-aways from the presentation ThoughtWorks did during the conference.

 

  • Program plan and governance – By governance they mean communication
  • Continuous Integration
  • Trigger points for structural changes – We need to get red hot at things that work less good and burn to improve it ASAP
  • It takes more time to change
  • Focus on Objectives, Principles and ADAPT!

 

 

Oosch! You know what? I think that the next time you guys come down here, we should make a visit to ThoughtWorks. They really have an open, flat, motivated and a smart work environment!

 

 

 

 

 

, ,

3 Comments

The Devil doesn’t need an Advocate!

Back in the days when I was owner of the vision, head of development and product manager of a dotcom startup I had this really great boss. He was creative, supportive, caring, trusting, fun, really intelligent, self confident and, well, he had most all of those treats you wish all your bosses should have. Yet, he used to do one thing that puzzled and even annoyed me at times. It was when we were preparing for a meeting.

I have this way of always trying to be on the offense and to own the initiative. Not always succeeding, of course, but I imagine that thinking positive will help. I guess I’m a incurably naïve.

My boss of back then also was one to want to own the initiative. But he, generally, had a different approach. He played it defensively. Covering all bases. To do that you need to be able to think negatively. There’s the source for my annoyance. I just have a hard time following the line of thought when it goes the negative way. When preparing meetings I had to endure my boss when he raised the arguments against our case. What if they say this? What if they argue that? To me it’s “So, what if? Our offer is excellent! Let’s focus on exposing that!” I don’t want to cover all bases. I don’t want to imagine all the shit that can happen.

Yes, I’m biased. But I honestly think that my general approach is better. Go full force with your thing! If you feel it’s not good enough to throw your full support behind it, then chose another thing. Make sure you work with something you really believe in. And hone your blade. But hone it for attack. For defence trust your reflexes. Apply positive thinking. Playing the Devil’s advocate just drains your energy resources. At least it has that effect on me.

Addendum June 11 2009: I wrote this article when I was a bit upset. I’m glad that I did, but still, I think I should have asked Joakim Ohlrogge to write instead. Here’s his take (pasted from the comments):

A thought: I despise DAs more than I like them. But the question is if it is really DAs I despise or if I despise idea-poachers. It’s hard enough the get ideas to fly even without having a sniper shooting them down before they take off. It’s often all too easy to come with a “what if” and I’ve experienced some people who make it their task to figure out every obscure situation that could possibly go wrong. There needs to be some rime and reason. You can always find something that goes wrong, after all, we work with software.

I would not want to be without DAs but I don’t want them to take up more time than daring enthusiasts do. Also, they are not there to prevent disasters, they are there to inspire different though paths. A DA can never replace the ability to respond promptly when “shit happens”.

6 Comments

The Bangalore Report – Day 3

Wednesday
The plan today was to have a bit of a slow day, focusing on unit-tests, some Javascript sessions and such.. But (as usual it seems) things did not turn out as planned.

We started the day with the morning stand-up meeting. We quickly handled the issues at hand between all of use(well except me since I’m the boss) and got started fixing the stuff found by UxD late yesterday afternoon swedish time.
We had our goal set to finish all the reported issues before the Stockholm stand-up meeting, but some of the issues took time, so we did not reach our goal.
During the meeting with Stockholm the scrum master was screaming more then ever, maybe she wanted to make point. I don’t think so, she has a good sense of humor, so no worries.

Well after that I started to go through a lot of bugs that are prioritized for the next spring by Mr Irish. Me, Mr UxD and the loud Scrum Master will have a chat regarding my conclusions tomorrow. Hopefully Bangalore Earth Hour will not happen during our meeting.
As I tweeted previously today, Jayesh is spot on with his skepticism regarding Earth Hour that toke place on the 28th of March. In Bangalore Earth Hour happens several times a day automatically… Luckily Blue Star has filled the basement with batteries that kick in, so Internet never goes down. I wonder what happens with the elevator, since the light go down? Shit, I need to remember to take the stairs tomorrow!

Durring the day our beloved boss sent approximately 15 mail regarding a failing in-development feature and kick-started Rams sweeting. We will handle the issue next week when Ram can have a partner in Mr New York(samcyp).

Me and Ram went for a late lunch around 2 PM, since he just needed five minutes more for about two hours, at the same restaurant as yesterdays dinner and lunch. But what the heck, it dame good food.

During lunch me and Ram also went to Total, a big shopping mall near by the office. I found some nice clothes for the kids. On the way to Total Ram asked me what I thought was the best and worst thing in India. The worst thing is easy I said, the contrast between those who have(and they seem to have a lot) and those who has none is really striking. The best thing would probably be meeting Ram and the rest of the crew, and of cause the food.

After lunch I got a mail from Mr UxD asking if I had started investigating the feature I had promised to do until monday. He thought that it was a good thing for me to start with tonight, since it would prevent me from falling asleep until CL final tonight. I know it was a joke so no harm taken:) But this brings a thought to mind, if possibly anyone who reads this blog is living at Nandhan Grand in Bangalore and could tell me what channel the game is on. All I can find are programs with 15.000 people dancing and singing.. It’s really strange, but true! It’s like all channels are directly liked to Bollywood!

After work me and Ram walked over to the Forum, and got some more stuff for the kids back home. On the way to the Forum I say the most stressful job in the world, a traffic cop in Bangalore. He was sitting in some cage and was occasionally screaming at some Auto-richa who was on the verge of going the wrong way one a one way street at rush hour. He once tried to hand out a fine but the Auto-richa driver got away.

At 9PM I had dinner at the Hotel, shiploads(as the spellcheck want’s it to be) of rice, chicken and naan. During dinner I watched the Zoom channel in hindi. Since I say a picture of Paris Hilton every five seconds, I knew I wasn’t missing much.

Tomorrow is the last day for me here in Bangalore, it’s true that time flies when you are having fun. Since this is my fourth trip to Bangalore one might imagine that I would get used to the traffic, the noise and the massive amount of people, but I think I never will.
But the week before I went down here, I finally figured out what is so special about Bangalore at night, it’s the darkness. Bangalore is a city of 5 million people (according to wikipedia) but is still really really dark. It’s just the main streets that have light, the rest is dark.

And now it’s 11:55PM 00:10 AM, and the game is soon to start. But Star Sports, which will be airing the game tonight, I think, is still showing tennis!

3 Comments

The Bangalore Report – Day 2

Tuesday

Today nothing really exciting happened, I woke up and went to the office. Unfortunately I had forgotten the AC on all night, so I was freezing cold when I woke up. Luckily freezing can easily be fixed here in India, step outside for two minutes and your fine.

At the office we started the day with the daily stand-up meeting, after that we started fixing the issues found by UxD(two still to be nailed tomorrow). Me, Ganesh and Kashif fixed some easy bugs after the stand-up meeting.

At 12:30 it was time for the Stockholm “morning” stand-up meetings. It’s kind of fun to take part in meetings with Stockholm from down here. I will not name any names, but the Scrum Master in Stockholm really screams during the meetings whenever she talks to us. Luckily everyone knows she is not upset but is compensating for the distance.

I participated in the sprint follow up of the April sprint with Stockholm, unfortunately Internet was behaving badly. Rumors has it that some router was killed apparently(possibly nevdull77 testing something?!)
While I was in the meeting, Ram was kind enough to pick up some food for me. All I can say is that it’s lucky that I do not live here in India, it was a massive amount of food(and hot as usual). I would look like a big red balloon after a couple of months!(Music tip: Black balloon by Monster Magnet )

In the afternoon we did some ruff estimations of coming projects in the June sprint, as well as we had a little meeting regarding testing of our own code and quality contra quantity, it was good. Quality still rules!

During the whole day I have been trying to get some time to prepare the Javascript Event Chain/Namespaces session we have planned for tomorrow, but have not really succeeded. But what the heck, how hard can it be. I’ll shoot from the hip on this one.

For the evening we had planned to leave the office at 7pm, to celebrate the Bangalore Star-of-the-Sprint. But due to reasons out of our hands, bug fixing, mailing an such, we left at around 8pm. We went to a nice restaurant close by the office where JoJo handed out the “voting cards” with a company logo and all. The focus for the Star-of-the-Sprint is to find the person who have been living the core values best for the past three-four weeks. The victory went to Adarsh, with Appa as a close runner up and Durgesh taking the bronze medal! Congratulations all of you! The prize Adarsh won was a lovely little silver star, it looks great!
Unfortunately JoJo forgot to say that is was not allowed to vote for yourself, but luckily Ram only got one vote.

The food was great and somehow the conversation always seemed to end up around the things Jon ate when he was down here in Bangalore. Jon, I tell you, the Bangers are really impressed. I’ve heard stories about how chilies being eaten and more, and they say “that you boldly went where no mans gone before in the wilderness of food”! They also say that Jalle is more like me, a bit more sensitive. I think what they mean is, a bit more sweaty.

Today I learnt that there is a real Ramesh around, and not only our own. Ramesh apparently works for Blue Star in Bangalore. Unfortunately he’s in the hospital right now because a big tree outside the office fell on him during some heavy rains some time back. How much bad luck can a guy have, we hope that his broken legs heal soon.

After the dinner Ram and Durgesh took me home in Rams new car. A great thing that has happened since my last visit is that Ram now has removed the plastic covers from the seats! I like Ram car, its great. Or it’s probably like this, I like to ride in Rams new car much more then behind him on his scooter. I don’t have a death wish you know :-)

3 Comments

The Bangalore Report – Day 1

It was really close that I did not continue with the Bangalore reporting thing, but why stop a loved tradition :-), so here we go

Sunday

The trip started out really bad, I stood in the wrong check in line for 30minutes at Arlanda, and I hate that. Me, I’m a guy how likes to have control, if I stand in the wrong line that’s an evidence of me not having control.. Puts me in a bad mood one could say. And for christ sake, it’s 04:30 in the morning.

Question: Is Sweden on leave or something? At 4:30 Arlanda looked like Bangalore, people all over, I promise. It was insane.

I eventually ended up in Frankfurt, and Frankfurt is Frankfurt.. ..Dark and grey, no fun at all.
But I did the good thing of the day in Frankfurt; I helped a small young guy, possibly 13years old, find his way to the Bangalore flight. He was a Swedish consultant working for Cap Gemini going down to Bangalore to attend some 2 week course. Apparently Cap Gemini has 20k developers working in India. But back to the good thing, he tagged along with me through Frankfurt Airport, this of cause due to that I’m such an experienced traveler and a real business man. I even waited for him when he went to the toilet. Even on the flight to Frankfurt I had noticed that this guy kept running back and forth to the toilet, and he later explained to me that he was afraid of flying, and of cause that was the cause of all the visit to the toilet. I told him, “you will have no problems on the flight to Bangalore, it’s a big 747 and the flight will be smooth”. Boy, where I wrong, we had a really bumpy road down to Bangalore, I hope the kid survived!

The flight to Bangalore went well beside the bumps, I had this really interesting Mr and Mrs Something who had been living in the US for 6 months and where now moving back to Bangalore, they were really nice talking to. The Mr in the family was working for a big Indian consultancy firm, and was a bit feed up with not being able to change anything. “We are not very agile” he said, I tipped him to contact Blue Star and see what they could offer..

Entering customs in Bangalore was a new experience, thank you Swine Flu!
Previously it has taken a long time to go through customs, but now thanks to the flu it takes ages, first one need to fill in a form regarding your physical health. I lied a lot as you might understand, since I really need to start running or something. After that you need to state where you have been the last 6 months, easy for me, I could even state the street addresses, Klarabergsgatan 60 and Allfarvägen 21 Täby. The people in customs did not understand my joke so I had to change it to Sweden.
The only problem here was really the massive amount of people that needed to pas the 3 doctors asking the same questions as one previously has answered in the form..

After that I was planning to fast as a shark pick up my bag and get out to Prasad from Blue Star who was waiting for me outside. One could guess that the bags would be waiting since passing the doctors took about an hour. But no, I waited 53 minutes for my bag, and when I finally got it I got grabbed in Customs by Mr Sunshine himself. He wanted me to open my bag, since someone had marked the bag with a big X on the side. So I open the bag, and showed the lap top I had brought from Sweden to JoJo . Well about here the discussion starts, Mr sunshine informs me that is only allowed to bring one computer into India and he thinks the laptop is worth 40.000 rupees, which is probably 35.000 rupees to much, I said “no way, I’ll leave the computer here with you and you can do whatever you want with it”. So then he said, “but I can give you a discount” , I said, “are you real(that is a translation of “är du riktig” in Swedish) can the customs give me a discount, that sounds insane! “. Mr sunshine did not react positive to my comment, and I should have kept my mouth shut! But to end this part of the story, we “agreed” on 33.000 rupees as the computers value, and I paid 9013 rupees as some kind of tax.. it’s hard to believe but I can show you the receipt.

The day ended on a really good note though, when Prasad had taken me to the hotel, the hotel had decided to upgrade me into a suite instead of my ordinary room. Suite == Sweet.

Monday

I had talked to Ram during the nightly adventures in customs, and we had agreed a pone meeting at the office around 09. And so we did, it was really great meeting the nice people in D&M Bangalore! For me the day mostly consisted of meeting, and meetings held in Stockholm, so I did not really have the time to take part in any cool stuff that the Bangalore team is working on. Me and Ram had a nice, but short, lunch with some Blue Star people.

In the afternoon we all got the chance to celebrate Ganesh’s birthday. They do have some strange traditions here in the far east, the guy’s getting older get’s cake all over his face, and he seems to like it.. Must be some Hindu tradition, “go to the local baker, get a ‘cream cake’ and put it in the face of your friend”. Strange, but fun!

I spent the evening at the hotel restaurant, sweating and speed eating due to the fact that two people were constantly filling my plate with Chicken tikka masala. Or possibly it could be due to the Kingfisher beers.

Ps, forgot one thing, my shoe touched some cow shit today, does this make me holy or just my shoe? Ds.

1 Comment

Twitter earns something bigger than money

Many have understood how they can earn money by using Twitter, but no-one knows how Twitter earns money.

There are many speculations concerning Twitter’s future.

This is my wish.

According to many, I live in an imaginary world. I believe that everything is created, and by a creator. If you believe in a creator/God then we could imagine that the earth and all its resources are “gifts” to mankind.

We’ve managed to take these “gifts” and make money out of it. New stuff is innovated out of them. We created Twitter.

I would like to believe that Twitter is a gift to mankind, from mankind. A new “gift” to connect people together, innovate new solutions using this great platform and make money. Thank you Twitter (God #2?)!

As I said, wishful thinking! I’ll love Twitter even if they figure out a way to earn money. :)

, ,

1 Comment

Flat line for the Twitter Brain

To me one of the major Twitter experiences is the feeling of being connected to millions of other brains on the planet. It’s like Isaac Asimov’s fictional fantasy of Gaia is starting to come true. I probably shouldn’t admit this, but whenever I encounter a new term one of my first thoughts is “wonder what’s tweeted on that subject right now?”. And now and then during the day I need to get my Twitter Trends fix. Sometimes it reveals totally new things to me. It’s how I first heard of Susan Boyle, for instance. I’ve now realized that I got to hear about Susan Boyle only hours after she had rocked Britain the first time. That’s amazing! Usually weeks and months pass before I catch up on such events. (I’m not a fan of the genre, but I don’t want to miss something like the Susan Boyle phenomenon.) It’s totally awesome to get this opportunity to plug in to the Brain. Thank you Twitter!

Of course, sometimes the Twitter Brain is a bit stupid. Often it’s very shallow. And, yes, not seldom it’s really introvert. (Discussions about Twitter itself seems to be what interests the Twitter community the most.) I’m OK with that. I’m not one to throw out the baby with the bath water. The signal vs noise ratio is still really high.

But what happens if the Twitter Brain dies? Do I risk going brain dead if I’m plugged in to a huge Brain when it dies? Yes, obviously I do.

Yesterday the Twitter folks changed a setting used by 2% of their user base. And somehow enough people shut of their brains and started to tweet stuff like “Twitter Failed! Retweet!”, “Twitter is bad. Please Retweet!” “Goodbye Twitter. RT this!” and so on and so forth. Fully and utterly useless crap. Then the brains of the receivers of those tweets went dead and they retweeted. And their followers retweeted. And their followers … You get the picture. It was like a disease. My time line was full of tweets like that. I think four out of ten slots on Twitter trends were related to this too. Check the hashtag #fixreplies out and you start to get the idea. I felt I had to throw something in to the balance and cheered the change. That never showed up on Twitter Trends though.

Please, please you tweeting people. (And all you non-tweeting people too). Keep your brains switched on! I’m plugged in to your brain and I don’t want to go brain dead. Maybe if keeping ones brain switched on at all times is hard, we can train ourselves to sense when it’s off? And then there’s No Tweeting!. Of course the “When retweeting, use common sense” rule apply too.

Yesterdays flat line of the Twitter Brain was scary. I hope it was an exception.

Addendum: I’m also amazed at the official Twitter response to the brainless outcries. They call it “lots of great info”. Totally funny.

,

2 Comments

So you wanna be a front end developer?

Back in the day when I was a young boy in the big IT-industry I wanted to become the greatest front end developer the web had seen. Due to circumstances, out of my hands of course, I did not reach my goal, but I did get to “know” some great ones along the way!

So I guess you possibly have some schooling to bring to the table, or you have been working with back-end stuff stuff for quite some time, you know what object oriented programming is or at least want to learn, and most importantly you have the will to learn!

When I started to become really interested in front end development back in the late 90′s, front end development was not looked upon as real programming, real programming was C++, Java and the likes. But now, we have job titles like Senior Front End Developer at for instance Yahoo and Google, so I guess that the understanding of the importance of good front end code has really elevated.

So my way of learning the craftsmanship, was to study the masters below, downloaded their code, read it, and then write my own! If it worked for me, I’m sure it will for you!

Scott Andrew LePera
What really got me started was a guy named Scott Andrew LePera(http://www.scottandrew.com/). He got me all warm and fuzzy talking about for instance event handlers in javascript and how event bubbles

Aaron Boodman
After that I stumbled over Aaron Boodman, the youngpup (and creator of Greasemonky among things) showed me all about how to create the menus that we love to have, how to make the Javascripts run smooth in animations, and how drag of elements shall be done. Back in the beginning of the 2000 he had the coolest UI on his blog, and nothing I have seen since has turned me on as much as viewing youngpup.net for the first time(except possibly 13thparallel)!

13thparallel
13thparallel made me think about coding for portability, introduced me to the concept of the Viewport among other things.

WebFX
Emil A Eklund and Erik Arvidsson at WebFX showed me that it was possible to create a forum on the web with outstanding functionality and speed(unfortunately it only looks good in MS IE), how to work with XML in advanced Javascript.

Peter-Paul Koch @Quirksmode
Quirksmode helped me really understand the differences between browsers and what do do about it. He also really introduced me to Unobtrusive JavaScript.

Remember that most of the examples above have been written back in 2001-2002, and they still work..What does this tell us, well to use the standards, and no browser specific hack, because browsers change and you will end up chasing your own tail to make things work in new browsers.

No Comments

Rails deploy using sqlite3

I had a hard time figuring out why, when reading up on capistrano, I couldn’t find any info on how to deal with the database file. That was until I realized most people don’t deploy on sqlite3. With mysql and other databases you have a server and it’s automatically “shared” then.

The only information I found on deployment on sqlite3 was an excellent deploy script in this blog article. Basically, using sqlite3 you have to make sure the database is in a shared directory across releases. But the sqlite3 parts of that deploy script didn’t work for me as they were. I had to make sure I referenced the shared database path all the way or I risked overwriting my database with a symlink. Below are the sqlite3 parts of the resulting capistrano script.

Setting up the shared database path. NB: Lazy binding. Important if you’re using multistaging from capistrano-ext.

set(:shared_database_path) {"#{shared_path}/databases"}

Sqlite3 tasks.

namespace :sqlite3 do
  desc "Generate a database configuration file"
  task :build_configuration, :roles => :db do
    db_options = {
      "adapter"  => "sqlite3",
      "database" => "#{shared_database_path}/production.sqlite3"
    }
    config_options = {"production" => db_options}.to_yaml
    put config_options, "#{shared_config_path}/sqlite_config.yml"
  end
 
  desc "Links the configuration file"
  task :link_configuration_file, :roles => :db do
    run "ln -nsf #{shared_config_path}/sqlite_config.yml #{release_path}/config/database.yml"
  end
 
  desc "Make a shared database folder"
  task :make_shared_folder, :roles => :db do
    run "mkdir -p #{shared_database_path}"
  end
end

Hooks (or whatever they’re called, I’m new to all this).

after "deploy:setup", "sqlite3:make_shared_folder"
after "deploy:setup", "sqlite3:build_configuration"
 
before "deploy:migrate", "sqlite3:link_configuration_file"

Hope this helps someone. Please don’t hesitate to ask should something need more explaining. And of course suggest improvements. This is all the makings of a capistrano newbie.

, , ,

3 Comments