generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: :FindFirstChild is too long

Previous Thread :: Next Thread 
Ozzypig is not online. Ozzypig
Joined: 27 Mar 2008
Total Posts: 4906
20 Jun 2012 07:41 PM
Just wanted to get your opinions on this suggestion before it goes into S&I:

I think there should be a shorter version of FindFirstChild. It's way too annoying to type. Maybe one of the following? This, of course, would not replace :FindFirstChild() (that would break billions of scripts), this would be an alias.

- :FFC() (abbreviation)
- :Find()
- :GetChild()
- :Child()
- :Get() <-- I like this one the best

FindFirstChild is too hard to type, in comparison to most words. Sure, we might get used to it after a while, but wouldn't it be nice to cut out the years of having to type it before muscle memory kicks in? :Get() would be nice to have.

What are your opinions on this idea? Again, this is *not* an "I support" thread it's an "I think..." thread.
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
20 Jun 2012 07:43 PM
:Get() would be nice, except for the fact that Selection has a :Get() method, so they would have to rename that...

-Jode
Report Abuse
ColorfulBody is not online. ColorfulBody
Joined: 17 Jun 2012
Total Posts: 2353
20 Jun 2012 07:46 PM
Get is a bad name.

It could be used to get anything.

GetChild could be a good idea. FindChild would be better in my opinion.

Anyway, we still have FindPartsInRegion3WithIgnoreList, which is ridiculously long.
Report Abuse
nate890 is not online. nate890
Joined: 22 Nov 2008
Total Posts: 21686
20 Jun 2012 07:50 PM
"Get" sounds funny :3 But I like it. But as Julien suggested, it should be something like "GetChild" or "FindChild". Get just seems vague.
Report Abuse
200AB is not online. 200AB
Joined: 24 Aug 2010
Total Posts: 1604
20 Jun 2012 07:54 PM
I think it should be FindFirstChildWithLiteralMeaningToFirstIDontKnowWhyWeHaveToHaveThatWeAlreadyKnowItWillOnlyFindOneChildWhichWeAssumeIsTheFirstOneThatItFinds

That would be better.

Seriously, though, why did they think that adding 'First' in there would be a good idea, like I said, we already know it will only return one child, and it's assumed it would be the first one it finds...

FindChild is fine, GetChild just doesn't sound as good. Yes, coding customs wise, it would be Get instead of Find, but for the sake of everyone already using Find with it for years in Rbx Lua, it should be FindChild.
Report Abuse
myrkos is not online. myrkos
Joined: 06 Sep 2010
Total Posts: 8072
20 Jun 2012 07:54 PM
Readability-wise, I think FirstChild() would be best since the "Find" is obviously implied.
Report Abuse
ColorfulBody is not online. ColorfulBody
Joined: 17 Jun 2012
Total Posts: 2353
20 Jun 2012 08:04 PM
"Readability-wise, I think FirstChild() would be best since the "Find" is obviously implied."

No. It isn't.

FirstChild would be the name of a property. This is a method.

Methods do something, while properties contain values. Since this is a method, it must do something, and therefore, it must have a verb. And almost all the methods in the API have a verb as their first word.

---

Get, Find and Child are way too vague, acronyms are completely out of the question (they would break the naming conventions).

Therefore, GetChild or FindChild is the best choice.

Actually, perhaps GetChildWithName would be more clear. But, heh, since we're here to complain about how it's already too long and not about how it's not clear, we should probably keep to FindChild or GetChild.
Report Abuse
Merely is not online. Merely
Joined: 07 Dec 2010
Total Posts: 17266
20 Jun 2012 08:08 PM
If you don't like how the Instance:FindFirstChild() method is made then roll your own.

   GetChild = Instance.new("Part").FindFirstChild

Now you can call it with this code:

   GetChild(part, "nameGoesHere")

Now get back to coding. And don't complain about trivial things like this.
Report Abuse
Anaminus is not online. Anaminus
Top 100 Poster
Joined: 29 Nov 2006
Total Posts: 5945
20 Jun 2012 08:15 PM
FindFirstChild is fine. What's not fine is when members break my self-proclaimed 16 character limit.

Common offenders are FindPartsInRegion3, FindPartOnRayWithIgnoreList, and the notorious FindPartsInRegion3WithIgnoreList, at a whopping 32 characters.
Report Abuse
teteyal is not online. teteyal
Joined: 01 May 2011
Total Posts: 274
20 Jun 2012 08:49 PM
:IWANTYOURCHILDREN()
Report Abuse
jode6543 is not online. jode6543
Joined: 16 Jun 2009
Total Posts: 5363
20 Jun 2012 08:54 PM
Teteyal just won.

-Jode
Report Abuse
darkkiller5555 is not online. darkkiller5555
Joined: 22 Nov 2009
Total Posts: 6359
20 Jun 2012 11:34 PM
I like FindChild().
Report Abuse
smurf279 is not online. smurf279
Joined: 15 Mar 2010
Total Posts: 6871
21 Jun 2012 12:09 AM
"Get is a bad name.

It could be used to get anything.
"


Seriously? What _is_ there to get? nil? of course its going to get an object that should be pretty obvious IMO


local part = Workspace:Get("Part")

IMO that actually make great sense, but I can't speak for all of you. Though I still agree with anaminus
Report Abuse
ColorfulBody is not online. ColorfulBody
Joined: 17 Jun 2012
Total Posts: 2353
21 Jun 2012 12:12 AM
I agree with Anaminus too.

I was pointing out the fact that Get would be an horrible choice and that GetChild or FindChild would be much better, but, in fact, FindFirstChild is already fine.
Report Abuse
200AB is not online. 200AB
Joined: 24 Aug 2010
Total Posts: 1604
21 Jun 2012 01:20 AM
I love how people changed their opinion just because Anaminus posted. :P
Report Abuse
ColorfulBody is not online. ColorfulBody
Joined: 17 Jun 2012
Total Posts: 2353
21 Jun 2012 02:19 AM
I never changed my opinion or anything.

I actually rarely use the FindFirstChild method. Renaming a method to have a shorter name can be a good thing, but never at the cost of making it less clear.

I do think it could be better if it was named FindChildWithName or something similar, but, heh, it's not like there's any need to rename it anyway.
Report Abuse
200AB is not online. 200AB
Joined: 24 Aug 2010
Total Posts: 1604
21 Jun 2012 03:06 AM
It wouldn't be renamed, it would just have an alias.
So FindFirstChild would still be a name for it, no matter what.
Report Abuse
Oysi is not online. Oysi
Joined: 06 Jul 2009
Total Posts: 9058
21 Jun 2012 08:13 AM
[ Content Deleted ]
Report Abuse
BlueTaslem is not online. BlueTaslem
Joined: 11 May 2008
Total Posts: 11060
21 Jun 2012 08:14 AM
I don't think :Find or :Get would be good because they are far too ubiquitous.
:FFC shouldn't be used because you shouldn't have abbreviations in your code, it would make more sense to just make up a word than abbreviate like this.
Report Abuse
Flurite is not online. Flurite
Joined: 03 Apr 2011
Total Posts: 5386
21 Jun 2012 08:52 AM
Well in some IDEs, they give you a drop down menu as you type the name of variables, functions, etc. That would be nice.
Report Abuse
NXTBoy is not online. NXTBoy
Joined: 25 Aug 2008
Total Posts: 4533
21 Jun 2012 09:21 AM
`:Child()` is the only option that is unambiguous. However, it is inconsistent with `:GetChildren()`, so in that respect, `:getChild()` would be better.
Report Abuse
SN0X is not online. SN0X
Joined: 24 Oct 2011
Total Posts: 7277
21 Jun 2012 09:29 AM
What if

:FindChildren(string)

returned first the first child with the name, and then a table of all children with that name, and also true or nil?

But

:FindChild(string)

returned just the child and true or nil
Report Abuse
trappingnoobs is not online. trappingnoobs
Joined: 05 Oct 2008
Total Posts: 19100
21 Jun 2012 09:30 AM
@Flurite

Wouldn't work too well with Lua.


@Thread

Why not just make it so that when you do like

if Workspace.Brick then

Instead of:

1- Check if Workspace has a property Brick (Nope)
2- Check if an object called Brick is a child of Workspace (Nope)
3- Error

Can't it just do:

1- Check if Workspace has a property Brick (Nope)
2- Check if an object called Brick is a child of Workspace (Nope)
3- Return nil

I get it goes against a few styling rules but it'd be more newb friendly and save all your typing
Report Abuse
zars15 is not online. zars15
Joined: 10 Nov 2008
Total Posts: 9999
21 Jun 2012 09:48 AM
Yeah, that would be good.
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
21 Jun 2012 09:49 AM
"break my self-proclaimed 16 character limit."

Oh no, something forbid it break your standard.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image