A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2008 yearchanging a class name throughout a development - page 1
User InfoPosts
changing a class name throughout a development#1
I'm in a situation where I have the class "progress" - trouble is that I'm interested in incorporating some open source that also has the class "progress". I remember very vaguely some reference to an app that's able to inspect the various files in a development for a given class name ... and either return it ... or change it. Have you experience of this?

thanks

posted date: 2008-12-15 12:39:00


Re: changing a class name throughout a development#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2008-12-15 12:39:01


Re: changing a class name throughout a development#3
Many IDEs (e.g. Eclipse) can do this, but it's more common for Java then PHP. Because of the dynamic nature of PHP variables, it's a little harder for IDEs to know exactly what to change. For example, you could do this:$name = "prog";$name .= "ress";$cls = new $name();The IDE would have to actually run your app to know that $name contains "progress" at that particular moment. Even then there would be no way to automatically fix it.So sadly, you're stuck with find-and-replace. Don't worry though; changing class names during development is a good thing. It forces you to re-think exactly what the class is for.

posted date: 2008-12-15 12:44:00


Re: changing a class name throughout a development#4
Some languages (C++, C#) have a notion of namespace. Java has packages. Python has modules. They are desgined to prevent class name collision. Assume you're talking about Java, the Open Source class called "Progress" probably is in its own package, and your "Progress" is in your own package. So maybe you are not having a problem as you thought you do.Having said that, I'm guessing you're asking about a feature in an IDE which is called refactor that would allow you to change your class name everywhere that refers or has dependencies on it.

posted date: 2008-12-15 12:48:00


Re: changing a class name throughout a development#5
Always prefix class names with the product/project abbreviation. Why not use TextPad to replace all occurrences? That way you won't be confused in future which class it is. I would also recommend using namespace/package technique but that would make you rewrite a lot of code I assume.http://en.wikipedia.org/wiki/Code_refactoringThe above link has a some tools used for refactoring.

posted date: 2008-12-15 12:57:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.