Click here to Skip to main content
15,891,136 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: How did you get involved in programming? Pin
Kornfeld Eliyahu Peter21-May-16 9:25
professionalKornfeld Eliyahu Peter21-May-16 9:25 
GeneralRe: How did you get involved in programming? Pin
cigwork21-May-16 9:31
cigwork21-May-16 9:31 
GeneralRe: How did you get involved in programming? Pin
Daniel Pfeffer21-May-16 21:26
professionalDaniel Pfeffer21-May-16 21:26 
GeneralRe: How did you get involved in programming? Pin
Besinger23-May-16 2:48
Besinger23-May-16 2:48 
GeneralTime travel by news :P Pin
shah dipen20-May-16 11:54
shah dipen20-May-16 11:54 
GeneralRe: Time travel by news :P Pin
UnlockSecrets4WeightLoss20-May-16 19:40
UnlockSecrets4WeightLoss20-May-16 19:40 
GeneralRe: Time travel by news :P Pin
OriginalGriff20-May-16 20:27
mveOriginalGriff20-May-16 20:27 
GeneralProgramming in Javascript creates bad habits Pin
Marc Clifton20-May-16 9:46
mvaMarc Clifton20-May-16 9:46 
I find myself doing things I would never do in C# code. The two most common things are:

1) copy and paste code from one HTML page to another

Why? Because making something reusable requires:

a. create a separate js file
b. put the functions in there
c. add a <script> line to suck it in
d. remember that I have these common functions in this other file when writing other pages

OK, I suppose that's sort of the same steps in a real programming language, it just seems harder when working on a website.

2) everything tends to be inline code.

I like to practice writing human readable and short methods when I code in C#. Conversely, when I code in Javascript, I'll do something like this (a somewhat trivial example, granted, but it makes the point):

$('#spinny').jqxLoader('open');

This is completely non-reusable and un-maintainable. Imagine hundreds of pages that all have spinny's for when the page does some sort of AJAX callback, and maybe you want to change something about the spinny behavior.

So this:
function showSpinny() {
            $('#spinny').jqxLoader('open');
        }

while seemingly stupid, becomes a re-usable and maintainable piece of code.

I wonder what it is about Javascript that promotes these (I only cite two examples) practices? Is it just me? I don't think so, I see other developers writing the same cruft. Albeit, they're also Python developers, and I see the same cruft in their Python code.

Marc
Imperative to Functional Programming Succinctly

Contributors Wanted for Higher Order Programming Project!

Learning to code with python is like learning to swim with those little arm floaties. It gives you undeserved confidence and will eventually drown you. - DangerBunny

GeneralRe: Programming in Javascript creates bad habits Pin
Afzaal Ahmad Zeeshan20-May-16 10:58
professionalAfzaal Ahmad Zeeshan20-May-16 10:58 
GeneralRe: Programming in Javascript creates bad habits Pin
Marc Clifton20-May-16 11:17
mvaMarc Clifton20-May-16 11:17 
GeneralRe: Programming in Javascript creates bad habits Pin
Afzaal Ahmad Zeeshan20-May-16 21:35
professionalAfzaal Ahmad Zeeshan20-May-16 21:35 
GeneralRe: Programming in Javascript creates bad habits Pin
User 483504720-May-16 12:11
User 483504720-May-16 12:11 
GeneralRe: Programming in Javascript creates bad habits Pin
TheGreatAndPowerfulOz20-May-16 12:14
TheGreatAndPowerfulOz20-May-16 12:14 
GeneralRe: Programming in Javascript creates bad habits Pin
Camilo Reyes20-May-16 12:50
professionalCamilo Reyes20-May-16 12:50 
GeneralRe: Programming in Javascript creates bad habits Pin
Marc Clifton20-May-16 16:03
mvaMarc Clifton20-May-16 16:03 
GeneralRe: Programming in Javascript creates bad habits Pin
Camilo Reyes27-May-16 13:39
professionalCamilo Reyes27-May-16 13:39 
GeneralRe: Programming in Javascript creates bad habits Pin
Sander Rossel20-May-16 14:00
professionalSander Rossel20-May-16 14:00 
GeneralRe: Programming in Javascript creates bad habits Pin
Jeremy Falcon20-May-16 14:03
professionalJeremy Falcon20-May-16 14:03 
GeneralRe: Programming in Javascript creates bad habits Pin
Mark_Wallace21-May-16 17:36
Mark_Wallace21-May-16 17:36 
GeneralRe: Programming in Javascript creates bad habits Pin
Marc Clifton23-May-16 9:05
mvaMarc Clifton23-May-16 9:05 
GeneralRe: Programming in Javascript creates bad habits Pin
Mark_Wallace23-May-16 9:46
Mark_Wallace23-May-16 9:46 
GeneralRe: Programming in Javascript creates bad habits Pin
Dan Neely23-May-16 11:00
Dan Neely23-May-16 11:00 
GeneralRe: Programming in Javascript creates bad habits Pin
Mark_Wallace24-May-16 6:53
Mark_Wallace24-May-16 6:53 
GeneralMoment of Optimism PinPopular
W Balboos, GHB20-May-16 8:31
W Balboos, GHB20-May-16 8:31 
GeneralRe: Moment of Optimism Pin
908236520-May-16 8:55
908236520-May-16 8:55 

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.