• (nodebb)
     if (window[this.addList[i].object] != null)  continue;
     var object = win[this.addList[i].object];
    

    'Nuff said....

  • (nodebb)

    Code like this doesn't surprise, especially from JavaScript or even Java. It's not that JS or Java are poor languages that drive poor design, they really aren't any worse then my own preferred language c#. It's that most developers I know that write in JS or Java exclusively don't think much further than a line of code. They think I'll use JS or Java it's cleaner because Clean Code was written with Java examples. Yes it was, but if you don't follow it, it doesn't matter if the language is good or not.

    Now with all that said, I see some of this from C# developers also just not as much, could be that the only one's of us still using it are the old farts. All the cool kids moved on to other things.

  • Martin (unregistered) in reply to TheCPUWizard

    As horrible as those 2 lines are, I wouldn't say that those 2 can sum up just how awful this code is (think you might have missed that win != window, so this isn't just doing nothing :P).

    From what I can understand of this code, it looks like it's trying to copy globally scoped objects from one window to another. At a guess, this would be a site which uses some kind of framework of classes/functions which are defined globally on the window, and the site contains an iframe somewhere which they also want to have the framework available within, and rather than load the framework into the iframe properly, they're using this abomination to try to set up the framework on the iframe's window - so from the top level frames code, it'd all something like iframe.contentWindow.dynamicallyLoad(window, 'some-signature');.

    Exactly what it's setting up on the window isn't possible to see from the code, because it seems to be defined in the addList property.

  • Brian (unregistered)

    @KattMan, what you describe is what I call the difference between coders and developers, or hackers and engineers. Coders/hackers focus on writing code and churning out something that works; developers/engineers see the bigger picture and try to design a clean, functional, maintainable system. And yes, it can happen with any language; I'm currently working in a C++ codebase with some truly monstrous functions, like the guy who originally wrote it never took a step back and said "you know, maybe some abstraction would be a good idea here."

  • (nodebb) in reply to Brian

    Oh I know. It just seems that for right now the number of new coders outweighs the number of actually engineers in Java. Probably because it is taught in colleges but good practices are not. I don't fault the coders if this is the case, but there aren't enough senior guys over there to help guide them. Well now in C++ and C# we have been doing this a while and pushed ourselves to get better so we have more people with the experience. Java devs will get the same saturation eventually, it's just not there yet.

    Though I still have to have one of my juniors to step back when he mentions something along the lines of "Well if they did it is C# we wouldn't have this problem." That is the same problem just from a different viewpoint and is completely wrong.

  • L337Coder (unregistered) in reply to KattMan

    Talking about Javascript and Java in the same sentence is certainly something I expect from a C# developer.

  • Uhm (unregistered)

    And here i was thinking that Java is actually older than C#

  • siciac (unregistered)

    It's not that JS or Java are poor languages that drive poor design, they really aren't any worse then my own preferred language c#. It's that most developers I know that write in JS or Java exclusively don't think much further than a line of code.

    Javascript, Python, Ruby, etc. all allow you to ignore any kind of object-orientation because you can access any attribute at any time and don't have to even begin to think about type.

    Whereas unthinking coders used to churn out spaghetti code, we now have unthinking coders churning out "data pasta" where everything is just a collection of lists of maps of strings and numbers.

    It's definitely possible to do all that in Java or C#, it's just the modern dynamic languages make it incredibly easy, and there's little payoff for thinking about a class.

  • (nodebb) in reply to KattMan

    When I was in school for computer science, two of my co-op terms were with a government office, where there was a half-dozen civil engineers writing an analysis application in Fortran and 1 or 2 CS majors. While I was supposedly brought in to develop a GUI for the application on a HP-UX box in C with XWindows, I seemed to spend a big chunk of my time cleaning up the engineers' code. I no longer have access to that code, or several examples of engineer code could show up on this site.

  • (nodebb)

    Java is older, and actually being taught specifically in college where as C# is not. That's the point I was making there. Which makes it so that we have a larger population of Java developers that are new compared to C# developers. Most of us in C# have been through the other languages and have switched for various reasons, one of them NOT being that C# is better, which is my other point. That people using C# tend to be more experienced on average is the point I was making as to why I do not see these problems a prevalent, or it could just be the people I work with, or maybe I'm the one with blinders on.

    But we do not have people coming out of college having been taught C# already and thinking they know more than they actually do. I'm trying to remember the graph, where the self assessment of knowledge climbs quickly with experience until a certain point when it nearly plummets then climbs gradually at a more realistic rate.

  • I dunno LOL ¯\(°_o)/¯ (unregistered)

    Wow. Code so bad it gets three cornify links. Now I'm glad I added a cornify-to-unicode-horse converter into my wtf bookmarklet that shows the comments.

  • That Other Guy (unregistered)

    Did anyone actually find the Human Centipede films to be good, scary or disgusting? I just found it to be lame, like a couple of film school students trying too hard to be edgy

  • (nodebb) in reply to Martin

    Yes, I did miss win != windows <blush>

  • Ulli (unregistered)

    What is the purpose of .replace(/\n/g, "\\n")?

  • (nodebb) in reply to Ulli

    That replaces newlines with backslash-n.

  • Greg (unregistered) in reply to Martin

    You ring of truth. The framework was heavily, awfully frame-based for everything (including scripts), rather than using XHR.

  • Kashim (unregistered) in reply to Brian

    In all fairness, the coders vs. engineers is a two way struggle. Where a coder might look at a problem and not take a step back and say, "man, this could use a little abstraction." I've seen plenty of engineers go way too far "another layer of abstraction would totally make this better, and not just needlessly more complicated."

    It's a difference in enthusiasm. A Coder will get the job done, and be glad to go home. An Engineer will get the job done right, and miss a lot of time with his family. A Meta-Engineer will have no family, and will try to engineer the problem out of the problem, because more abstraction always makes the world a better place, and if we don't have a class for every word that can possibly be used to describe an object while including different subsets of other objects, then we don't have enough classes.

  • Anonymous (unregistered) in reply to Kashim

    Sad that it took to the bottom of the page to get here.

    You don't always need to abstract things, and abstracting them early is even worse than never having abstraction. If it takes an hour to dig through 20 layers of crap to find out what's REALLY happening...

  • (nodebb)

    The World rides on the back of a function defined by a function.

    Oh yeah? What holds that function up?

    Another function.

    Oh? And what holds that function up?

    You can't fool me, Sonny! It's functions all the way down.

  • AC (unregistered)

    There is an anti-pattern called "lasagna code" where it's layer after layer after layer... IMHO, it's worse than GOTOs making spaghetti. AC

  • RLB (unregistered) in reply to Anonymous

    Ah. I see you've tried to make sense of WordPress.

  • (nodebb) in reply to KattMan

    I'm trying to remember the graph, where the self assessment of knowledge climbs quickly with experience until a certain point when it nearly plummets then climbs gradually at a more realistic rate.

    Dunning-Kruger effect.

  • Kell S (unregistered)

    "just note the eval calls" You mean the EVIL calls?

  • eric bloedow (unregistered)

    oh, this reminded me of a slightly embarrassing moment in College: i had to write a set of programs, which used the output of the first program as the input of the second program, and so on. the first program was simply to make sure all the data was valid...BUT i forgot to make sure the Month was a number in the 1-12 range...so when a later program in the set tried to look up the Month in a table, CORE DUMP!

  • MorrisevadO (unregistered)

    Bass are at one of the greatest fish species to catch. Once seen, their appearance wishes not in a million years be forgotten. Their color on occasion changes according to habitat. https://norfin-fishing.ru/116c.Lak_rybolovnyy.htm Although the belly is as a last resort silvery-white, the backs of bass caught over sand are usually greatly sallow, while those from reefs and offshore wrecks are usually very unlighted - approximately black. This comes forth because the fish can modify their color to blend into the background. How To Twig Bass? http://www.spinning-fishing.su It has been scientifically proven that bass calculate the amount of verve it inclination take them to go after and catching their prey. https://pred.ryazangov.ru/bitrix/redirect.php?goto=https://albom-dlya-monet.ru If the energy expended is perceived by the bass as greater than the requital received, the fish will choose not to chivvy the prey. Knowing this can help you transform into more popular as a bass angler. Your aspiration should be to dream up the most favorable prepare and outcome doable notwithstanding you. https://planeta-ka.ru Accomplishing this revolves solely round a pure uncomplicated and underlying rule. You have to understand bass and their feeding habits, patterns, and their predictable behavior. Expected behavior is dogged at near their habits, life pattern and the real genuineness in which they exist. http://penzakom.pnzreg.ru/bitrix/rk.php?goto=https://browning-fishing.ru Insight these wish finish you capitalize below par their certain behavior and spread the billion of moneymaking bites and hooks while fishing. Saddened sunlight or modicum combined with color preferences by bass are also a factor. Data of these factors include you on the right color lures or bait and reform your odds for enticing more bass. Trees, logs, plants, creeks, coves, banks, and shorelines develop the travel direction followed via bass. http://www.fisherman.beor-shop.ru View and log your experiences and your knowledge

  • EusebioGnGt (unregistered)

    http://www.tomijerry.arhiv-history.ru

    http://forum.serebrenik.ru

    https://money-coins.ru

    https://108minut.arhiv-museum.ru

    http://www.stamp-top.ru

    http://www.nasledie.arhiv-museum.ru

    http://www.catalog-coins.ru

    https://www.vse-moneti.ru

    https://rus-marka.ru

    https://ukrcoins.mir-hobbys.ru

    https://ivan-grozniy.arhiv-history.ru/sitemap.xml

    http://autobus.arhiv-history.ru

    https://ucrcol.konspekturoka.ru/sitemap.xml

    http://shoskin.ru

    https://www.vse-moneti.ru

    https://uacoin.katalogmonet.ru/sitemap.xml

    http://www.munzen-hall.ru

    http://hobbykras.ru

    https://moneta.1kzn.ru/sitemap.xml

    http://kollektcioner.ru

    http://www.kungur.urban-city.ru

    https://lexcoins.ru

    http://www.klad.odcollector.com.ua

    https://japan.kollektion.ru

    http://www.1kzn.ru

    https://www.letniysad.arhiv-museum.ru

    https://acmodel.kollektion.ru

    https://www.coinsalbum.ru

    https://www.coins.lovum.ru

    https://www.catalog.rus-marka.ru

    https://shoskin.ru/sitemap.xml

    http://www.anti-raskol.arhiv-history.ru

    https://www.kazahstan.catalog-coins.ru

    https://moneta.1kzn.ru/sitemap.xml

    http://10rubles.100monetok.ru

    http://catalog.rus-marka.ru

    https://www.vidnoe.urban-city.ru

    http://www.vidnoe.urban-city.ru

    http://war.munzen-hall.ru

    https://www.mycoinscollection.ru

    https://kungur.urban-city.ru/sitemap.xml

    https://club.imperia-coins.ru

    http://kostroma.arhiv-museum.ru

    https://mir-hobbys.ru/sitemap.xml

    https://www.munzen-hall.ru

    https://lenta-podarkov.ru

    http://tomijerry.arhiv-history.ru

    https://moneycollector.spb.ru

    https://www.super-stamp.ru

    https://catalog-marok.ru

    https://www.pomonetam.ru

    https://www.aukcion.coinsalbum.ru

    http://www.coins.odcollector.com.ua

    http://www.anti-raskol.arhiv-history.ru

    https://monetablog.ru

    http://sport.arhiv-history.ru

    http://ukrcoins.mir-hobbys.ru

    https://stamp-top

Leave a comment on “JavaScript Centipede”

Log In or post as a guest

Replying to comment #494677:

« Return to Article