Zangoose , (edited )

I know I'm late to this but here's my (probably insane?) take. We use Subject-Verb-Object in English right? So, hear me out:

dialog_create_tab(...)
dialog_open_file(...)
dialog_close_file(...)
Agent641 ,

I just name my variables a, b, c etc. If I have more than 26 variables in any given function, I name them aa, ab, ac, etc.

gandalf_der_12te OP ,
@gandalf_der_12te@discuss.tchncs.de avatar

you're on a highway to hell.

sparkle , (edited )
@sparkle@lemm.ee avatar

in general, adjectives and verbs after nouns because it's more organized/easier to search/filter. as god intended.

jarfil , (edited )
@jarfil@beehaw.org avatar

Both:

dialog_error = Dialog_plain.create_modal(error_text)

Variable and class names go from more general to more particular, functions begin with a verb.

Global functions are either "main", or start with one of "debug", "todo", or "shit".

roon ,
@roon@lemmy.ml avatar

Powershell has a lint warning for functions that don't follow Verb-Noun format, and verbs here are a list of approved verbs lol

joyjoy ,

We just call those Smurf names.

nikaaa ,

I personally prefer dialogs.FileDialog.open()

lorty ,
@lorty@lemmygrad.ml avatar

I know the second one is better, but I also know I'm terribly inconsistent with this stuff.

nexussapphire ,

Been learning to program and I'm refusing to use an lsp for the time being. I'm bad about using abbreviated names when I have to type over and over again(no auto complete). I'm at least using descriptive names for functions I use less than four times.

redcalcium ,

I'm truly torn with this. The first one seems sensible (action -> target) and easier to read and reason about (especially with long names), while the other one looks more organized, naturally sortable and works great with any autocompletion system.

kunaltyagi ,

We need a new framework, one that allows universal lookup, and makes life easier

x = _.dialog.file.open
y = _.open.file.dialog
z = _.file.open.dialog
a = _.file.dialog.open

Once done, the formatter simply changes everything to _.open.file.dialog

Let's get this done JS peeps

\s

_g_be ,

Insert xkcd about 15th format

Rainb0wSkeppy ,
And009 ,

Not a programmer, but I'd prefer right naming convention because sorting

Lightfire228 ,

I am a programmer, and i also like the naming scheme on the right

Especially for things like filenames

bitwolf , (edited )

Also a programmer and think method names would be conducive using little endian.

TopicGet()
TopicCreate()
TopicDelete()

Writing this I realize we do this implicitly in some instances.

http.Get() -> httpGet()
http.Post() -> httpPost()
cupcakezealot ,
@cupcakezealot@lemmy.blahaj.zone avatar

the people who chose the first one...who hurt you?

habl ,

I will

MechanicalJester ,

No one, it just makes sense.

You must be one of those
"Throw your mother downstairs, the box of tissues" types.

Yoda sounded normal to you I bet.

loudWaterEnjoyer ,
@loudWaterEnjoyer@lemmy.dbzer0.com avatar

It makes sense until you write 30 methods to manipulate the data layer.

Lifter ,

Fuzzy search solves this pretty good

Swedneck ,
@Swedneck@discuss.tchncs.de avatar

reverse polish notation time

lightnsfw ,

Powershell

suction ,

Not new

nomadjoanne ,

Romance language word order noun_descriptor is the right way.

dariusj18 ,

Be php, mix and match

gandalf_der_12te OP ,
@gandalf_der_12te@discuss.tchncs.de avatar

let the chaos reign

todd_bonzalez ,

Mmmmmmmm... Lexicographical Endianness.

rekabis ,

There is a reason why little endian is preferred in virtually 100% of cases: sorting. Mentally or lexicographically, having the most important piece of information first will allow the correct item be found the fastest, or allow it to be discounted/ignored the quickest.

Static_Rocket ,
@Static_Rocket@lemmy.world avatar

But also, sorting big endian automatically groups elements associated with common functions making search, completions, and snippets easier (if you use them). I'm torn

33550336 ,
@33550336@lemmy.world avatar

I was going to write something like this. You actually wrote about semantic order, but syntactically it is as much important e.g. it is easier to sort dates such as 2024-05-27 than 27.05.2024 in chronological order.

deadbeef79000 , (edited )

That's actually filtering not sorting.

That being said, it's more valuable (to me) to be able to find all my things for a topic quickly rather than type.

Foo_dialog

Foo_action

Foo_map

Bar_dialog

Bar_action

Bar_map

Is superior IMHO.

rekabis ,

If you are looking for Bar, it is highly likely that you are already looking specifically for a particular functionality - say, the action - for Bar. As such, it is irrelevant which method you use, both will get you to the function you need.

Conversely, while it is likely you will want to look up all items that implement a particular functionality, it is much less likely you are going to ever need a complete listing of all functionality that an item employs; you will be targeting only one functionality for that item and will have that one functionality as the primary and concrete focus. Ergo, functionality comes first, followed by what item has that functionality.

deadbeef79000 , (edited )

We probably have slightly different work processes.

I'm more likely to be making "foo" functionally complete and then making "bar" complete than I am to be making all my dialogs functional then all my tabs/whatever.

This comes from TDD where I'm making a test pass for "foo", once done, I'll do the same for "bar".

Though it's even more likely these are different files entirely, rendering the arguments moot.

red ,
@red@sopuli.xyz avatar

I put all those in different files

compont/functions/foo.ext etc.

deadbeef79000 ,

Depends on the language's constraints, but yes: more smaller files please!

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • kbinchat
  • All magazines