names of classes and methods in wxWidgets

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
misterboo
Earned a small fee
Earned a small fee
Posts: 13
Joined: Sat Sep 25, 2004 8:16 pm

names of classes and methods in wxWidgets

Post by misterboo » Sat Sep 25, 2004 8:17 pm

Hi,

I have a little problem with the names of methods and classes in wxWidgets. Normally I have these konventions:

The first letter of classes is written uppercase

The first letter of methods is lower case and at the beginning of a new word, the first letter of the word is written upper case.

But: Why does wxWidgets not use these konventions? There it is inversed. Java, Qt and other toolkits or languages use these konventions. My problem is: I wanna use wxWidgets in some of my applications. But here I have all my classes with my namings and now the wxWidgets have other konventions, so the code is in confusion.

Is there a toolkit similar to wxWidgets, Qt and co using my name konventions?

Boo

geon
I live to help wx-kind
I live to help wx-kind
Posts: 189
Joined: Tue Sep 07, 2004 4:10 pm
Location: Sweden, Uppsala

Post by geon » Sat Sep 25, 2004 10:19 pm

Yes, Life is a bitch.

Personally I like the wx naming standard. Most things are named exactly as I would have done it myself.

But tastes differ. At work I have to use the winAPI / STL naming standard. After a while, you will get used to it.

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Sun Sep 26, 2004 8:59 am

Is it really that important for you?

I would more focus on the inside then on the "outside" .. Great looking method names is nice for the programmer, but the user does not see anything about that. So I would say, just obey the rules when you have to.

Windows also uses uppercase for every method, are you going to look for a different OS that handles your naming convention as well ? (just to put thins in perspective ;-) wxWidgets is a great toolkit, I hope youwill give it a try ..

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

misterboo
Earned a small fee
Earned a small fee
Posts: 13
Joined: Sat Sep 25, 2004 8:16 pm

Post by misterboo » Sun Sep 26, 2004 11:44 am

Hi,

thank you for your answers. But I think, it is very important, that my code is cleaned up. That there a consequent and continual structure of classes and that the names of classes and methods are clear.

You say:

Windows also uses uppercase for every method,...

That's a reason for me to say: ok it's really ugly ;) Windows is no excuse for this, quite the contrary :)

I think I will continue my search for a free toolkit, that suits to my code. If there is no alternative, I am not sure, what to do. Either using Java, buying a qt licence (but it is too expensive) or using wxwidgets. I am really not sure. :(

Boo

Jorg
Moderator
Moderator
Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands
Contact:

Post by Jorg » Sun Sep 26, 2004 11:58 am

Sorry to say this, but I don't think you can judge a book by it's cover. If the consistent code syntax you use is so important, maybe convent it the other way around ? Confirm yourself to the wxWidgets standard and not to the "lowercase" methods ??

It's kind of strange to abandon any toolkit (Qt, wxWidgets, whatever) because they do not confirm to your code convention. The next time when you do find that one toolkit that has methods names the way you want it, and you want to use another free library, that ONE library you really need, are you refusing to use it because it also happens to clash with your personal code covention rules? At some point you have to give in and just use it if there is no alternative.

Programming is more like finding the right path, and leaving every 3rd party lib just like it was meant. Even when it clashes your personal preference ;-)

But anyway, good luck in your quest..

Regards,
- Jorgen
Forensic Software Engineer
Netherlands Forensic Insitute
http://english.forensischinstituut.nl/
-------------------------------------
Jorg's WasteBucket
http://www.xs4all.nl/~jorgb/wb

misterboo
Earned a small fee
Earned a small fee
Posts: 13
Joined: Sat Sep 25, 2004 8:16 pm

Post by misterboo » Sun Sep 26, 2004 2:17 pm

Hi,

yes I know, what you mean. But in the last few years I acquired one style. I use it in all my programs, so I am still unsure, if I wanna change this style, just because there is a toolkit which has other conventions. Normally I am using qt, but I need a toolkit for a commercial project and the qt licence is too exspensive for me. My project is not profitable enough to buy it, so I am looking for a free alternative. GTK is very ugly. Not object oriented enough for me and the methods like gtk_new_xy_with_y(parameters) are not, what I like to use. I also took a look at other toolkits, but nothing comes up to my expectations. Only wxWidgets seems to be an alternative. Not easy :)

Boo

Sirius
Earned a small fee
Earned a small fee
Posts: 15
Joined: Tue Sep 07, 2004 3:18 am
Contact:

Post by Sirius » Mon Sep 27, 2004 5:16 am

My own learning curve is VB -> Win32 API -> Java -> MFC -> PHP -> Qt (not much) -> wxWidgets. Personally, I like the style of JAVA also but I dont think this is a problem of chosing wxWidgets. What i did for my own project is ... use upper case for those event (OnBtnClick, OnMenuClick..) and use lower case for those set/get (setValue, getRectPoint). And I use this way in my PHP code also.
OS: WinXP
wxMSW 2.5.2, VC 6.0

OS: Debian sarge
wxGTK 2.4.2, gcc 3.3.3

I like Linux and C++

misterboo
Earned a small fee
Earned a small fee
Posts: 13
Joined: Sat Sep 25, 2004 8:16 pm

Post by misterboo » Mon Sep 27, 2004 6:51 am

Hi,

I could also use these conventions: Own classes are being written upper case and methods lower case and original wxWidgets classes and methods have their style. So it could be interpreted: This is a special style :) So I can directly see, if the method is an inherited wxWidget Method, or an own method. :)

Boo

misterboo
Earned a small fee
Earned a small fee
Posts: 13
Joined: Sat Sep 25, 2004 8:16 pm

Post by misterboo » Tue Sep 28, 2004 8:10 pm

I only wanted to say, that I just started my first project with wxWidgets. I've decided to give it a try. But I have already the first problems :) I will post my questions in a new thread.

Thank you all again

Boo

User avatar
ABX
Can't get richer than this
Can't get richer than this
Posts: 810
Joined: Mon Sep 06, 2004 1:43 pm
Location: Poznan, Poland
Contact:

Re: names of classes and methods in wxWidgets

Post by ABX » Wed Sep 29, 2004 7:19 am

misterboo wrote:Is there a toolkit similar to wxWidgets, Qt and co using my name konventions?
Yes, that toolkit is named wxWidgets ;-)

If you do not like the names within wxWidgets but likes features of it you can create own include file with defines for those names you do not like wrtitten in your convention. Something like:

#define MyStyleOfNamingForFrame wxFrame
#define MyStyleOfNamingForButton wxButton

This will be hard work but you can extend this file each time you are using class, macro or variable you not used earlier.

But in fact as others I do not understand why it is so important to use different naming because one of skills every programmer should have is ability to reading and understanding sources regardless conventions. That is not so strange that withing one source you have wxWidgets code which creates output in JavaScript script which writes HTML. Reading a few conventions at once quickly make you insensitive to them - the algorithm is the thing which is important :-)

ABX

HopeSeekr
Earned a small fee
Earned a small fee
Posts: 16
Joined: Sun Aug 29, 2004 1:07 pm
Contact:

Post by HopeSeekr » Wed Sep 29, 2004 4:25 pm

I personally *love* wx naming conventions!!

Or, we could all be glum and have_every_function_in_lower_case_with_under_scores(with_fifty, unknown_datatypes)

sort of reminds me of the horror days back with GTK+ 1.0 and my first non-Win32 program...

The only problem i have with the naming conventions is that they are abominably inconsistent in many places.

event.GetString()
textctrl.GetValue()
staticlabel.GetText()...

they should *all* be the same function, dammit.

User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton » Thu Sep 30, 2004 2:25 am

----------
event.GetString()
textctrl.GetValue()
staticlabel.GetText()...
----------

Actually, you can use GetLabel on the 2nd and 3rd ones.

Also, since this is really a rehashed thread, I'm tempted to close it if there isn't any substantive discussion here (other than bashing wxWidgets for having Windows conventions which I happen to like :) - choosing a toolkit based on naming conventions is just silly).
[Mostly retired moderator, still check in to clean up some stuff]

Avi
Super wx Problem Solver
Super wx Problem Solver
Posts: 398
Joined: Mon Aug 30, 2004 9:27 pm
Location: Tel-Aviv, Israel

Post by Avi » Thu Sep 30, 2004 10:56 pm

I have to agree with HopeSeekr about the inconsistency. Not to bash, but simply to ask the devs to have general consistant lines when they are choosing function names :) Anyway, this sort of reminds me how Java got a *lot* more consistant in 1.4.x release series. And yes, heh, I guess you can lock this post now. ;)

HopeSeekr
Earned a small fee
Earned a small fee
Posts: 16
Joined: Sun Aug 29, 2004 1:07 pm
Contact:

Post by HopeSeekr » Fri Oct 01, 2004 7:20 am

ahh!!! only terrorists support lockdowns of posts :o
lol...after listening to the first round of USA Presidential Debates, one comes away thinking that a significant portion of Americans are *actually* afraid of dying by the hands of terrorists.

You stand far more danger from your neighbor's poverty and your lack of healthcare, not to mention the collapsing global economies, than from distant cave dwellers...especially in Kansas.

The intent of this post is both to be humorous and make the thread *so* obnoxiously off-topic that it will be locked :p (e.g. passive resistance).

jdratlif
Knows some wx things
Knows some wx things
Posts: 25
Joined: Mon Oct 11, 2004 2:12 pm
Location: in a small padded white room.
Contact:

Re: names of classes and methods in wxWidgets

Post by jdratlif » Mon Oct 11, 2004 2:30 pm

misterboo wrote:Hi,

I have a little problem with the names of methods and classes in wxWidgets. Normally I have these konventions:

The first letter of classes is written uppercase

The first letter of methods is lower case and at the beginning of a new word, the first letter of the word is written upper case.

But: Why does wxWidgets not use these konventions? There it is inversed. Java, Qt and other toolkits or languages use these konventions. My problem is: I wanna use wxWidgets in some of my applications. But here I have all my classes with my namings and now the wxWidgets have other konventions, so the code is in confusion.

Is there a toolkit similar to wxWidgets, Qt and co using my name konventions?

Boo
To be fair, wxWidgets uses a perfectly standard convention for naming, and they seem to be consistent a good portion of the time (nothing is 100%, even Java does not follow it's conventions 100% of the time -- an oversight, I'm sure, but the fact remains...)

I also prefer the Java convention, and in the code I write, I follow the Java convention. I dislike that this clashes with the wxWidgets convention, but you can't always get what you want.

More importantly, I feel I should make fun of you for posting a topic which mocks the conventions of wxWidgets while ignoring English language spelling "konventions".

"...and a sloppy speller too. The preferred spelling of "weiner" is W-I-E-N-E-R" -- Martin Prince (the Simpsons)

(Just a joke. Hope I did not offend you.)
Find save states, game genie codes, and other misc emulation related goodies at emuWorks.

http://games.technoplaza.net

Post Reply