it is not so important but is it possible to follow the camelCase rule when we auto generate type objects?
now the first letter is uppercase and everything else is lowercase. i always find myself fixing after generating type objects.
it's not super important but it would save some time ?
hi it is not so important but is it possible to follow the camelCase rule when we auto generate type objects? now the first letter is uppercase and everything else is lowercase. i always find myself fixing after generating type objects. it's not super important but it would save some time ...
my wish is that the "generate" function will keep the "type defination" string and this will do the job for everyone. who likes camelCase will get camelCase who likes ProperCase will get ProperCase etc...
sorry, but i think you misunderstood. i am talking about the IDE and not how to return a string in the app.
when i use the "generate type" function in the b4x IDE it changes the name of the type to lowercase and first letter to uppercase then i use this function a lot in my code but it starts to get unreadable.
EDIT:
i just realized that the IDE does keep the name the only thing is that it adds "Create" at the beginning and this messes up the look.
having the "create" string lowercase and the first char in the type definition uppercase would do the job but again if many does not like that then there is no reason to make that change to the IDE.
I normally use Type starts with Capital letter with plural noun and new object is singular noun. I think it has good readibility.
B4X:
Sub Process_Globals
Type Customers (index As Int, Code As String, Name As String, Address1 As String, Address2 As String)
End Sub
' Assigning values from resultset
Dim customer As Customers
customer.index = index
customer.Code = RS1.GetString("Customer_Code")
customer.Name = RS1.GetString("Customer_Name")
customer.Address1 = RS1.GetString("Customer_Address1")
customer.Address2 = RS1.GetString("Customer_Address2")
I see. I didn't realize it or have forgotten this feature. I normally typed out all the code and never initialize my Type like my above code.
B4X:
Public Sub CreateCustomers (index As Int, Code As String, Name As String, Address1 As String, Address2 As String) As Customers
Dim t1 As Customers
t1.Initialize
t1.index = index
t1.Code = Code
t1.Name = Name
t1.Address1 = Address1
t1.Address2 = Address2
Return t1
End Sub
I wouldn't do that; the type should be singular, represent a single entity (in that case). So I would name it tCustomer (without the final s) and not put an index "field" in it.
Generally my variables start with a capital letter and, if made up of two or more words, the others will also be like this (StartPoint, FirstTime, ...). Exceptions: a variable declared at the module level has the prefix "m" (mCounter); a project global variable has "g" as prefix; in some cases, a prefix of 3 or 4 letters indicating the type (lowercase).