Work and not work

An event jogged my memory a couple of days ago and provided the inspiration for this blog article. A number of years ago whilst freelancing I rang a web agency to see if they hired freelancers and whether they had a project I could work on.

I told the person in the conversation about my education, my previous work, my company but I also mentioned that I study programming as a hobby also. Immedietly in a raised voice “we are not doing this as a hobby, we do this as a profession, this is not just some hobby!”. At the time I was shocked, what kind of response is this?

I came to the conclusion that this person obviously cannot conceive that programming can be studied as a profession “and” as a hobby i.e. studied in spare time outside of working hours. The reason the person cannot conceive of this is because this is something the person has never done. This person has never worked on a programming project in his spare time outside of work.

The idea that someone could dedicate extra time outside of professional work to programming something they enjoy is inconceivable to him because he does not enjoy it. Surely anybody who enjoys programming and the greatest programmers out there will know that the programmers who also study programming as a hobby are more likely to be more committed to programming than those who only do it for their profession.

This sort of response can be seen across the whole working spectrum, the more the person takes the work “seriously” the less he is interested in doing work. He takes work “seriously” because he does not really want to work, he gets no enjoyment from doing the work so he cannot conceive that anyone else can enjoy doing work.

In reality he does not work take work seriously at all … “we are not doing this as a hobby, we do this as a profession, this is not just some hobby!” has no real meaning. It says nothing as to the quality of the work he is producing, supposing my code as a hobby is of a greater quality than his code as a profession? His statement says nothing, it is just an empty statement stated with the tone of someone trying to be serious but cannot be taken seriously.

Another situation might be the boss who does not let his employees work from home. This can be well rationalized “we do not like our code on other peoples computers it is a sercurity risk” etc. In reality the boss does not let his employees work from home because the boss cannot concieve of an employee who can actually do work when the boss is not watching. You have to be there so the boss can see that the work is being done.

Again this ties into the enjoyment aspect of it. You cannot possibly enjoy work that much that you would go home and work when he is not watching because he does not enjoy doing the work that much and it is not something he would do. It is the joy aspect that is being targetted.

There have been a couple of occasions in the past where I have been working on a programming task in an office and I have looked up to notice a collegue staring at me. One of the collegues was staring at me in joy with a smile on his face, one of the collegues was also staring at me in joy with a smile on his face and he made the statement “you thought you where being clever there didnt you”.

I never thought much of this at the time but the more I thought about it the more it made sense, in those collegues eyes I must have looked similar to this …

https://www.youtube.com/watch?v=laG5XawvtqA&t=980

No I am not claiming to be some super genius, but what they saw was probably something similar to that in their own eyes. What they where actually seeing was the “aliveness” of myself actually enjoying working on a programming task.

This can also be seen when asked to struggle with a programming task. Say a new developer is being introduced to a new codebase …

Myself …

This is how I implemented file uploads.
This is how I implemented error handling.
I put these methods in this Model here and they do this and help with that.
I created this helper class to deal with this.

General developer in the industry …

Yea, just look through the code and struggle with it, mate.

I am not saying there should be no struggle I am just saying there should be a balance. In this industry I see far more of the “struggle” path than the opposite, even to the point of asking a question no longer gets an answer but the developer is expected to struggle for 2 hours to get an answer to a question that would have taken 30 seconds to answer. This is not productive, it is counter productive.

The “struggle” path developer rationalization to this is always, “well if I had given you the answer I may as well of been doing the work for you”. Yes in some situations this could be valid but in 90% of the situations I have encountered this it was clearly not valid. It is just an excuse for the “struggle” path developers own lack of effort.

In my own opinion all questions should be answered no matter how simple the answer may be. It may not be simple for the developer who is just starting out. Answering the question helps relieve a blockage in the production.

The next arguement could be “how I am suppose to get my own work done if I am answering questions all day” this could be valid, but then it is a management problem, the manager should account for the fact that the more settled in developers will need to answer the new developers questions.

I personally think all “lead developers” job roles should consist of helping / answering developers questions and maintaining the consistency of the codebase / architecture of the code.

That is all the lead developer should be doing, the lead developer should act as a “leader” to the none lead developers and as a person who ensures the cohesion of the codebase as a whole releaving blockages in the production by helping the none lead developers.

The lead developer should not have a huge number (if any) tasks on his plate at all and his / her sole focus should be on the none lead developers, leading them. In reality what generally happens is the lead developer has just as much work as the none lead developers have to do.

What happens? No help is given to the none lead developers, tasks take longer by not getting answers to questions, none lead developers look incompetent, lead developers looks good because his work is getting done and generally everything just takes longer.

Developer asks a lead developer a question, answer it. Developer is stuck on writing a block of code, pair programmme with the developer for 30 minutes, relieve the blockage. Lead developer checks the code commits for the day and finds mistakes, point out the mistakes and ask the developer to correct them. Lead developer checks the code commits for the day and finds inconsistencies in the code which would not fit well with the rest of the code, architectural inconsistencies, point out the inconsistencies and ask the developer to amend them.

The lead developers role should consist of leading and empowering the none lead developers. In most companies the lead developer is merely the developer who has been at the company the longest, not really leading anyone at all.

What is worse is that the lead developer is given “first dibs” on most projects, this means the lead developers code 90% of the codebase and then it is passed onto the none lead developers to amend and maintain.

Manager …

Ohh I will give Lead Developer X this project to do, like I did with the last one and the one before that because he knows what he is doing and he gets the work done within the deadlines. Of course he knows what he is doing, he started from a blank canvas.

Once the project completed and passed on the lead developer is then working on his next project which he got “first dibs” on, so he is now “too busy” to answer the questions of the none lead developers even though he is the only person who can really answer the questions as he wrote 90% of the codebase.

This kind of position is “easy street” and involves less work really than what the none lead developers are doing. A solution? Each developer is given his / her own project or set of projects to build and maintain. If the project is absolutely a huge project that requires multiple developers, then the lead developer is the “leader” and the none lead developers are the “developers” doing most of the work.

Yii / Yii2 checking controller params at the access control level

One of the areas I notice in a lot of Yii / Yii 2 web applications is the checking of parameter variables in what I consider the wrong areas.

Here is an example of one of my controller methods for saving a Book …

So what stands out about this method? No load Model method? No checking to see whether the Book has a valid ID? How will we know whether the Book has a valid ID, how will we know whether the Book is suppose to be accessed by the particular user that is logged into the system?

The answer is, the access rules and bizrules of the web software application. All controller methods should be assigned to an access rule. If the controller method contains parameters then the controller method should be assigned to an access rule as well as a bizrule.

For smaller / less complex applications you can actually emulate the bizrule by using “matchCallback” which is spoken about in this article I wrote previously …

http://www.jamesbarnsley.com/site/2017/06/13/yii-2-user-permission-using-matchcallback/

You can also read my previous article on what I think of the Yii / Yii2 load Model method …

http://www.jamesbarnsley.com/site/2015/04/22/yii-loadmodel-method/

All controller parameters should be checked and validated in the bizrule, by the time the parameter reaches the controller method there should no need to have any checking in the controller method at all for the controller parameters.

If the Book does not exist or the Book is not accessible by the current logged in user then that will be handled before any controller method code gets executed in the first place.

There is no reason to have this level of checking in the controller method itself. Doing it the way I have described also keeps the controller more clean as extra code is not needed to check the controller parameters.

Retaining great employees

There is talk on the web about retaining great employees and the way some of the articles are written about the subject you would think a lot of companies have a real struggle to get and keep great employees.

Not sure what makes the employees “great” employees other than the fact that if they are the ones leaving the company they obviously have options elsewhere.

So what would I do if I had a company with employees and I wanted to retain them without going over the top and paying them huge salaries obviously …

Allow home working

If your company is in a position to do this, allow the employees to work from home as and when they choose to.

Less hours in work day

Expect 5 hours “in the zone” work from each employee each day but pay them for 7.5 / 8 hours.

Allow the employee to revise skills, have breaks / lunch, collaborate with coworkers, work on personal projects, exercise or even depending on your limits allow the employee to occasionally take the rest of the day off in the 2.5 / 3 hours spare.

Alternatively if the employee really wants to, the employee can carry on with his / her workload. It is up to the employee what he / she spends the 3 hours doing each day.

Companies bill work out at huge hourly rates, contract employees get paid rates that for the most part are 3 or 4 times higher than a standard employee.

If your employee earns £30,000 a year that equates to around £15 an hour at 8 hours work per day, at 5 hours work per day it equates to £24 an hour. What difference do these kinds of low figures make when you are billing clients out at £75+ an hour?

You are still making a huge profit on the employees hourly rate, do you really need to squeeze them for the full 8 hours to get your moneys worth?

Lets see …

Company 80 billable hours per day …

80 hours * £75 = £6000.

Employees cost per day …

80 hours per day at 10 (8 hour) employees at £1200 per day.
80 hours per day at 16 (5 hour) employees at £1920 per day.

The difference in money is £720 per day to offer the above system of working. Yes you have to provide for another 6 employees as well however at least you can gain the satisfaction of having a larger workforce.

The biggest bill is going to be the wages the rest of the payments for employee equipment etc is going to be far less.

Yes the system does cost money but it is the difference between making £4800 and £4080 per day.

Please note if its contract jobs we are talking about, then I would expect the employee to work the full hours quoted as contract employees are on a high hourly rate, the above only applies to standard employees.

Another alternative to the above “5 hour workday” would be to implement the “4 day work week” essentially the employee works 4 days a week but gets paid for 5 days.

Also note that none of the above ideas are an excuse to compress more or the same amount of work into less time. If that happens then the above advantage has obviously been nullified.

More holidays

20 to 21 days holiday entitlement a year? Increase it. I think for every 8 weeks worked an employee should be able to get around 5 days off work. This will double the holiday entitlement bill from around £2400 a year to £4800 a year on a £120 per day employee.

That would increase the cost from £6 per day to £12 per day for each employee that is an extra £6 per day for each employee. With 10 employees that would cost an extra £60 per day, with 16 employees that would cost an extra £96 per day.

Lunch around a big table together

The whole company should eat lunch together every working day preferably around a big table or multiple tables if needed.

Once a month meal

Once a month take the employees out for a meal, paid for by the company.

A lot of these points do eat into the profits however as stated if each employee is making a significant profit per day i.e. employee costs £15 an hour and is billed out at £75+. Then really a company should be able to afford some of the above described perks. This does however assume that each companies employee is booked out enough to make a profit.

In my multi person company this would not be a problem as I would only employee new employees as the work expands, for example I start out with 30 billable hours per week provided by 1 client. That would be just enough work for myself.

Later on I have 3 clients and 100 billable hours per week that would be enough to employee 2 additional employees as well as myself. If the work subsided then I would downsize the company. It would never be a problem as each employee would be generating a lot more money per hour than what I would paying the employee per hour.

These are the points I would implement in my business if I owned a multi employee business. Not all the points have to be implemented but the more points the better. Obviously if the workplace is toxic then none of the above points apply and employees will leave anyway but that is a different topic of discussion.

What would I look for in hiring a developer?

What would I look for from a technical perspective when hiring a developer?

Below is a list of areas I would look into when hiring a developer, please note that most of the below areas only apply if the developer is working on the codebase independently i.e. the codebase is solely the developers own codebase and is not being worked on by multiple developers …

Consistency of code
Is the consistency of the developers code consistent. There are many different ways of writing the same code in terms of code syntax but is the chosen way to write a piece of code consistent with a later way of writing the same piece of code. I am not talking about blocks of code here although it could apply to blocks of code as well but I am mainly talking about the small pieces of code for example arrays.

In PHP arrays can be written in the following 2 ways …

Or …

I would expect the developer to choose a way to write arrays and stick to the one way of writing arrays throughout the code. This also applies to using brackets within the code …

Or …

I would expect the developer to choose a way of writing brackets within the code and stick to that way of writing brackets. In the particular example above it would be except-able for the developer to change the style of writing the IF statement if the IF statement was no longer than 1 line of code for example …

The above is fine because there is a reason for it. That reason being the IF statement is no longer than 1 line of code. This reasoning can be applied consistently through all areas of the code. So when an IF statement is no longer than 1 line of code brackets are not needed. This is except-able if the reasoning is kept consistent throughout the code.

Consistency can be applied across many more areas including, naming conventions in code, code files and database, structure of the code, classes and extending classes, using code in view files or not using code in view files, tabbing / spacing of code.

So long as areas of code are kept consistent and the code is not mixing the above styles without reason then that would be except-able in my opinion.

Abstraction of code
Is the code appropriately abstracted? Is the code that is used in more than 1 place wrapped in classes / functions. If using a framework is the code in the controllers appropriately thin and the models and other classes doing most of the work.

When using a framework my controllers are quite small when compared to the level of functionality that is being executed. This is because my Models do most of the work and I make full use of the “beforeSave” and “afterFind” methods.

The controllers should control the flow whilst the details are kept tucked away in classes / functions.

Making the most of the tools / web frameworks
If using a web framework is the appropriate functionality being used? For example some of the latest frameworks have a feature called “scopes”. Are scopes being used where they should be or has the developer ignored scopes and written his own way of doing scopes?

If there is a legitimate reason for writing custom code to allow functionality similar to scopes then use it but if there is not a legitimate reason and the developer wrote his / her own way because he / she could not be bothered to read the scopes documentation then I would except the legitimate scopes to be used.

Same applies with “user authentication”. I have seen plenty of developers use their own way of “user authentication” including a full permissions system when the framework the developer used already had this feature built in.

When prompted as to the reason the developer created his / her own “user authentication” system the developer will state “the built in functionality is not fit for our requirements”, or “the custom user system that has been built is better and will allow us to do more complex user permissions” or some other general reason.

However upon further inspection it can be found that the frameworks built in functionality was fit for the requirements (plus more) and that the developer just could not be bothered to use the built in functionality.

So in conclusion if I was hiring for a developer the above areas are some criteria which I would make my decision on. The above areas are not set in stone and if some of the code was not in line with the above areas and there was a reason for it that would be except-able. If there was no reason for it, it would still be except-able under the agreement that the areas are rectified. All in all the areas have to be taken on a case by case basis.

Front-end vs back-end development

Is there such a thing as front-end vs back-end development in today’s web development world? How much do these cross over and even into other roles entirely? What is front-end developer or a back-end developer expected to know or do?

Well there is no easy answer to all of these questions, with today’s expectations both front-end and back-end developers have a lot expected of them. In very basic terms we could say the roles are briefly defined as follows …

Front-end developer

Expected to know HTML, CSS and be good at graphic design.

Back-end developer

Expected to know how to create databases and PHP.

Ok so that is defined very basically, now I will take into consideration all of the criteria not mentioned for each of these roles below …

Front-end developer

Based on the above we could also add the following as potential criteria to the Front-end developer role …

  1. Expected to know CMS systems such as WordPress.
  2. Expected to know front-end frameworks such as Twitter Bootstrap for example.
  3. Expected to know Javascript.
  4. Expected to know any number of Javscript frameworks such as JQuery, KnockoutJS etc.
  5. Expected to know any number of CSS frameworks that are available such as Less, SASS etc.
  6. As mentioned earlier, expected to know graphic design even though graphic design is a completely different discipline altogether.
  7. Expected to know server side templating languages, for example Smarty.
  8. May be expected to know a bit about server side languages so they can incorporate the HTML templates into the web app.
  9. Expected to know about SEO so the website can be coded to accommodate the SEO.

Back-end developer

Based on the above we could also add the following as potential criteria to the Back-end developer role, the first 6 bullet points are the same as the front-end developer role but are still valid, this is the cross over between roles I was talking about and how it blurs the lines between front-end and back-end development …

  1. Expected to know CMS systems such as WordPress.
  2. Expected to know front-end frameworks such as Twitter Bootstrap for example.
  3. Expected to know Javascript.
  4. Expected to know any number of Javscript frameworks such as JQuery, KnockoutJS etc.
  5. Expected to know any number of CSS frameworks that are available such as Less, SASS etc.
  6. Expected to know server side templating languages, for example Smarty.
  7. Expected to know HTML and CSS.
  8. Expected to know any number of backend frameworks, for PHP this would be frameworks like Laravel, Yii etc.
  9. Expected to know any number of database environments and their associated query languages for example MySQL / SQL, MongoDB / BSON etc.
  10. Expected to know any number of code libraries.
  11. Expected to know how to use version control systems such as Git, BitBucket etc.
  12. Expected to know any number of backend languages including all their frameworks and libraries. For example back-end developer could know C# but also PHP.
  13. Expected to know how to create and manage web servers.

So there is probably a lot more that I have not thought about or mentioned but that just about sums it up for now. You can see there is a big cross over between the skills especially in the area of Javascript. Javascript as a language is nothing like coding HTML but Front-end developers can still be expected to know Javascript.

Back-end developers can still be expected to use HTML even though they are Back-end developers. You also have to appreciate that most of these skills are multi-disciplinary and each skill in its own right could take a vast amount of hours to learn and maintain properly.

For example Javascript developer should be a role in its own right. Graphic designer should be a role in its own right. Web server administrator should be a role in its own right. Learning a single web framework like Laravel should be a role in its own right. Not one developer learning multiple frameworks.

The way the skills are listed above in the bullet points make them sound easy and degrades the time and effort it takes to learn the skills properly. However employers list the skills in the same manner as above in job descriptions they send out to potential candidates.

No one could learn all of those skills and be proficient in all of them. The time it takes to maintain such skills would be too much for one person to accomplish if taken to the degree of mastery.

Maybe some employers know this and do not expect the developer to be a master at all of them. Maybe some employers just copy other employers job descriptions without knowing that the other employer did not expect the developer to be a master at all of them.

Any employers listing too many skills that a developer should be a master at should be looked upon as not being very grounded in reality and taken with a pinch of salt. It is not just the time to learn the skill but to maintain them as well.

These technologies are constantly evolving and there is a lot of maintenance time involved as well. To be a master the skill has to be maintained and as mentioned earlier there is no way in reality that one person could be a master at all of them.