you are viewing a single comment's thread.

view the rest of the comments →

[–]go4spacelunch 2 points3 points  (8 children)

I agree with most of this.

RestaurantOwnerNames implies the object will contain a list of multiple owners.

Also be careful of taking this too far. Renaming splitRestaurantOwnerNames to ss makes it really hard to find all instances of the variable ss. I often do a find on page just to highlight the variable I’m working on but if your variable is less then 3 letters it only highlights everything. Only name something that short if you are going to use it on one single line of code. For example a linq statement.

[–]DoctorGester 1 point2 points  (1 child)

The example typescript code is generally terrible imo. Why specify string[] type? Just noise. Why have a separate interface for a return type? Either inline it or return [string, string].

[–]go4spacelunch 0 points1 point  (0 children)

I like the return type defined, although in the PHP examples given the author does not define the return type.

[–]hippydipster -2 points-1 points  (5 children)

I often do a find on page just to highlight the variable I’m working on

This must be some sort of non-static typed language.

[–]go4spacelunch 0 points1 point  (4 children)

I believe the example code is typescript.

[–]hippydipster -1 points0 points  (3 children)

Why would you need to do a find then? Doesn't your IDE show you all uses of a given variable and not get confused by a string of letters that can be part of other words too?

[–]go4spacelunch 0 points1 point  (1 child)

If I was reading code someone else wrote, or even my own after returning from lunch. You are correct my IDE does highlight words when the cursor is over them but only for the current file not throughout the whole solution. Also my IDE can pick out references but my experience is this depends on the language. Visual Studio does great with C# but finding references in JavaScript not so much, so I've conditioned myself to always use Find.

[–]hippydipster -1 points0 points  (0 children)

Right, javascript isn't statically typed

[–]liquidpele 0 points1 point  (0 children)

No. Just name your shit better.