Coding Standards

I have been programming from last 8+ years. I worked on different platforms and languages. Every language has its own power and beauty. But there are some global standards (or principles) which if followed could increase the ease of maintenance and scalability of code. Also, these standards greatly help in environments where multiple people are working on same project.

Another plus point for such code is that if a developer leaves, then a new developer could very easily follow and start from where he left due to good readability and clear code. In this regard a very good read is Code Complete by Steve McConnell. I follow a few rules taken from Code Complete, other sources and my experience:

Naming Conventions:

Variable names should be in all lower-case, with words separated by an underscore, example:

Names should be descriptive, but concise. We don’t want huge sentences as our variable names, but typing an extra couple of characters is always better than wondering what exactly a certain variable is for.

Function Names:

Functions should be named descriptively. Function names should preferably have a verb in them somewhere.

Function Arguments:

Arguments should be treated same as variable names. In most cases, we’d like to be able to tell how to use a function by just looking at its declaration. And also when we generate documentation via script, these will help us understand it better.

Include the braces:

One should use complete syntax for conditional / loop structures. Even if the body of some construct is only one line long, do not drop the braces. Examples:

Comments:

Each function should be preceded by a comment that tells a programmer everything they need to know to use that function.

The meaning of every parameter, the expected input, and the output are required as a minimal comment. The function’s behaviour in error conditions (and what those error conditions are) should also be present. Nobody should have to look at the actual source of a function in order to be able to call it with confidence in their own code.

Especially important to document are any assumptions your code makes, or preconditions for its proper operation. Any one of the developers should be able to look at any part of the application and figure out what’s going on in a reasonable amount of time.

Kashmir Tour

From my childhood I had been hearing about Kashmir Janat Nazeer (Kashmir a paradise like place), so I always had dreams of going there but haven’t got a chance to visit these areas since I started travelling in 2000. In year 2012 beginning when I started planning for my tour in June , I had in mind Kaghan and surrounding areas. I discussed about this with Shujaat and he immediately asked me to change this to Kashmir.

I started researching and studying about our plan to Kashmir. In this regard, I like to take help from  PakWheels Forums, which has been very helpful for me in planning my trips in Pakistan. I got to know about a Tour Group who were helping in touring. I finalized and booked a plan with them.

9th June – Saturday: Left Karachi with my friends via Daewoo Bus to Rawalpindi.

10th June – Sunday : We reached Rawalpindi at afternoon and met our friends who were joining us from Mardan. From there we left for Murree. Unfortunately when we reached there Rawalpindi there was some CNG strike due to which it took quite sometime for us to reach Murree. And then the Taxi we hired from Rawalpindi also cheated us and dropped us in mid-way instead of dropping us closer to Mall Road as we agreed upon. The reason as he used was an Urs due to which all roads were blocked in Murree hill. However, soon we had to hire another Taxi and were able to reach Mall Road. Here I learned an important lesson that don’t show sympathy to such people (which I always show :() who cheat you. It was first visit of my friends to Murree and they liked it very much, they really liked roaming on Mall Road. It was an experience worth remembering for them 🙂

11th June – Monday: We visited Kashmir Point in morning and it was very peaceful at that time. Usually in evening time that area gets very crowded. We left Murree at noon and again we faced the same traffic blockage and less traffic on Motorway due to that Urs (as such Urs usually remains for 2-3 days). It took time but finally we reached Muzafarabad around 6PM. There I contacted the Tour Group people and they helped us took a room in a Hotel in Muzafarabad.

12th June – Tuesday: We left Muzafarabad in morning for Kutton. I would say now its Kashmir. The journey we started for Kutton was an extra ordinary one. I watched River Neelum flowing, Indian border, breath taking sceneries and acknowledged that it was not wrong to say this Janat Nazeer. We reached Jagiran Resort House in evening, while stopping at Kondal Shahi and other areas for taking pictures, doli rides etc. It was a pleasant journey.

Staying in Jagiran Resort House was an experience in itself. This resort house has been built by Govt. of Azad Kashmir and is an extra ordinary place. The surrounding areas and views from resort house are simply majestic.

Jaigran Resort House

View From Resort House

Outside Resort House

13th June – Wednesday: Early in the morning we left resort house for Keran / Kel. We went till Sharda and couldn’t go to Kel as we had to come back for night stay at Jagiran rest house.

This whole journey from Kutton to Sharda was very good. The roads were clear and views were fantastic. I had been to some other Pakistan’s NA areas e.g. Swat, Dir, Chitral and liked Kumrat, Dir the most till then. But after visiting Kashmir, I just fell in love with it and we enjoyed every bit of our journey there.

After visiting some old ruins and other areas in Sharda, we started our journey back to Kutton. On our way back it started to rain and when reached Kondal Shahi it was completely dark and raining cats and dogs. We took some stuff from the Bazar and left Kondal Shahi.

Keran Sharda

14th June – Thursday: We had plan to go to Jagiran Power house by doing a trek. So except for one friend all 4 others left for it. We did a trek for an hour or two so and then had to get into a Jeep which was going there as it was very steep :). There at Power house we spent some time and got back (once again by walk and some Jeep ride).

Jagiran Power House On way to Jagiran House

Upon reaching the resort house, a bad news was waiting for us. The van which was given to us by the Tour Group was called back by them without giving us any reason / update. I inquired from the resort house people and confirmed no body from Tour Group had approached them to update us about it. They just called the driver and driver told our friend who was in resort house and left. It was totally unprofessional. We had already paid 70% of amount agreed upon to Tour Group and rest was supposed to be paid when reach back to Muzafarabad. This incident really disturbed us.

As that same day we were supposed to leave for Muzafarabad. After discussing with my friends, we decided to go ahead with the actual plan and don’t wait for the Tour Group people. This descision was quite risky as we were far away in an area where finding rides were not easy but we took the risk and were hoping to find something on our way till Kundal Shahi, from where we were expecting to get a Taxi to Muzafarabad. So we left resort house and fortunately walking for an hour or less we found a ride which dropped us at Kundal Shahi. From there we took a Taxi till Muzafarabad, where it dropped us around at 6 PM.

As per our original plan we were supposed to stay in Muzafarabad for night but one of our friend suggested that we should leave and see if we could reach on time to Rawalpindi and then Mardan. Fortunately we found seats in last Qadri Coach which was leaving for Rawalpindi. We took the Coach and started our journey back to Rawalpindi. While travelling in that Coach one of the person from Tour Group contacted us and excuse for whatever happened. But I strongly feel whatever they did was very unprofessional. And I would certainly not recommend them to anyone. This incident also taught me a lesson to trust only trustworthy people.

We reached Rawalpindi at 11 PM and were amazed to see life in full swing at that time which is now quite rare for Karachi people 🙁 due to certain reasons. We easily hired Hiroof and reached our friend’s house at around 2AM or so in Takhte Bhai. We tried to look for famous Chapal Kebab but they said they were finished so just had some tea.

15th June – Friday: I left Mardan for my village and from there flew to Karachi on Sunday 17th June.

Overall it was a memorable trip and I look forward to go again to Kashmir and visit the areas which I couldn’t in this trip. I regret not having more days to explore these areas but inshAllah very soon I will be able to compensate for that 🙂

I believe Kashmir is a place to visit again and again. I see there are two routes which one could take: One is via Muzafarabad and then areas coming on that route and the other is Bagh and then areas coming on that route. So I will try to explore areas on both routes.

I also found the roads in Kashmir well built (as compare to Swat and Dir), people are friendly (as compare to Murree and Kaghan but not better than Swat). So I would say it is accessible, affordable and beautiful. Both family and with friends one could enjoy this.

An Update

Its been very long time I updated my blog due to busyness / laziness. In the last few months different things have happened:

  1. Completed my masters degree.
  2. Visited Kashmir area for first time. I will try to write and post its details soon, it was an amazing experience.
  3. Posted final year project EME code to github.

I will try to keep this blog updated both with travel / trek tips and technical writings.

Final Year Project Cleared

As I had been posting about my final year project progress here and here. Allhamdullilah, I have cleared it with 3.67 GPA. While working on my own project, I also emailed a number of students and those who responded I continued to share some of my tips emails. I am really happy to see that my tips emails were very useful for some students and some of them were able to create their project and clear it.

I plan to continue with this and would be looking forward to help further students in upcoming final year projects. But I would like to clarify one thing that help doesn’t mean copy. It means I would only try to provide some guideline (for any project on which students are working and I have idea about that project) and with that guideline students would be able to make progress on their projects.

So those who require help could contact me by leaving comments here or sending email at naqoosh AT gmail DOT com. I will get back soon inshAllah.

LESS and node.js

Recently I when I was studying and trying to use some new HTML5 code, I also got to know about node.js and LESS.

When briefly read about them, I was amazed the features and functionality they provide. I strongly believe both of these will simplify the life of a web application developer. I am looking forward to learn and work on them in the near future.

I will try to write some of my experiments here.

Kindle Touch Review

I have got my Kindle Touch a few weeks ago and I have been using it very regularly.

Reading Experience: When I bought it my main question was will I be able to read the PDF books? I knew it is one of the best device for English books reading but I was going to use it both for English and Urdu PDFs. So even before ordering, I was a bit nervous if it would handle it or not. But it is opening and rendering the PDF documents I have in both languages smoothly and the touch system is also a blessing as I have to do a lot of zoom in/out. So I would give 9/10 for this PDF support.

Also, I have used it both in sunlight and power lights at night / room and it is easy on eye and gives a good feeling.


Reading Ashfaq Ahmed's Zavia on Kindle

Touch System: This is Amazon’s first touch Kindle device and I would say it is not bad. I agree it doesn’t match the quality of touch from Apple but at this price and the purpose for which this device is used, I am pretty satisfied with it.

Size and Weight: I really liked this device’s size. One could hold it in one hand and read for hours without any difficulties as this is very light weight.


Kindle Charging

Battery Life: This was one of the high point for me to buy this. Daily I read for about 1-1.5hrs on average and while reading due to the PDF documents, I have been zooming in / out and the battery it consumes is very less.

Experimental: There are some experimental features in this like web browser and mp3 player. Although I am not using them regularly but they worked pretty fine.

Connectivity: Being registering this device in Pakistan and using it from here, I don’t have access to the amazon services directly but via WiFi, I am able to browse Amazon Kindle Store and other websites via its experimental web browser. It was pretty easy to setup my WiFi in Kindle.

Overall I am very satisfied with this and I would recommend this for any one who likes to read. There was only one negative point which I didn’t like was to not have the power adapter included in normal purchase. It is sold separately. I didn’t know this when I ordered it and it was not easy for me to order a separate item again as my friend was bringing this for me from US.

Nanga Parbat Rupal Face Trek


Duration: 6 Days
Distance: 37 Km
Standard: Easy
Season: June ~ October
Start / Finish: TARASHING
Zone & permit: Open
Public Transport: Yes

Summary: A Quick approach through lovely meadows leads to the base camp of NANGA PARBAT’s enormous RUPAL face.

NANGA PARBAT’s awesome south or RUPAL face rises 4572m from the floor of the RUPAL GAH, creating the greatest vertical rise from base camp to summit of any peak. The easy trails and two short no technical glacier crossings bring you directly beneath it for breathtaking close-up views, is less frequently visited than fairy meadows.

Guide & Porters
It’s prudent to hire a reputable, licensed guide who is accustomed to dealing with RUPAL porters and villagers. Porters come from TARASHING and CHORIT, which have decided that an equal number of porters for any party are to be from each village. This holds true even if you have just two porters. Porters, who transport loads on donkeys, ask for a flat rate of Rs.300 per stage, including payment for food rations and expect large parties to buy a goat at SHAIGIRI.

Stages
It’s a six stages total round trip from TARASHING:
1. HERRLIGKOFFER Base Camp
2. LATBOH
3. SHAIGIRI & (4-6) there stages to return via the same route.

Nearest Village:
TARASHING

Hotels / Rest Houses:
NANGA PARBAT TOURIST COTTAGE: owned by Mohammed Ashraf, has a large garden. The Camping fee is Rs.100 and rooms cost Rs.250 ~ 400.

HOTEL NANGA PARBAT: has a Rs.100 camping fee and rooms cost Rs.200 ~ 300.

Unless you organize a Gilgit ~ TARASHING special hire (Rs 2500/4000 one way / return), it’s necessary to change transport in Astor. The narrow jeep road to Astor leaves the KKH at Jaglot, 60Km south of Gilgit and 30Km north of Raikot Bridge, crossing a bridge over the Indus river and heading 40Km south – east up the Astor Valley skirting NANGA Parbat’s north east flank. Gilgit ~ Astor jeeps (Rs 100, three to four hours) go all day from Gilgit’s Jaglot bus stand on Domyal Link Road. Gilgit ~ Ator special hires cost Rs 1200 ~ 1500 one way. Astor ~ TARASHING Jeeps cost Rs. 50 (two hours) and special hires cost Rs 1000.

THE TREK:

Day 1: TARASHING to HERRLIGKOFFER Base Camp
5 Hours, 10 Km, 639m Ascent

From TARASHING (2911m) climbs the TARASHING Glacier’s lateral moraine, near the village’s north edge, and crosses the glacier on a trail, continues up to the gentle valley through RUPAL village.

Rising gradually through RUPAL’s lush fields, the trail follows the valley’s north side up a narrow green valley, through groves of willow, poplar and juniper then you pass a small lake and round a corner of the BAZHIN camp, a flat, green meadows between the lateral moraine of the BAZHIN Glacier and the mountain. Ahead towers the solid ice wall of the east face of NANGA PARBAT. This is a perfect campsite with clear spring water, a wood full of birds this spot is called HERRLIGKOFFER Base Camp (3550m), a beautiful, although much used meadows along the BAZHIN Glacier’s east margin. The camp site is named after Dr. Karl M HERRLIGKOFFER the leader of eight German expeditions to NANGA PARBAT, including the first successful expedition in 1953.

A side trip of several hours up this ablation valley leads to a point on the moraine directly above the BAZHIN Glacier and across from icefall coming from the summit.

Day 2: HERRLIGKOFFER Base Camp to LATBOH
4 Hours, 3 Km, 20m descent

Crosses the BAZHIN Glacier over a trail in 1½ hours along a donkey path, the local shepherds come and go frequently, so you can follow their path or them but be careful there will be a lot of hidden crevasses and you can listen to the voice of flowing of under ground water so you must walk slowly and don’t stop at the BAZHIN Glacier. From the top of the lateral moraine on the western side you look down on a huge grassy field known as LATBOH (3530m), the broad level meadows frequently by RUPAL herders. LATBOH is also known as TUPP Meadows because it’s like a TUPP which must once have been the bed of a lake. Herds of horses, sheep and goats graze in the centre. The summer villagers churn butter in goatskins and spin sheep wool while they sit and chat, offering bread and buttermilk (LASSI) to visitors.

Day 3: LATBOH to SHAIGIRI
4 Hours, 5.5Km, 125m ascent

A further two hour takes you around the end of a second moraine, with a lake on the top (Basically this Lake is less frequently visited & has no name and it exists at the foot of NANGA PARBAT so that is why I gave it a name “NANGA PARBAT Lake”) to another broad field, LATBOI (meaning stony place) also called second Base Camp, with a summer settlement on one side, from here the path climbs gently over some moraine then follows the north bank of the river through the woods to SHAIGIRI (meaning “white stone” in Shina) 30 minutes away. This is a good campsite at about 3660 meters, with fresh water, firewood and superb views of the south face of NANGA PARBAT.

Day 4 ~ 5: SHAIGIRI to TARASHING
2 days, 18.5Km, 744m descent
Retrace steps to TARASHING, Camping at base camp on day 4.

Custom WordPress Themes

Recently I worked on a few wordpress themes. It was a great experience and I found it easier to work with WordPress themes as compare to Drupal, Joomla and other CMSes. I was able to map my requirements into WordPress easily and use this a full fledge CMS. Some of the things I liked about WordPress are:

  • Open system, good documenation and help available online.
  • Hundreds of plugins availability.
  • Map pages (or category) directly to their ids/slug as page-7.php or category-development (where 7 is page id and development is category slug).
  • Use custom fields for storing custom information. These fields were very helpful and I believe one could use it many different ways while developing a custom theme.

I hope to continue my journey with working on further exciting and complex themes. I also plan to share some tips / code in the future in this regard.