module name == class name?

A

aidy.lewis

Hi,

I use the open-source automated functional test tool: Watir. In each
class I hold methods relating to a specific HTML page. To avoid any
name conflict, I think I should be wrapping each class within a
module. Is it good form to have a module name that equals the class
name.

e.g. module Login
class Login

end
end ?

Thanks

Aidy
 
T

Tim Pease

Hi,

I use the open-source automated functional test tool: Watir. In each
class I hold methods relating to a specific HTML page. To avoid any
name conflict, I think I should be wrapping each class within a
module. Is it good form to have a module name that equals the class
name.

e.g. module Login
class Login

end
end ?

If your Login module only contains one class and nothing else, then
you should remove the module and use only the class. You will still
have the naming conflict if you should want another Login class.

A different approach would be to encapsulate all the classes related
to a particular website in a module.


module MyWebsite
class Login
end

class UserInfo
end

# etc.
end


Blessings,
TwP
 
A

aidy.lewis

If your Login module only contains one class and nothing else, then
you should remove the module and use only the class. You will still
have the naming conflict if you should want another Login class.

A different approach would be to encapsulate all the classes related
to a particular website in a module.

module MyWebsite
class Login
end

class UserInfo
end

# etc.
end

Yes, I think this is a very good idea. As I would need only one
require and include.

The one thing I am concerned about is hierarchy. One HTML page does
not inherit another by nature. Should I inherit through a sequence of
actions (i.e. a use-case)? A use-case is not OO - Meyer tells us this.

Should I say:

class Main_Page < Login

Because in the test script the login is an antecedent to the main
page.

I don't like it. I am confused.

Aidy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top