[Development] Proposal - QtSerialPort graduation from the Playground

Laszlo Papp lpapp at kde.org
Wed Jan 23 23:49:01 CET 2013


On Wed, Jan 23, 2013 at 9:45 PM, Thiago A. CorrĂȘa
<thiago.correa at gmail.com>wrote:

> You mean filling the Combo Box with available rates right? (
> ui->rateBox->addItem(QLatin1String("9600"), SerialPort::Rate9600); )
> I would just fill in the numbers in the second argument of addItem.
> Other than maybe getting a compiler error in case of a typo, there
> isn't much gain in the enums themselfs.


That is a nice gain in my opinion to avoid the unintentional bugs thay may
take some time to debug (wrong setting, data not going through properly
towards the modem, perhaps causing random issues and so forth).


> A list of common values can be
> kept in the documentation, and most likely ppl will just copy them
> from hyperterminal when they need them for a configuration dialog like
> this.
>

I would assume that people prefer enumeration to raw values when possible.
I have just had a quick search on Google, and apparently it seems Microsoft
also has enums for their .NET framework. Hence, it would probably also
reduce the noise among the lines:
http://msdn.microsoft.com/en-us/library/dd187599.aspx


> Having the enum feels like setBaudRate (or setRate as it's now) should
> take the enum as parameter, which would be wrong, as it would
> effectively prevent rates above 115200 unless they are added to the
> enum.
>

I believe people would be using the enum values most of the time, and the
"custom" setting would be exceptional.


> This is highly subjective for me, so I would be happy either way.
> Personally I would just choose to ignore the enum and use the numeric
> values in my own code.
>

You can do that, but I would personally reconsider using the enumeration
values in those standard cases.


>  >>
> >> I'm not native english
> >> speaker but I think writting it as baudrate (ie, as a single word) is
> >> common[1], and therefore I guess it wouldn't be against the convention
> >> to call it baudrate/setBaudrate if that form os prefered.
> >
> >
> > I believe that camelCase makes sense here as they are usually as separate
> > words (i.e. even if I type "baudrate" into Google).
>
> No strong objections here.
>

Great, thank you. :)


> Oh, I simply had them here in my harddisk from different projects.
> They are not of much relevance except explain why I thought both forms
> are ok. Can get links to them if it's desired :-)
>

It is ok. :)

Laszlo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20130123/864a28e8/attachment.html>


More information about the Development mailing list