Rescue Operations (Using Someone Else’ Code)
What is a Rescue Operation?
So what is a rescue operation? Is it rescuing someone from mortal danger? Is it rescuing someone from an enemy that kidnapped them? Well yes! That is what a rescue operation is! Operations or organized procedures to bring people or a person out of danger, attack, harm, etc.
BUT! The sort of rescue operation that I’m talking about is different. It’s the sort by which a developer understands and uses someone else’s code to develop something!
Many a time it has happened that we come across a project that requires us to use someone else’s code. When that happens, the lights go out, the cold sweeps in, you can feel shivers run down your spine, your heartbeat races, someone screams, Lord Voldemort Returns, Darth Vader is also the mother of Luke Skywalker! (Yes, I said mother ‘cause it’s absurd!)
ALL HELL BREAKS LOOSE!
Using someone else’s code
When using someone else’s code there are a number of things that you need to make sure are provided to you. Make sure that the previous developer has a document, video, or a guide of some sort that would help you with understanding their code in a convenient manner.
In the past, we’ve had to work with numerous clients who would provide us with code that was so long and complicated that Rapunzel would feel insecure about the length of her hair.
Trust me! We’ve had to spend countless hours in just understanding a code that could’ve been written in a very VERY easy way!
And sometimes there have been clients who have provided us with codes that are AH! So simple and easy that our developers wiped a tear or two when they were reviewing the code before working with it! *Wipes a tear*
My apologies… GOD bless the souls of those who provide cleaner codes!
So how do you tackle these issues? How do you work with the code that is not yours and is difficult or easy?
Well, there are a couple of things that you need to keep in mind when working with someone else’s code –
- Make sure that you take your time to review the code.
- If you know what the purpose of that code is then all you need to do is to skim through the lines and see where the important lines are! For example;
If the purpose of a code is to make the character jump and then land and do some damage to the ground then all you need to do is look for the line that allows the player to jump.
Next search for the line that shows how it allows the player to jump. How it performs that action.
And so on…
- Then you need to figure out how the entire code is organized and if modularity is there or not.
- Understand how that person writes their code and how they solve their problems. This would allow you with understanding the code a bit better since you know the coding style of that person.
- The code should be skillable, meaning that adding new characters should be a relatively easy task. The code should be skillable so that the developer can add new characters by inheriting the existing characters’ code for the new character. Just copy and paste and add a couple of lines of codes here and there.
- The entire body of the code should have consistency, it should be written in an easy to understand way. Like water, it flows continuously and if someone disturbs that flow then the entire flow becomes agitated.
- READ, CONCEIVE, CODE, REPEAT!
Problems with using someone else’s code
The main problem that comes with using someone else’s code is understanding that code when it’s not written in an easy and simple way.
See, when a code review isn’t available it gets harder and you spend more time than you would usually do to understand that code.
Sometimes there isn’t a proper guide available that would function as a proper walkthrough that would guide the developer through the code and would provide them with a proper understanding of what purpose every line of code serves.
There isn’t any modularity that would make the code easier to read. What is modularity you ask?
Well, a module is basically a software design technique that organizes your code by separating the functionality of a program into independent, interchangeable modules, in a way that every module contains everything that is necessary to execute only one aspect of the desired functionality.
When modularity isn’t present in code then the code becomes a mess. Nothing is clear, the code doesn’t make sense.
It consumes a lot of effort and time to know where the functions lie and which line of code serves what purpose. Sometimes your last resort is to copy an online solution which is someone else’s code, to make it work.
Whether you provide a proper guide for your code or not, the next developer will have to work with it. They are asked to just do it. So how do you make sure that this doesn’t happen? That your code is easier to understand?
CODE REVIEW! But… what is code review? How can you pass on the torch to another developer? What can you do to make it easier to understand?
How to solve this disaster?
By providing a proper thorough walk-through of the code. By adding modularity to your code which would divide your code into functions that would be a real blessing and a gift for the person who’s reviewing your code!
So what makes a code good, okay, bad, and un-usable?
Good code is one that is easy to understand and has a code review available. This means that before passing on your code to someone else, make sure that you have a detailed document, video, or a guide available that would help the person understand your code and use it like it’s their own!
Also, this code has Modularity, proper use of Spacing and Indentation.
Okay code is one that is not as easy to understand as the above-mentioned code. This means that the document, video, or guide that is available to help understand the code, is either rushed or not a lot of attention was paid into composing them.
An okay code takes time, more than usual, to fully understand and work with. One or two things from Modularity, Spacing, and Indentation might not be used in this code
Bad code is a code that is just bad. The code is all jumbled. There’s less use of spacing and indentation and modularity. Little to no attention or respect is paid to how the entire code is written!
Un-usable code is just a disaster. It’s straight-up un-usable! It’s like the person who wrote the code hated you and your entire family and wanted to cause as much suffering as they possibly can. The entire thing is a tragedy.
Imagine putting 5 to 6 earphones in your pocket and then taking them all out at once after a couple of hours. Now you gotta separate them! That’s how bad this code is.
There’s no document, video, or guide available that would help someone else to understand. The entire thing was written as an essay with no concept of what modules, spacing, and indentation are.
What have we done…?
The thing is I am forbidden to kick names and take ass :/
So what I’m gonna do is tell you what we’ve done without telling you the name of the project and the client. ‘Cause we take our secrets to the grave!
The first project that I’ll talk about was for a Mobile Game.
The code for that game wasn’t what we expected. It was handed to us from two different studios and when it reached us we were blown away by how bad that code was written.
The entire code was a complete train-wreck since two different studios had worked on it.
And so there were two completely different coding styles. They’ve used different methods of implementation! And the Code-base was passed on to us in pieces.
And what’s worse! THEY HADN’T PROVIDED ANY CODE REVIEW!
So our developers had to sit for a week just to understand the entire code and its functionality! They had to work over-time to get the entire thing organized and separated into modules.
After a painstaking week, they finally got it working.
But the next stage in their struggle was to optimize the entire code. They had to resolve the bugs and errors that existed in the code that was passed on to them and also fix their own code accordingly.
It was difficult but they overcame all the obstacles and made then entire thing work!
Our developers were Legends that day!
The second project that I’ll talk about was a turn-based strategy game. We had to port the game.
The problem with this project was that even though they provided us with the Code Review, we had trouble balancing the characters and their powers and skills since we had to do this from scratch.
And we had to make sure that porting the PC controls and adding a Touch Input Manager for Mobile was done perfectly without any errors.
The project required A LOOOOOOT of back and forth communications and tons of iterations.
Which cost the client and us a lot of time.
But once AGAIN we emerged as winners and we did what was asked of us and the client was happy and if the client’s happy then we’re happy ^_^
The third project that I’ll talk about was a 2-D Puzzle Game. This project could’ve gone a lot better! Since the client’s developers and our developers were ‘working together’.
The problem was that wasn’t any proper communication. They forgot to lock the flow before working on a piece of code. We weren’t informed and things got messy, why?
Because WE WERE WORKING ON THE SAME PIECE OF CODE!!
Since we were told what to work on, we thought that we were the only ones working on it… but we were wrong.
We then had to use GitHub to solve the entire problem and then had to solve the issues and errors that were caused by two entirely different codes getting mixed up for the same function.
Then we made sure that our developers and theirs had proper communication before working together. Both parties then informed each other and locked the flow before working on it.
Which then resulted in both the client and us saving a lot of time and headache.
BUT!! Ultimately, despite figuring out the issues, the client’s prospective Publisher passed on the project…. Can’t win them all
The final project that I would like to talk about was an FPS. Oh boy… here it goes.
This project had a lot of ups and downs. The assets and the code were provided to us.
But the issue was that again we were told that we’d be working on this project alone. We had our deliverables and our milestones set. Everything was perfect… but we were wrong.
The client had a developer and he was working on the same thing that we were working on. We wrote the entire code for a certain function and then when we sent it, we were told that the code wasn’t working. Heads were scratched
We didn’t know what was wrong. We tried the code on every PC, and laptop, that we have (and we have a lot of them).
It was working smooth as butter for us but it wasn’t working for the client. What could’ve gone wrong…?
And then we got on another call with the client. We asked them if they had someone else working on it? The reply that we got a collective sigh from all of us.
But we figured out what went wrong. See the problem was that the other developer was merging our code with his code and was trying to make it run, which doesn’t work.
And another issue that arose was that the client wasn’t usually available for communication. So we rarely ever had the chance to get on a call for a Code Review.
OH! And speaking of Code Review! The good thing was that they had provided us with a Code Review before they passed the assets and the existing code to us.
This was very helpful and we are very grateful for it! ^_^
In the end, we got the work done. The game is still in development and the work is being done ever so smoothly. <3
That’s all, Gamers! Until next time, PEACE!!
Do YOU have a similar experience that you would like to share with us? Or would you like to challenge our developing skills? Hit us up!