AKA Marketing.com Logo            VISIT THE BLOG            

Blogged thoughts, is our web blog. Expect views, opinion, rants and tirades about everything and anything 

« Home / Forums »        

 


Subscribe to our SEO / IT related blog by entering your email address below

Blogged thoughts

| by the www.akamarketing.com team

Archive for March, 2007


Being a Code Monkey

Monday, March 19th, 2007

If you work in the IT industry you have probably heard and perhaps used the term ‘code monkey’, the term generally refers to a person who writes program code (and all that goes along with it) for a living, it can be used affectionately or in a derogatory manner. I generally use the word in an affectionate manner, however I occasionally use it in a derogatory manner (against myself), for example if my boss asks me a question that I don’t want to (or can’t) answer I simply use the old ‘How am I supposed to know? I’m just a code monkey.’ line. This reminds him that I’m a useless waste of space and he moves on, simple as that.

The title of this blog post really should read something like ‘a day in the life of a code monkey’ or something similar as that’s what I want to write about but since I also want to use this post as an exercise in search engine optimisation to try and appear near the top of Google for the phrase ‘code monkey’ (that’s going to look great on the auld CV if I pull it off - completely useless from a marketing POV but hey what can you do!) I’m going to stick with the generic title. UPDATE - I’ve since changed the title from ‘code monkey’ to the current title. ‘Code monkey’ on its own had me rotting away in the 30’s (37), perhaps an over optimisation penalty was applied, I don’t know. We’ll see what happens anyhow.

So what sort of day to day tasks does a code monkey have? Obviously the quickest and most basic answer is that his or her tasks are to write code but it’s not all about writing code you know! Therefore I will try to answer the question more specifically based on my general understanding of what a programmer does and based of course on my own specific experiences too. The headings below relate to different code monkey tasks and are given in no particular order.

New Systems Development
New systems development is the main reason for the existence of code monkeys. From system conception right through to UAT (User Acceptance Testing) and (hopefully) final release a code monkey is usually involved at least to some extent. These days there are a lot of great applications to help with almost every stage of systems development. An advanced IDE (Integrated Development Environment) like Microsoft Visual Studio 2005 for .NET systems or say something like NetBeans or Eclipse for Java based systems could literally knock days/weeks off actual coding time. Similarly a tool like Microsoft Visio or Rational Rose makes the task of creating flowcharts, schemas, use cases etc. a whole lot easier than say trying to use Word, Paint or even Photoshop.

My IDE of choice is Visual Studio 2005 and I use it extensively to code not only .NET Windows and web systems but also PHP based systems too. PHP with Visual Studio? you ask. Yes with the help of the very excellent VSPHP to be found at http://www.jcxsoftware.com/ this is possible. It’s a plug in for Visual Studio (a standalone version is available too which works even without VS 2005) which provides an IDE for PHP. The best thing about using a tool like that for PHP for me is the availability of Intellisense. Intellisense will be a familiar term and concept for all .NET code monkeys, but for the benefit of others Intellisense is a form of code auto completion whereby as you type your code the IDE will regularly show a popup box with various functions and variables available, you then click on the relevant item and it’s placed into your code. Using Intellisense with PHP is a real novelty for me, saves a good bit of time too.

In terms of actual coding style then well this could differ dramatically from code monkey to code monkey. I guess my style of programming is very step by step-y, I would be a lot more likely to write a couple lines (5 or 6) of code and rebuild (for .NET) or refresh (for PHP) and if this new code worked then move onto the next couple of lines rather than attempt to write 30 or 40 lines and then rebuild/refresh. One of the advantages of this is that errors in the code are easier to find as there will only be a very small number of statements which could be the culprit. Of course it really depends on how efficient your environment & architecture is, for example when I’m coding a workflow process with OpenText BPM in order to check new code I need to add new code (obviously), upload the new version of the process to the server and then go to the process admin tool and set the new version to active while also setting the old one to inactive, only then can I actually attempt to load the workflow process to test things. For someone used to simply pressing F5 (refresh) to see PHP code changes in action this is extremely annoying so in situations like this my 5 or 6 lines might stretch to 15-20 in a weak attempt to preserve some amount of sanity.

I don’t believe in reinventing the wheel and thus code reuse is a big part of new systems development for me. This means making use of object orientated programming as much as possible via classes, class methods, constructors, overloads etc. For the development of .NET systems I regularly make use of custom user controls for things like contact and general input forms. I try to add to the existing collection of user controls as often as possible. For PHP I don’t really incorporate OO principles as PHP’s object orientated support is in my opinion quite weak, I would however reuse functions from past systems to save time and effort, this is possible as I very rarely embed function definitions directly in scripts but rather I place them all in function files perhaps naming them something like directory-functions.php or active-directory-functions.php so I can call them easily.

It should come as no surprise that I make good use of comments in my code, this is as much for my benefit as it is for the benefit of future development team members. This is extremely good practice and something for all code monkeys to get into the habit of doing.

As for documentation, well this is a very important factor and can increase the likelihood of any new system being a success. Every code monkey should aim to create the usual array of design related documentation such as use case diagrams, interface mock-ups etc. for all systems. Things like a system user guide may also be needed too. I’m very poor at this at the moment I must admit, so poor that proper design documentation is missing for my last couple of systems. In my defence though a lot of this is down to lack of time resources but I’m going to be pushing hard to improve this aspect of my work in the near future.

Changing Existing Systems
Right clicking on a file, selecting copy and then pasting the backup of a code file is a prerequisite when editing existing systems; this is most true when the code monkey does not use something like Visual SourceSafe or Subversion to manage code changes. Most code monkeys will have access to a demo server and a production server so assuming the system versions are identical for both environments avoiding downtime may be possible. If a single environment is in use well then downtime is pretty much guaranteed. Depending on the nature of the change, work involved could be as simple as copying and pasting code from other systems or as difficult as coding a completely new system from scratch.

Trying To Figure Out Other Peoples Code
I guess I really could have put this under the ‘Changing Existing Systems’ heading but not to worry, it’s done now. On many days a good lot of a code monkeys time goes into figuring out what past team members where trying to do with various sections of code. Looking ‘under the bonnet’ and examining the code of an application or system which you didn’t help build can be quite tedious and usually involves pressing Ctrl+f in your favourite text editor or IDE on numerous occasions to find where variables, classes, functions etc. are being used. Of course in an ideal situation everything would be documented and the code commented to a satisfactory degree. As far as documentation is concerned, well this is one thing that is quite time consuming and thus often overlooked due to limited time resources, commenting code though doesn’t have to take up a lot of time and thus this should be naturally included in projects. What really annoys me is when the only comments in programming code are in fact just inactive lines of code as opposed to useful descriptions or definitions.

Interface Design
This is a favourite pastime of mine; it involves taking the basic interface of a system which is devoid of any design, usability & layout considerations and plugging all these elements in to allow the final system to be fit for release. What this means in reality for me is fiddling with CSS styles with Dreamweaver or editplus, setting alignment & position for various input/output controls, setting tab indexes, liaising with graphic designers for system icons & graphics, finalising the wording of various system textual elements and ensuring cross browser/resolution compatibility as well as a couple of other things. This is of course bordering on the edge of a code monkeys job spec, in fact a lot of systems have dedicated design people to ‘clean up’ the interface after the coding is done, this is why I didn’t include this under the ‘New Systems Development’ header.

Seeking Support And Help
In most organisations a troop of code monkeys exist so the option of simply asking a fellow coder for help is always there. Unfortunately due to an outbreak of monkeypox in my company at the moment I’m the sole inhabitant of the code village, district, enclosure, compound or whatever one feels like calling the place where the code monkeys congregate. This means that things can often get so quiet that in addition to my key presses one can hear wolves howling in the background so for me asking colleagues for help is out of the question. My main port of call then is Google and the Internet of course, I find myself spending a lot of time on three websites in particular, these are http://msdn.microsoft.com/, http://forums.asp.net/ and http://forums.devshed.com/. Most people reading this will be familiar with MSDN (and by association forums.asp.net) as a means of getting help, but I imagine less people will be familiar with devshed. Devshed in my opinion is a real gem, it includes tonnes of articles (one or two written by yours truly), tutorials and opinion but for me its real value comes from its developer forums. Particularly for PHP, it’s no exaggeration to say that on many occasions when I posted a new thread on the devshed forums looking for help I received the EXACT bit of information which I needed to solve whatever problem I was having within 5-10 minutes. When I say EXACT I mean EXACT, so responses aren’t just helpful in the pointing me in the right direction sense but helpful in the actual provision of a solution sense. Additionally I make good use the IT departments’ collection of books.

Administration And Monitoring
Things like creating accounts, resetting passwords, unlocking accounts, approving content via the CMS, restarting servers & IIS, periodically checking log files for anything strange and keeping an eye on database metrics to ensure uptime for data intensive systems all roughly fit into this heading. A lot of this stuff is also pushing the boundaries of a code monkey’s job spec but for me anyhow most of them are daily occurrences. 

Expanding The Skill Set
Technology as we all know moves at an extraordinary pace, new systems, frameworks, protocols, practices, etc. come on stream all the time while at the same time existing items are constantly being revised and enhanced. It’s important therefore for all code monkeys to try and keep abreast of any relevant technologies as they could help make their lives a bit easier. There isn’t usually much time for this mind you, well not for myself at the moment anyhow. ‘Luckier’ code monkeys however would generally just plain tryout different languages, IDEs etc, attend conferences, attend training courses, conduct research via books and the Internet and of course speak to other team members already trained up in a particular skill area.

So That’s What A Code Monkey Does!
A lot of differences will exist from company to company but generally the above covers most code monkey tasks, it certainly covers what I do anyhow, well in the day job anyhow, obviously I have my SEO bits and bobs in the evenings and at the weekends too. These tasks form the cornerstone of every code monkey’s day and for me they are unlikely to change anytime soon. Speaking of change - in the past few weeks my boss has let me know that there is a possibility of moving to a new much bigger and better supported code compound not to far from the code village I’m currently based in, perhaps he wants rid of me. QUE SERA SERA!


ASP.NET search engine optimization

Sunday, March 11th, 2007

Has anyone noticed how clumpy and verbose the source code is of some .NET generated .aspx pages are? I mean this can’t be good food for the stomaches of the major search engines, nor can it be good for download times. There is no point is creating a feature rich .aspx website in comparatively double quick time with an advanced IDE like visual studio 2005 which runs on an equally advanced framework like .NET 2.0 when that very same IDE and framework is causing so much code blote and badly placed code (much of it probably unnecessary) that it is likely hampering your positions in the search engines and/or causing people to leave your site before it is even fully loaded.

Of course the amount of bloat created depends on what type of pages your programming but often the end produced source code can be ‘cleaned up’ regardless of what controls, interfaces etc. you are using. It’s just a matter of knowing what to look out for really. One of the main culprits are as far as I can see is ASP.NET’s ViewState mechanism.

ASP.NETs ViewState is the built in mechanism which enables controls such as textboxes, labels, datasets etc. to maintain their states (data) between postback requests for the same page. It does this by hashing the current state of the page and controls into a string and saves this into a hidden field called __VIEWSTATE. At the server, ViewState is used to recontruct the web page and its server controls. This is fine and prevents an ASP.NET developer having to manually repopulate form controls using POST values like is the case with something like PHP, however it is not without a cost. Have a look below at the value of a hidden __VIEWSTATE textfield which was produced from a .aspx page with only a menu and treeview control on it.

‘/wEPDwUJMzg4NTE1Mzc4D2QWAgIDD2QWBAIDDzwrAAkCAA8WCB4NTmV2ZXJF
eHBhbmRlZGQeC18hRGF0YUJvdW5kZx4MU2VsZWN0ZWROb2RlZB4JTGFzdEluZ
GV4AgFkCBQrAAIFAzA6MBQrAAIWCB4EVGV4dAUJQ3VzdG9tZXJzHghEYXRhUG
F0aAUQLypbcG9zaXRpb24oKT0xXR4JRGF0YUJvdW5kZx4QUG9wdWxhdGVPbkR
lbWFuZGdkZAIJDzwrAA0CAA8WAh8BZ2QMFCsABQUPMDowLDA6MSwwOjIsMDoz
FCsAAhYKHwQFBEhvbWUeB0VuYWJsZWRnHgpTZWxlY3RhYmxlZx8FBSAvKltwb
3NpdGlvbigpPTFdLypbcG9zaXRpb24oKT0xXR8GZ2QUKwACFgofBAUIUHJvZH
VjdHMfCGcfCWcfBQUgLypbcG9zaXRpb24oKT0xXS8qW3Bvc2l0a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xYBBQlU
cmVlVmlldzGl0+HS1X8B5jfomTSld5U3ULhXjg== ‘

Obviously if I was to add more controls this value would grow accordingly. ViewState is enabled for all controls by default, luckily though ASP.NET has made the EnableViewState property available for setting true or false on a control by control basis and thus you can disable it for certain controls which you might never change like a label or a readonly datatable which might be populated from an external source such as a database or an XML file. For example below is the value of the same __VIEWSTATE hidden field (from above) with EnableViewState set to false for the menu control which gets populated from an XML file when the page loads and thus its state will not change between requests/postbacks.

‘/wEPDwUJMzg4NTE1Mzc4D2QWAgIDD2QWAgIDDzwrAAkCAA8WCB4NTmV2ZXJ
FeHBhbmRlZGQeC18hRGF0YUJvdW5kZx4MU2VsZWN0ZWROb2RlZB4JTGFzdEl
uZGV4AgFkCBQrAAIFAzA6MBQrAAIWCB4EVGV4dAUJQ3VzdG9tZXJzHghEYXR
hUGF0aAUQLypbcG9zaXRpb24oKT0xXR4JRGF0YUJvdW5kZx4QUG9wdWxhdGV
PbkRlbWFuZGdkZBgBBR5fX0NvbnRyb2xzUmVxdWlyZVBvc3RCYWNrS2V5X18
WAQUJVHJlZVZpZXcxU1/1MUWW6NZaM/KXGnbkTXRYJ3w=’

That’s quite a difference right? And because the control does not change between requests/postbacks the page works exactly as before. Disabling the ViewState for the treeview control would further reduce the contents of the __VIEWSTATE hidden field, it too is populated from an external data source and thus does not require ViewState enabled. Therefore to reduce filesize and keywords to source ratio for SEO purposes turn off viewstate for each control which will not change between multiple requests for the same .aspx page. You can find the biggest ViewState contributors by examing the ‘Control Tree’ section of the trace.axd file. You need to have first enabled tracing of course.

Additionally the usual good practice of using external .js files rather than in-source embedded code will further reduce unneeded bloat and allow your .js file to be cached which should enhance download times.

Aside from generally cleaning your code up there are some other steps of optimisation which can be taken too. Specifically in terms of search engine optimisation an interesting feature of ASP.NET 2.0 is URL mapping. This allows a defined friendly URL such as akamarketing.com/televisions.aspx to be mapped to a complex SEO unfriendly URL such as akamarketing.com/store.aspx?productid=202030&basket=303303&name=television. This means that the actual URL which is the long complex one can be accessed from the shorter SEO friendly one. The original URL will of course still work too. From a programming point of view everything is exactly the same which means all the GET query parameters in the URL are still available. From an end user and search engine perspective the URL is much more friendly and spiderable. Additionally the improved keyword density in the shorter nicer URL versus the longer complex one should facilitate ranking boosts on MSN which deems keywords in URLs to quite significant and it should certainly help on the other major search engines such as Google and Yahoo too.

URL mappings must be manually defined in the web.config file, so if your adding dynamic content including new products, categories, articles etc. to your website/database a lot you will have to manually add a new mapping entry into the web.config file for each item you wish to be accessible via an SEO friendly URL. The entries follow a standard layout though so I’m sure a script could be written which examines your database and outputs the relevant mapping XML code which you could then simply copy and paste into the web.config file, infact I may write one myself over the next week or so if I get the chance. The format itself is shown below.

URL Mappings

As you can see the individual mappings must come between opening and closing tags of the urlMappings element and this element in turn must be included within the system.web element of the configuration file.

Moving on then let’s mention page titles. Not suprisingly ASP.NET provides you with the ability to dynamically change the content of a webpages HTML title tag - you know the one at the top of the browser which Google, Yahoo and MSN love to see your keywords in. It is very important that what’s included in this tag reflects your page content specifically, having something generic just won’t do. When your content is being read from a database (ie - it’s dynamic) the title tag will need to be set dynamically at runtime based on the current content item. There are a number of ways to do this, however the most simple is to access the title property of the HTML header and update it as needed. Before you can access a pages header programatically you have to set it to run on the server side by including the runat=”server” directive in the pages opening HTML head tag. To then access the title tag it is a simple as Header.Title = “new title value”; Of course in a live website you would set Header.Title to some database derived value.

In addition to the pointers above the usual common sense SEO techniques such as good content, good structure and good navigation of course still apply just as they would for any webpage or website, so try not to get completely caught up in the ‘power’ of ASP.NET while at the same time disregarding the cornerstones of SEO as you’ll most likely find yourself stuck in a bit of pickle.

HOME | ABOUT US | CONTACT US | SITEMAP | GOOGLE SITE SEARCH | TOP
12 Lorcan Crescent, Santry, Dublin 9, Ireland +353 87 9807629