1

My colleague and me are both working in a MVC system on the same controller. Problem is that we can't edit the same file at the same time because we're overwriting each others changes.

Is there a way to include methods into a class using the include() function?

Basically I want three files, controller.php his_file.php and my_file.php

Jeffrey
  • 1,985
  • 1
  • 12
  • 21

2 Answers2

6

U need a Versioning System like SVN to handle this conflicts and code loss or need a centralised system where you and ur colleague must place code after taking the latest code from each other, thats what versioning system do generally... you dont have to add any extra code load to acheive what you need this which would be again a bad practice.

As a single user the main advantages are

  1. Automatic backups: If you accidentally delete some file (or part of a file) you can undelete it. If you change something and want to undo it, the VCS can do so.
  2. Sharing on multiple computers: VCSes are designed to help multiple people collaboratively edit text files. This makes sharing between multiple computers (say your desktop and laptop) particularly easy. You do not need to bother if you always copied the newest version; the VCS will do that for you. Even if you are offline and change files on both computers, the VCS will merge the changes intelligently once you are online.
  3. Version control and branching: Say you published some class notes as a pdf and want to fix some typos in them while simultaneously working on the notes for next year. No problem. And you only need to fix the typos once, the VCS will merge them to the other versions.
  4. Tagging.
  5. Working with collaborators even if they don't have the VCS themselves. I can make a branch copy for my collaborator on my own system and simply copy in their corrections to that each time, then merge them into the main branch as if they'd been using the VCS all along. Keeps the advantages of using version control but without requiring all collaborators to use it.
  6. Maintaining different versions.
OM The Eternity
  • 15,694
  • 44
  • 120
  • 182
  • SVN could work for us, but we would like to edit the same controller at the same time and have our SFTP program upload it automatically. That's why I ask. But I guess I'll have to figure out another way. – Jeffrey Mar 07 '12 at 10:15
2

If you have multiple people working on the same files you will want to use a revision control system like SVN, GIT, Mercurial or even CVS and then merge changes at the end of the day:

Revision control, also known as version control and source control (and an aspect of software configuration management), is the management of changes to documents, programs, large web sites and other information stored as computer files. It is most commonly used in software development, where a team of people may change the same files. Changes are usually identified by a number or letter code, termed the "revision number", "revision level", or simply "revision". For example, an initial set of files is "revision 1". When the first change is made, the resulting set is "revision 2", and so on. Each revision is associated with a timestamp and the person making the change. Revisions can be compared, restored, and with some types of files, merged.

As for

Is there a way to include methods into a class using the include() function?"

see my answer to

Community
  • 1
  • 1
Gordon
  • 312,688
  • 75
  • 539
  • 559