Click here to Skip to main content
15,912,400 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Explaining JavaScript and this to people. Pin
Marc Clifton3-Dec-17 13:38
mvaMarc Clifton3-Dec-17 13:38 
GeneralRe: Explaining JavaScript and this to people. Pin
the goat in your machine3-Dec-17 14:45
the goat in your machine3-Dec-17 14:45 
JokeRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon3-Dec-17 15:03
professionalJeremy Falcon3-Dec-17 15:03 
GeneralRe: Explaining JavaScript and this to people. Pin
the goat in your machine3-Dec-17 15:34
the goat in your machine3-Dec-17 15:34 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon3-Dec-17 15:35
professionalJeremy Falcon3-Dec-17 15:35 
GeneralRe: Explaining JavaScript and this to people. Pin
Marc Clifton4-Dec-17 5:11
mvaMarc Clifton4-Dec-17 5:11 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon4-Dec-17 5:54
professionalJeremy Falcon4-Dec-17 5:54 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon3-Dec-17 15:02
professionalJeremy Falcon3-Dec-17 15:02 
Marc, that's a lot of stuff to go over man. At lot of these points are mainly due to design concerns and just being old and resistant to change. Poke tongue | ;-P Forgive me, but I'll have to skim over some of this stuff, but will address some points
Marc Clifton wrote:
1) my bias to what I expect. I experience this with Python as well. Anything from differently named functions for string manipulation to the whole abortion called the DOM.
It's an object representation of what's displayed. I'm not sure how it's an abortion. About the only thing I can see with that is old skool compatiblity issues. You can blame Microsoft and Mozilla for that. They didn't give two flips about each other. But those days are gone for the most part. Life is better.
Marc Clifton wrote:
2) too many strings. $("#foo")
Marc, we're professionals man. Come on.
Marc Clifton wrote:
5) Standards hell: For example, single quote or double quote: $("#menu").jqxMenu('close');
Most web languages support both. Can't blame JavaScript for that.
Marc Clifton wrote:
var parentItemText = $($($("#projectTree1").jqxTree('getSelectedItem').parentElement).children("div")[1]).text();
Clearly, you're looking at code written by a 5 year old that doesn't know anything about CSS selectors or jQuery.
Marc Clifton wrote:
Should I do that or not? Performance penalty vs. readability? Is it more readable? Will it confuse someone who has to maintain the code.
Unless you're willing to refactor everything, then yeah that's nifty. The problem here is the design. Back in the olden days, JavaScript was tightly coupled with the DOM. Those days have changed man. I'm not saying it doesn't exist, but it's not nearly has bad as the olden days. Dealing with JScript or VBScript as no different though. It's just the way web dev was for years, and it's not really that much different in concept than XAML and people using ViewModels poorly.
Marc Clifton wrote:
Why do I do this? So I can have a nice function named "getProjectId" that tells me exactly what is going on, without passing in a string and without writing the abortion that looks like this:
Oh Marc, you're having fun with this aren't you? Roll eyes | :rolleyes:
Marc Clifton wrote:
$('#lbProjects').jqxListBox('getSelectedItem').value;
Now this one, I'm just gonna have to agree with. I never used jqxListbox before, but I can almost guarantee you they're trying to simulate OOP with that in a language that's functional. Blame the library man, because yeah that's messed up. I think this a case of damned if you do, damned if you don't. If they didn't fake OOP people would be pissed. If they do, people will be pissed. Can't please them all. Whatever the case, there are better libs out there.

I totally get where you're coming from if you're more of a backend guy than a frontend one. The web has been a kiddie playground for years that's just starting to grow up. Believe me, that's also part of the reason I posted this. I get it. I feel ya. That's part of the reason I'm a purist / minimalist. But, JavaScript is a nifty language when it's not bastardized.

On a side note, you'll never get away from having IDs be strings with the DOM, but the whole $($($($($('#omg'))))) thing can be avoided. Laugh | :laugh:
Jeremy Falcon

GeneralRe: Explaining JavaScript and this to people. Pin
Rob Grainger4-Dec-17 1:38
Rob Grainger4-Dec-17 1:38 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon4-Dec-17 4:26
professionalJeremy Falcon4-Dec-17 4:26 
GeneralRe: Explaining JavaScript and this to people. Pin
Marc Clifton4-Dec-17 5:19
mvaMarc Clifton4-Dec-17 5:19 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon4-Dec-17 6:05
professionalJeremy Falcon4-Dec-17 6:05 
GeneralRe: Explaining JavaScript and this to people. Pin
Marc Clifton4-Dec-17 11:08
mvaMarc Clifton4-Dec-17 11:08 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon4-Dec-17 12:11
professionalJeremy Falcon4-Dec-17 12:11 
GeneralRe: Hey check this out... Pin
Jeremy Falcon3-Dec-17 15:27
professionalJeremy Falcon3-Dec-17 15:27 
GeneralRe: Hey check this out... Pin
Chris Maunder3-Dec-17 15:43
cofounderChris Maunder3-Dec-17 15:43 
GeneralRe: Hey check this out... Pin
Jeremy Falcon3-Dec-17 16:02
professionalJeremy Falcon3-Dec-17 16:02 
GeneralRe: Hey check this out... Pin
Marc Clifton4-Dec-17 5:22
mvaMarc Clifton4-Dec-17 5:22 
GeneralRe: Hey check this out... Pin
Jeremy Falcon4-Dec-17 5:53
professionalJeremy Falcon4-Dec-17 5:53 
GeneralRe: Explaining JavaScript and this to people. Pin
jsc423-Dec-17 21:29
professionaljsc423-Dec-17 21:29 
GeneralRe: Explaining JavaScript and this to people. Pin
Nathan Minier4-Dec-17 1:32
professionalNathan Minier4-Dec-17 1:32 
GeneralRe: Explaining JavaScript and this to people. Pin
grolarbear4-Dec-17 2:11
grolarbear4-Dec-17 2:11 
GeneralRe: Explaining JavaScript and this to people. Pin
Marc Clifton4-Dec-17 5:26
mvaMarc Clifton4-Dec-17 5:26 
GeneralRe: Explaining JavaScript and this to people. Pin
PIEBALDconsult3-Dec-17 14:17
mvePIEBALDconsult3-Dec-17 14:17 
GeneralRe: Explaining JavaScript and this to people. Pin
Jeremy Falcon3-Dec-17 14:30
professionalJeremy Falcon3-Dec-17 14:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.