Merry Christmas and a happy New Year – 2017

Another year gone by and it is nearly time for Christmas.

Over the last 12 months …

Client work
I have taken on and worked with 3 new clients this year. As you may or may not know I am a one man contractor and my contracts generally last months at a time so 3 new clients has proved sufficient.

Toolkit
I have worked on an internal system for managing my business which is 90% complete. For all intents and purposes the Toolkit is completed. The remaining 10% will involve adding any remaining features I can think up or that may be needed.

Neptune – Lead Tracker
I have developed the initial Neptune Lead Tracker and put it online. Neptune has not seen much growth as of yet, I will leave Neptune for 1 more year then take it down if no one is using Neptune. – http://www.neptuneleadtracker.com

Czech Character Code Converter
I developed a web based software script to help me with work on a particular client this year. Afterwards I gave the web based software script a basic front-end and uploaded it online so it can be used by other people. – http://www.czechcharactercodeconverter.com/

King of Adem
Started writing code for a multiplayer strategy game. This project is on the back-burner at the moment and will remain there until some interest is shown from a game developer who would like to take the project further with me.

Overall a very good year.

As I wind down for Christmas I will not be writing anymore blog posts until January 29th 2018 so please check back then to continue reading my blog.

I wish you all a merry Christmas and a happy New Year, until next year, bye for now.

Good company, bad company

I was reading through my emails a few days ago when my Quora updates lead me to this statement …

“My ability to develop software has been improving monotonically over the years, but I have gone from good company to bad company, to good company. I was considered good in a good company. Then I was considered bad the month after I started at a bad company. Then I went to a good company and was suddenly good again. And I was improving monotonically. After you do this enough times, you realize that it’s not you. It’s the quality of the company.” – Link to Quora article

This struck a reasonance with me. Based on what this person has written and my own experiences we can draw up the following scenario …

So first of all it is unlikely that he was either in a wholly good company or wholly bad company but the observation of the good or bad company was based entirely on the people giving him the good or bad references.

Secondly I would like to point out that in this context good or bad is only an expression to describe the positive or negative references so when I state good company, good column or good reference it means positive reference and when I say bad company, bad column or bad reference it means negative reference there is more to it than this though, keep reading.

Now based on the diagram above let us say the world was divided into 2 categories of people, bad column and good column.

One of these categories of people in this case the bad column category are the group of people that are solely responsible for the negative references that people are receiving today.

One of these categories of people in this case the good column category are the group of people that are solely responsible for all the positive references that people are receiving today.

This means that all the bad references this person was receiving was from people who are in the bad column category and all the good references that the person was receiving was from people in the good column category.

So what does this mean in terms of the good or bad reference? Well let us say you walked into a company where the recruitment manager was in the good column category and you tell him that you recieved a bad reference at the previous company.

Would that make a difference as to whether or not you get the job? Remember this good column person would have given you a good reference rather than a bad one for the exact same work.

So would this good column recruitment manager be able to spot the bad column category statement? If the good column category viewed the quality of your work would the good column person even care about the bad reference?

Now let us say you walked into a company where the recruitment manager was in the bad column category and you tell him that you recieved a good reference at the previous company. Remember this bad column person would have given you a bad reference rather than a good one for the exact same work. Well exactly what I said above for the good column person applies equally in this scenario, would the bad column person care about the good reference?

Is there any continuity between the bad column and good column category people? Will recieving a bad reference from the bad column category people “really” effect your relationship with the good column category people? Or does it just not matter?

So what is the solution to this guys problems if he sees getting a bad reference as a problem. The solution is to find work in a company where your manager is in the good column category of people. The “ideal” solution for this person is to find work in a company where all employees are in the good column category of people.

I say “ideal” solution because for the most part it is just an “ideal” because most companies have a mixture of people from the bad column and good column categories.

Maybe the good column director hired somone in the bad column to oversee a position at the company. A few years down the line the bad column employee has hired more of his bad column friends into the company. Now all that remains at the company is a mixture of people.

Or maybe it is a lot worse for the good column director and the company is now predominatly bad column and it is only a matter of time before the good column director gets thrown out of the company.

Please bear in mind that all of the scenarios I have described above can equally apply to the bad column category people as well, just swap the words “bad column” and “good column” and read it again, you get the idea.

It is also important when talking about these bad column and good column categories of people that I am not talking about superficial personality traits that people have picked up but I am talking about the way in which people are born.

The bad column category people and the good column category people have additional traits other than the references they give that define them as bad column or good column. It is something more fundamental in their make-up which leads the bad column category people to give bad references and the good column category people to give good references.

For example you may occasionally get a bad column category person pretending to be a good column person and giving out a good reference but this would be unnatural for the person and at heart he may believe differently. He has not given the good reference because he believes it but to gain something for himself.

So going back to this “ideal” solution. Would not the ideal solution be then to have companies that consist of wholly bad column category people and companies that consist of wholly good column category people?

If you are director of a company and you are a wholly good column category person why are you employing bad column category people?

If you are director of a company and you are a wholly bad column category person why are you employing good column category people?

Is the ideal solution to simply have a company of your own category people?

What about your clients? If you are good column company director would you take on clients that are in the bad column category? If you are a bad column company director would you take on clients that are in the good column category? If so why?

This is not about “firing people” or “getting rid of people”. Although I believe a lot of this goes on, a good column category manager gets promoted and decides to fire a few bad column category people and vice versa.

It is about dealing with issues where they matter most and that is at the front door of the company. There is no point in either bad column or good column letting in their opposite and then sit their whining that this opposite is spoiling it for us.

The company must have a director and the director must fit into one of the categories described above. As the company director it is the company directors responsibility to ensure that only his / her category of people are given jobs in the company.

Ahh well, our company has 2 directors, one in the bad column category and one in the good column category. Yes, exactly, this sort of partnership should never have been formed in the first place.

Why would anyone in the good column category want to be surrounded by people in the bad column category? Why would anyone in the bad column category want to be surrounded by people in the good column category?

As the company director you had the chance to create your personal Utopia and not have anyone spoil it for you. So why let in a bunch of people from the opposite category?

As stated earlier it is not about someone climbing the corporate ladder and firing those in the opposite category because he or she does not like them.

It is more about those of a particular category not employing the opposite category in the first place. Do not employ the opposite category, do not have the opposite category as your clients.

Alternatively you could divide the company into good column people and bad column people and put them in seperate teams. Have the good column people deal with good column clients and the bad column people deal with bad column clients.

If you want positive references and reviews why work with someone as a client or employee who is going to give you bad references and reviews? Or as a bad column company employer why would you employee a good column employee to then give them a bad reference from which they will start touting their opinions on websites like Glassdoor?

How many more Glassdoor reviews are we going to hear about “revolving door” companies with high staff turnover or firing people over not being a “cultural fit”.

Yes the bad column or good column category person may have accepted the job at the predominatly opposite category company and it turned out the person was “not a good fit” but whoes fault is that? In my opinion it is the solely the employers responsibility.

The employer knows the state of his / her company, he knows which category he / she belongs to at heart. Why employee the opposite?

This is not a matter of pity or feeling sorry, a good column category person rejecting a bad column category job applicant warrants no pity, ohh poor bad column category person has been rejected for job, look the bad column category person can go to companies that are operated by bad column category people, he / she can get bad column category people as clients, he / she can be invited to parties that are hosted by bad column category people, he / she is friends with other bad column category people, yes, he / she has friends can you believe it, yes and bad column categories friends are bad column category people so what place does the bad column category person have in your good column category company anyway? Vice-versa.

You can only lose a job if you have been given one, well in this ideal you would not lose your job because you would never have been given one in the first place. At least not in a company of your opposite column where you would not fit anyway.

So for the people out there saying “getting fired was the best thing that happend to me”. Well it may have been in that instance for you personally. This was probably due to moving from a bad column person company to a good column person company.

Note that if you got fired from a bad column person company and move to another bad column person company then it is unlikely that your situation will get any better in terms of the firings and job references they give you.

Chopping database records

I have been working on a project recently for a client which required the user to insert a record into an existing set of records and to modify those existing records to accomodate the new record.

The above diagrams shows what needed to be accomplished. If you imagine from left to right is time on the diagram, each record has a start date and and end date and the new record is needing to be inserted between those start dates and end dates.

The start and end dates can overlap the start and end dates of the new record and this is where the existing need to be chopped and modified to accomodate the new record.

So how did I go about this?

Firstly I decided to bucket the existing records into categories as follows …

And like …

This gives us four actual categories and a fifth “Ignore” category. The four actual categories are LeftRight, Middle, Left, Right. Some more examples are shown below …

The bucketing of the existing records into categories from a coding perspective is accomplished as follows …

Firstly I selected the existing records, pseudo code shown below …

dateStart = new record start date
dateEnd = new record end date
dbDateStart = existing record start date
dbDateEnd = existing record end date

Other columns could be added to this selection code if needed, in some cases a “user_id” or other foreign key could be potentially needed.

Using the above selection code will select all the existing records that exist within the range of the new record start and end dates. In other words the records that fall into the “Ignore” category will not be selected.

This is why the “Ignore” category is not a real category as the records are never selected and thus do not need to be bucketed.

Now I have selected my records from the database I put the records into a loop. Whilst in this loop I bucket the records into a set of arrays using the following conditions …

LeftRight …

Middle …

Left …

Right …

Now that the records have been bucketed into the arrays I loop through each group and process the groups seperately as follows …

new record = the new record you are wanting to insert into the DB via displacing the current records
original records = the record in the LeftRight bucket that has not been cloned

LeftRight …

I take a clone of the record and I modify the original (none cloned) records date end to be the new record date start -1 day this is then saved. I then take the clone and set the date start to be the newly inserted records date end +1 day this is then saved.

Middle …

Any middle records are deleted.

Left …

I modify the records date end to be the newly inserted records date start -1 day this is then saved.

Right …

I modify the records date start to be the newly inserted records date end +1 day this is then saved.

After all of the bucketed records have been processed there should now be room to insert the new record so I insert / save the new record.

So that concludes how I created a system that would allow a new record to be inserted whilst chopping the existing records to accomodate the new records.

Agency vs freelancer my opinion

So I read a lot of articles online about “Agency vs freelancer” the subject of the article being from a client point of view which is best to go with in terms of completing a project successfully.

Sometimes I read the article on a general web development article website which is fine. However sometimes I read the article on a web agencies very own website.

I have possibly written similar articles in the past on this website which I have now deleted and let me tell you why in my opinion it is not a good idea for multi-employee agencies to post articles like the above in their blog.

So let us be honest the article is intended to big up the agency whilst making the freelancer look like a bad choice. This is the fundamental intent of the article and that is why it was posted to the blog in the first place.

Whilst on the surface the article seems to do this there is another underlying tone to the article in my opinion which communicates a different message.

The message it communicates is that the agency views the freelancer as the competition. Writing “Agency vs freelancer” or similar as the article the agency has automatically created the freelancer as the competition. This massive, cutting-edge, leading agency views this small, tacky freelancer as the competition?

This is similar to say Rolls Royce viewing themselves in competition with Ford. Ford does not lose any sales to Rolls Royce and Rolls Royce does not lose any sales to Ford, they are at completely different ends of the market.

The article can give an impression that is at odds with the articles intended purpose.

Having said all this I will also say that there is one other area I will mention in relation to articles such as the above.

Many of these articles attempt to portrait that an advantage of going to an agency is that you get a “team” of people working on your project vs the 1 person freelancer working on your project.

The way this is generally written in the article tends to try to give the following impression …

Freelancer hourly rate = £50
Agency hourly rate = £100

Wow, I am getting a full team of people working on my project rather than the 1 person freelancer for only double the price.

Errrrmmm, not quite. You see that is £100 per hour. So for an agency of 8 people that will cost you £800 per hour. The result is more like as follows …

Freelancer hourly rate = £50
8 person agency hourly rate = £800

You are still paying by the hour no matter what way you look at it. You just happen to be paying double per hour in the above example to have 1 person work an hour for you from an agency.

Let us face it, freelancers have contacts as well and I am certain that if you where willing to pay the freelancer £100 an hour it would not be very hard for the freelance to get some external resources into the project himself thus forming a mini-agency.

Infact you could have just given the freelancer the break he needed to expand his business himself into an agency.

Internal system – Toolkit

I have been using a web based product called ActiveCollab for sometime now …

https://activecollab.com

I have been using ActiveCollab since version 4. When ActiveCollab 5 was introduced it had a complete redesign, less features and a more slick user interface.

More features have been introduced to ActiveCollab 5 though since it was first released.

ActiveCollab is a project management system that also handles Time Tracking and Invoicing plus more.

I will continue using ActiveCollab for projects / task management however for other areas of my business I have created my own internal tool which I have named “Toolkit”.

I built my own system because I wanted a system that would do the following …

Estimate earnings
Fixed fee and retainer projects are entered into the Toolkit. The Toolkit can then estimate monthly and yearly earnings based on the projects entered. The projects also includes a way for me to manage all the projects I am working on.

Incomings
The Toolkit has an area in which all incomings can be entered. The incomings can then be exported in a format appropriate for my accountant.

Outgoings
The Toolkit has an area in which all outgoings can be entered. The outgoings can then be exported in a format appropriate for my accountant.

Mileage
The Toolkit has an area in which all mileages can be entered. The mileages can then be exported in a format appropriate for my accountant.

Leads
The Toolkit has an area in which leads can be managed. I actually pulled this area out of the Neptune – Lead Tracker – http://www.neptuneleadtracker.com software system.

CRM
The Toolkit includes an area in which all the companies and people I have worked for can be managed. ActiveCollab does actually include this feature but the Toolkit version allows more advanced search features and has fields on the create / update forms to match my exact needs.

Timetracking
The Toolkit includes an area in which all time entries can be tracked. ActiveCollab does have this feature.

Invoicing
The Toolkit includes an area in which invoices can be created. Invoices can also be generated from time entries. ActiveCollab does include this feature but the Toolkit version matches my exact needs precisely.

Notes
The Toolkit includes an area to keep notes. ActiveCollab does include this feature.

Files
The Toolkit includes an area to upload files. ActiveCollab does include this feature.

ActiveCollab has a more slick, beautiful user interface but in terms of functionality built specifically for myself obviously the Toolkit wins.

The Toolkit is primarily made up of CRUD screens, no fancy UI / Ajax heavy screens here. Just datagrids and buttons.

I am in the process of live testing the Toolkit I have built and will be moving various functions of my business over to the Toolkit.

What is happening? – general update

I thought I would dedicate this post to informing you of what I am doing right now …

Work
I am currently in a contract with a client at the moment with a rolling end date which means the contract extends indefinitly until I am not needed anymore by the client.

The company I am working with is an agency that creates web based software for their clients. I am currently designated to working on 1 of their projects with another developer who is also a contractor.

I remember when I first started there was a lot of “scare” factor about freelance dry periods and how work can be hard to come by. Looking back over the number of years I have been freelancing I can safely say this has never been a problem.

Yes there has been short dry periods between contracts but another contract always comes along in the end. I treat the short dry periods as my holiday time like regular employees would book their holidays off I have my short dry periods.

It must be mentioned though that in the dry periods I also dedicate a couple of hours each day to looking for new work. Generally what happens is after a number of days a pool is formed of potential leads which gets filtered down into potential actual contracts I could take on.

Like I say, getting work has never been much of a problem. Getting high paying / decent work is a little harder but still not much of a problem.

Infact I was thinking the other week that if I had someone looking for work on a full time basis rather than just me doing it a few hours a week in my dry periods. There would actually be enough work generated not only for me but enough work to grow my business.

The reason I have not done this yet is because I would want the person who is finding the work i.e. my potential business partner to be well known by me and most of my well known collegues already have jobs and they would not be willing to take this chance with me.

Secondly although I am a one man business I am actually quite alright just as I am. I can get the work for myself and provide myself with a reasonable income.

To all the new freelancers out there I would say do not be afraid of finding new work but note that the work might not always be with direct clients.

Sometimes to get work you may need to go to other agencies that act as middle men and sometimes you might need to consider taking up “real” contract jobs i.e. short jobs that are advertised on job boards by job agencies related to your area of expertise that pay a high day rate.

Contract jobs can be treated like projects. If a business is willing to pay you a high day rate for a period of time. Take the day rate and times it by the number of days you are contracted for, that is the value of the project.

Neptune – Lead Tracker
So whats the deal with Neptune? A number of months ago I posted some posts about the Neptune project and the progress I was making on it. Then I released a post telling everyone Neptune was released.

Neptune can be found at …

http://www.neptuneleadtracker.com

Neptune was originally released as a paid product due to lack of sign ups and a need for a user base to use the product and provide feedback I decided to get rid of the paid plans and just have a free plan. Anyone can now sign up and use Neptune for free.

In short, Neptune is currently in a holding area at the moment. It is functioning product that allows you and your team (it is multiuser) to keep track of any leads you might have. My intent is to have people sign up to the free plan and use the product.

This initial user base can provide feedback on the product and have some say as to the direction Neptune will take in terms of its next features / functionality.

I could keep adding features and improving Neptune myself to turn it into a fully featured product however my thoughts are if people do not use the basic version why would they use the none basic version.

Potentially I know it is possible people would use the fully featured but not use the basic product however it is a big time investment to build the fully featured and then not have people use it.

So I have decided to stick with the basic product for now and see if people use it. If people start using it then I can dedicate more time to it as needed.

Czech Character Code Converter
I created the Czech Character Code Converter because a client of mine had a Czech language version of its flagship product. I was given blocks of text in Czech that needed to implemented within the system.

The blocks of text needed to have the Czech characters converted to their respective characters codes to be implemented into the system so rather than convert each character manually by hand I built a small script to do it. I then gave the script a user interface and uploaded the script online.

Czech Character Code Converter can be found at …

http://www.czechcharactercodeconverter.com

The script saved me a lot of time. Although the script is small and simple I have no intention of expanding the script any further and it is considered a completed project. If anyone has any ideas on how to improve it I may consider implementing the ideas but other than that no improvements will come of it solely from my perspective.

King of Adem
King of Adem the latest project to hit the project list and born out of my wanting to learn IOS development. This is a huge project and I only have part time hours to dedicate to all my side projects. King of Adem along with learning IOS could take up to a year to build and in truth the King of Adem project was probably too large a project to attempt to learn IOS development.

I want to build King of Adem and I want to learn IOS development. Both of these can be done seperately or they can be done as one project. I could learn IOS development and do a simpler project whilst still building King of Adem in the background. Alternatively I could incorporate my IOS development learning into the King of Adem project because part of the King of Adem project requires an IOS application.

Most likely to happen is the following …

I will learn IOS development as my primary goal and develop King of Adem as my secondary goal. I will learn IOS development by following the video tutorial course I have downloaded and taking on a simpler IOS project to enhance my development. The King of Adem will take a secondary position to the IOS development learning until the IOS development learning is complete then King of Adem will take the primary position.

Essentially both projects will still be happening at the same time but the IOS development will have more time dedicated to it at the start until complete then the King of Adem will get the most time dedicated to it until complete. As a rule it I will split it 75% / 25% in other words 75% will be spent on the IOS development learning project and 25% on the King of Adem project. After the IOS learning project is complete King of Adem can have 100%.

That sums up what is happening in my business right now. I hope this article ties up any loose ends anyone might have about the projects I am working on. It has certainly helped me clarify where I am with each project and what I intend to do with each project.

King of Adem – progress update – building queue

Progress has been made on the King of Adem project. For those of you not familiar with this project please read the original King of Adem post at …

http://www.jamesbarnsley.com/site/2017/08/13/king-of-adem/

Since the update I have been primarily working on the building queue. The building queue is the queue which buildings get inserted into when a player wishes to construct a building in one of his / her regions.

To get to the construct building screen the user has to be in one of his / her regions so those areas to get to that screen had to be part built.

The areas part built are namely user, game, region and building. Once on the construct building screen the user can select from a list of buildings that can be constructed.

Each building is validated on a case by case basis and if it does not pass the validations the building cannot be constructed, here are some of the validations so far …

Check fund available
The player must have the correct amount of fund available to construct the building. The amount of funds available is the players start of turn funds subtracting any funds that have been used in the current turn.

For example player may have started with 1000 coins, if a player constructs a building for 300 coins then the program gets the players start of turn funds but substracts 300 coins because it knows a building worth 300 coins was requested to be constructed this current turn.

Check building queue full
The building queue may only allow so many buildings to be in the queue at any one time for each region. Currently this number is set at 5 and the number is stored in a config file.

Check building already built
Check if the building has already been constructed in the region. Each building has a “constructionLimitPerRegion” variable which stores the number of times that particular building may be constructed in each region.

Check dependent buildings constructed
Each building can have what are called dependent buildings. These are buildings which need to be constructed first before you can build the current building.

Also the validation knows whether a building is an upgrade of an existing building or a completely different building that just happens to depend on another building being constructed.

All kinds of checking had to be implemented for this validation, whether building is an upgrade / dependant or just dependant, whether advanced tier buildings already exist for lower dependant buildings, whether lower dependant buildings already exist etc.

Check advanced tier building exists
Check if an advanced tier building already exists for the current building wanting to be constructed. If the advanced tier building already exists then there is no reason to build the current building.

Again this needs to take into account that some buildings can be constructed more than once so in some instances it may need to allow the building to be constructed even though the lower building has already been constructed.

The above validations are run everytime a user issues the command to insert a building into the building queue for a particular region. These validations are run from the “Building” Model. Each building is also given its own Model, the hierachy is like as follows …

\yii\db\ActiveRecord -> \app\components\ActiveRecord -> \app\models\Building -> \app\models\BuildingTownBarracks

Or …

\yii\db\ActiveRecord -> \app\components\ActiveRecord -> \app\models\Building -> \app\models\BuildingPort

etc.

I can run special validations for specific buildings by placing those validations in the specific building class. Those validations will only run for the specific building and not all buildings.

That is as far as I have got so far. Still a long, long way to go, more updates to come soon.

King of Adem

The latest personal project I am working on which also happens to be the largest personal project I have worked on so far.

King of Adem is a game for tabletop minature wargamers. Players manage their kingdom through the app. Kingdoms consist of a number of a territories, each player starts with one.

In each territory there is a capital city in which buildings can be constructed. Buildings provide benefits like more money or the ability to recruit armies.

When 2 armies collide by moving into each other the players can then resolve the battle as normal by playing their normal game of tabletop minatures.

The game takes place on an island called Adem. Adem is a recently discovered island where each player is fighting for control. You fight to become the “King of Adem” by conquering the whole island.

Although Adem is stated as “recently” discovered, this only means “recently” in the grand scheme of things. Adem actually has a number of Kings / Factions already on the island and each Kingdom has some infrastructure.

The project is currently divided into 3 parts …

King of Adem Diagram

Part 1 – Game Server
The Game Server is currently in construction and is being developed using the Yii 2 framework written in PHP. The database is MySQL. The server takes view requests and command requests from the client application.

View requests provide data to the client in JSON format. This data has everything needed to render views for the game for example, building, army, territory data.

Command requests provide data to the server about interactions happening in the client application. For example move commands, construct building commands etc.

The decision to use View / Command requests was chosen instead of opening the server up entirely.

Essentially one option could have been for each Data model on the server to have a view, insert, update, delete request to use for either commands, views or both.

This would give the client more freedom at the cost of putting more logic onto the client.

As the first client is being developed using IOS and IOS uses a view per screen type of structure then View requests make sense. Giving the client the exact data the client needs in order to render the view.

Part 2 – Game Test Client
The Game Test Client is currently being developed alongside the Game Server and serves as a testing ground for the development of the server.

The Game Test Client can send View requests to the server and read / present the data from the server in a user friendly way. The Game Test Client can send command requests to the server.

The Game Test Client is being developed using the Yii 2 framework written in PHP. The Game Test Client is my own personal client for testing the server and is not the actual client the end user / player will be using.

Part 3 – IOS Game Client
The IOS Game Client is the actual client the end user / player will be using to play King of Adem. The IOS Game Client as you might have guessed will be an IPhone application. There may also be the ability to run the application on the IPad as well.

I decided to develop the IOS Game Client because I wanted the game to be portable and it cannot get much more portable than having the game on your phone.

I also choose the game to be an IOS application because I want to improve my IOS skills and offer IOS development as part of the everyday services I offer to my clients.

Once these 3 parts are complete the game will be playable and released to the public. Part 1 and 2 are already in construction, Part 3 will be constructed after parts 1 and 2 and completed.

After the game has been released to the public, a number of other client applications could potentially be developed including an Android version and a full game client developed in Unity3D or similar.

The IOS client will be more management like as opposed to a graphical game. The IOS application could include graphics etc, but it will not be at the level of a full game like experience. This is why I suggest a later developed Unity3D or similar game engine development.

I will be keeping everyone informed of the development of this game through the blog so keep checking back for further updates.

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

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.

Some afternoons could be spent doing group activities whether work related or fun related.

Also note that the above idea is not 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 get around 5 days off work.

Lunch around a big table together

Have the whole company eat lunch together every working day 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.

Every 3 months have an employee activity day

Every 3 months arrange for there to be a fun activity day such as paint balling or some other group fun activity.

Have an open culture

Set the tone of the workplace as a place where people can ask work related questions of their teammates. Work related mistakes should not be jumped on but merely highlighted in a nice way.

These are the points I would implement in my business if I owned a multi employee business. Not all the points would have to be implemented but the more points the better. I would only apply these rules if the staff where regular employees, the rules would not be applied to contractors. 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.