Jump to content
MakeWebGames

Military Game For Sale


gamble

Recommended Posts

Ok then I will.

MVC - Model View Controller. A project structure that's designed to separate logic (the model) code from view code (the view). The controller binds the two together.

The idea is that the model serves the data to the view which then takes this data and displays it to the user.

However, CodeIgniter, whilst you may think it is an MVC framework falls short of this definition, as the view and the model are not blinded in such a way that when the data updates the view also updates.

CodeIgniter is a wonderful php framework , but realistically, it can't be MVC because it focuses purely on backend development. PHP and therefore CodeIgniter is not a front end language although it's files can be parsed and served to a client machine.

Take a look at the discussion here:http://stackoverflow.com/a/13821880

If you want something that matches the MVC idea more closely, take a look at Angular. It implements an MVC framework. It takes the data it receives from the server and binds it to the view. When that data updates the view automatically updates. CodeIgniter can't say the same, you need to use some form of JavaScript, to allow this functionality.

If a templating engine is used with CodeIgniter then the view code and the logic code can be well and truly split which makes for a great project structure. It makes it easily maintainable and scalable. But it is not a true MVC framework at the core of its definition.

I'll talk further now about CodeIgniter.

CodeIngiter is a great framework for developing large scale applications because it provides many useful libraries and helpers out of the box, eg. The database and session library, the email and url helpers.

CodeIgniter has QueryBuilder built in to it which can make querying and updating the database a lot more maintainable and slightly more secure as it automatically binds parameters.

CodeIgniter allows you to create you're own libraries, a collection of like minded methods and variables, a class of such, to use wherever needed throughout your app, and to do so in a more maintainable way.

To load a custom library when you need it, you simply write:

$this->load->library('library-name');

Or if it's a library that will be needed frequently you can set it to autoload by defining it in the autoload.php file in the config folder.

A helper is a bunch of functions/methods that aren't stored within and act upon the same class but rather can be used similar to php's own global functions to perform actions that you may require.

For example if you store only the millisecond time of events within the database you may want a helper that you can use to convert this to a nice displayable time, rather than simply a string of numbers that is quite hard to understand.

What I'm getting at here is that for Militar RPG, gamble extended the core Model file, to create his own and shoved every single method he may need and even ones that should have been redundant into it. It was bloated beyond belief with a mix of too many different minded methods.

If it was designed properly, these methods should have been grouped together and placed either in their own library or helper file and loaded whenever needed.

He also defined a brand new database connection, using PDO, and stored this database connection within the very same Model file he extended.

You may think there's nothing too bad with this, and realistically there isn't, but why reinvent the wheel. CodeIgniter has a database wrapper class which includes an option for PDO, so why not use the built in functionality of the framework that he had decided to use, rather than defining new variables and connections.

He had a good idea to decide to use a framework, but a lot of work needed done or would need done to make the code maintainable and easy for a newcomer to pick up and understand. Even experienced developers questioned why the hell certain things were done the way they were. There's no need to reinvent the wheel and some of the methods and files were overkill, and with next to no comments, or when there were comments it turned out the code was copy and pasted and therefore the comment had no relevance, it took a good two weeks of constantly working with the code to try and get any form of understanding of how the code worked.

The worst part is definitely the storing of multidimensional arrays where he creates a string of pattern:

"id=qty,id=qty"

When in fact he should have and could have simply used the built in serialize() and unserialize() function that comes with php. It would have saved a lot of headache and performance because all the arrays wouldn't need to be constantly looped over until the string was formed or parsed.

The game itself should have been enjoyable but it was extremely easy to run out of things to do very quickly.

Gamble, unfortunately I know this game was your pet project and you didn't have time or whatever to complete it, but coding standard wise it's far from great. You have a habit of using the hardest methods possible to do things that don't need to be made difficult. Not everything needs a complex algorithm.

Link to comment
Share on other sites

Guys... Could you go measure them elsewhere? [uSER=70578]CodingKid[/uSER] can you shed some light on the earlier question?

 

He asked me if I would be able to set it up for him, but I didn't find it worth the botheration so I'm not too sure if he's going to try do it or not.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...