Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,152,420 members, 7,815,950 topics. Date: Thursday, 02 May 2024 at 09:55 PM |
Nairaland Forum / Science/Technology / Programming / Is There Any Prof. Programmer That Could Criticize This My Code (988 Views)
Need Android Programmer That Can Teach Me How To Program Android App / I Need A Programmer That Can Create Live Video Chat / I Am Looking For Programmer That Are Way Smarter Than Me (2) (3) (4)
Is There Any Prof. Programmer That Could Criticize This My Code by smithsteady(m): 2:23pm On Sep 09, 2013 |
Is there any prof. programmer that could criticize this my code, or help me improve the quality. I believe dat i'm not perfect there are guys out there better than me. this jQuery and Javascript
|
Re: Is There Any Prof. Programmer That Could Criticize This My Code by Nobody: 3:04pm On Sep 09, 2013 |
Oga, use pastebin to show ur code to ppl... There are forums you can go to and they will be there to help you polish ur code realtime. 1 Like |
Re: Is There Any Prof. Programmer That Could Criticize This My Code by Nobody: 10:18am On Sep 10, 2013 |
$(function () { |
Re: Is There Any Prof. Programmer That Could Criticize This My Code by smithsteady(m): 1:04pm On Sep 10, 2013 |
Thanks u my pals. |
Re: Is There Any Prof. Programmer That Could Criticize This My Code by kadeer: 12:21am On Sep 11, 2013 |
@OP, code seems light weight from an imagined point of view of what the DOM looks like looking at the code. My advice, continued use of your cached selectors. Also, as you further further further (repetition intentional) progress, begin to decouple the UI elements from the controller actions. You know View, Controller logic separation. Not saying roll or use a client side MVC project, just something like this. // router app = $({}); // controller app.on("pledgeType.change", PledgeTypeDisplay) app.on("PledgeTypeFrequency.change", PledgeTypeFrequency) // view pledgeType.dropDown.change(function () { app.trigger("pledgeType.change" }); Also like to know your reason of storing jQuery ref in objects PledgeTypeFrequency, and pledgeType. Scoping I imagine? Errrrr @pc guru, to call out using $("#id-selector", especially for the reason of creating "too many overheads" I'm not sure is valid criticism, coupled with the fact that those calls are one off, at the beginning of the code run, and cached in a variable. Browsers (mine here Chrome 29.0) ran a $("#foo" from your linked test 524,916 times in 1 (one) second. Even IE6 on WinXP should achieve a pretty decent iteration count. Also jQuery's use would be considered valid considering he runs animations within the script. @pc guru, just couldn't pass without pointing those reasons out. |
Re: Is There Any Prof. Programmer That Could Criticize This My Code by Nobody: 8:50am On Sep 11, 2013 |
@kadeer well true its a one-off thing, sometimes i tend to switch to normal JS if i am getting an Element that is already known like id prob dojo habits, but since it triggers once, indeed there is no overhead, the jsperf only hints on the situation where its a multiple call so yeah you are right on that. just a performance freak especially these days where JavaScript gets heavy easily. but point taken and noted. how's the Backbone world |
Re: Is There Any Prof. Programmer That Could Criticize This My Code by smithsteady(m): 4:32pm On Sep 11, 2013 |
I appreciate all your corrections my heroes |
(1) (Reply)
Xml Assignment / Cloudbridge LLC (A Young Start Up) Needs A PHP Programmer / Interesting Article On Principles Of Modern Web Development. By Joe Stangarone
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 23 |