جهت استفاده از تمامی امکانات تارنمای انجمن (ایجاد موضوع،دانلود فایل و ...) لازم است،عضویت یک ساله را خریداری فرمائید. برای این کار مبلغ 50 هزار تومان را به کارت 6221061059143315 واریز نموده،سپس نام کاربری خود را به شماره 09128921121 ارسال کنید. 01-07-1402


امتیاز موضوع:
  • 1 رأی - میانگین امتیازات: 5
  • 1
  • 2
  • 3
  • 4
  • 5
Why learn Python over JavaScript?
#1
TL;DR: We’ll learn why Python makes us happy, and why JavaScript makes us cry.

In the geospatial community, there’s a big push to learn coding. With a little programming skill, you can collect data, transform it, analyze it, and publish the results. Popular GIS software platforms make it easy to run scripts and publish webpages with interactive maps. And if you listen when money talks, it says GIS Developers make twice as much as GIS Technicians in the United States, according to Glassdoor.com.

Many aspiring coders in the GIS community are asking what programming language they should learn first. They’re not asking me, probably because I don’t network enough or something, but that’s another story. Most of the general “top 5″ first programming language blog posts I read list both Python and JavaScript. Both are widely used in the geospatial professions. But which one should a GIS person learn first?
Why Python

Many people know me as a GIS Web Developer, so they would be shocked if I didn’t pick JavaScript for a first language. Not this time, however. I like JavaScript for a lot of things, but a beginner language isn’t one of them. There’s too much… well, you’ll see. Here’s my top five reasons why a GIS person should pick Python over JavaScript as their first language.
It’s So Easy

People who pick up Python find it a breeze to write simple programs. It takes away the structural pickiness and visual clutter of semicolons and brackets found in many languages. Instead, it focuses on simplicity, controlling flow through indentations to define the path of functions and operations. Python makes it easy to write something practical. I think this XKCD comic describes it best.

On the other hand, JavaScript is a language Python tries hard not to be. As the story goes, it was written in about a month by Brandon Eich. Since then, JavaScript is patched every few years with new and exciting features that will never be adopted by your grandmother’s PC without you going to visit. Spacing doesn’t matter, but it’s super picky about semicolons and brackets. Plus It can be frustrating to write, debug, and support.
IDEs and Typos

In Python, you have trusted places to write code, known as IDE (short for Integrated Development Environment). Python developers would recognize them by the names of IDLE, PythonWin, or maybe the Python command line in ArcCatalog. These tools know you’re writing Python, and help you while you write your code. Intellisense let you type out a few letters, and the IDE suggests what you might want to type. This cuts down on a lot of the errors caused by typos.

JavaScript, on the other hand, is notoriously prone to typo errors. On many servers, your best IDE may be Notepad (or Notepad++ if you wash the car, walk the dog, and offer enough donuts to the server guy). JavaScript lets you hack object properties in on the fly, call them almost anything you want and doesn’t warn you until it’s too late. Unless you special flags like “use strict”; in your code, you can assign unknown variable aA something you meant to assign to variable aa. You can also change variable types on a whim, which can be very dangerous.
Version support

In the wild, there are two major versions of Python: 2.x and 3.x. Technically, there 32bit and 64bit versions as well. So there are at most four versions of Python out there you may have to support. And the biggest difference between 2.x and 3.x? Putting parentheses around the stuff you want to print(). But typically, you know the Python version you’re writing code for.

The latest version of JavaScript, on the other hand, is already at EcmaScript version 6; far more than Python. It would be easier if it were just 6, though. It turns out, each EcmaScript version is a recommendation, and the browsers that run JavaScript can implement them whenever they get around to it. That means, you have to account for multiple browsers, which may or may not support parts the code you’re writing. And depending on the browser and when it was last patched or upgraded, your code may fail in any number of places.
Number of languages you need to know

Python programmers can go all day writing nothing but Python. Oh, they might generate a little HTML, a SQL syntax string, or write a little RexExp statement, but then they go back to writing Python.

To program well in JavaScript, however, you need to know three or more languages (JavaScript, HTML, CSS, and whatever optional server side code your server lets you use). These different languages increase the difficulty of troubleshooting problems. Is JavaScript really to blame when I can’t get the text from a textbox, or is it because I misspelled the tag id in the HTML or covered it with a picture in the CSS? And if it’s not enough, there are many libraries and frameworks that augment JavaScript. It’s like learning new dialects on top of the existing language.
Asynchronicity

Python is a very procedural language. You start from the top and work your way down. The logic flow is very predictable, and can be traced out on paper for small projects. It’s like a guided tour through a museum. You always know you’re going to walk by the neanderthals hunting the mastodon before you get to the Spanish Conquistadors.

JavaScript, on the other hand, thrives on its asynchronicity. While it is a scripting language, flowing from top to bottom, it can assign event handlers to DOM objects that get triggered, say, when a user clicks a button, or when a section finishes loading. JavaScript is more like a carnival than a museum. Kids are running around everywhere, running to the Ferris wheel or the crazy spinning rides in no particular order. This lack of predictability is hard for a new programmer.
Conclusion

If you’re new to the geospatial industry, or you’ve been in for a long time, and you feel the pressure to learn to program, maybe Python should be the language you start with. The reasons above only scratch the surface of how useful Python is. I didn’t even cover all the useful libraries that are built to extend the language.

Next week, we’ll learn why all these points are useless, and you should learn JavaScript over Python, first.

http://raykendo.com/blog/why-learn-pytho...avascript/
پاسخ


موضوعات مرتبط با این موضوع...
موضوع نویسنده پاسخ بازدید آخرین ارسال
  برنامه نویسی GIS در Silverlight piroozman 3 2,806 ۱۰-۲۲-۱۴۰۲، ۰۷:۱۱ ب.ظ
آخرین ارسال: فردین آژغ
  آموزش برنامه نویسی در محیط ARC-GIS ayob_f 1 1,983 ۱۰-۲۱-۱۴۰۲، ۱۰:۳۶ ق.ظ
آخرین ارسال: sonia.ahmadian79@gmail.com
  مشکل با نصب و راه اندازی پکیج مپنیک (برنامه نویسی جی آی اس در پایتون) parsley 3 1,496 ۰۹-۲۳-۱۳۹۸، ۰۳:۴۰ ب.ظ
آخرین ارسال: parsley
  تولید بهتر HILLSHADE فردین آژغ 0 1,343 ۰۸-۲۳-۱۳۹۷، ۰۴:۲۰ ب.ظ
آخرین ارسال: فردین آژغ
  تولباکس جستجوی یک لایه در تعداد زیادی MXD فردین آژغ 0 1,296 ۰۸-۲۲-۱۳۹۷، ۰۲:۰۷ ب.ظ
آخرین ارسال: فردین آژغ
  تولباکس اکسپورت گیری از mxd ها به صورت گروهی فردین آژغ 0 1,600 ۰۸-۱۵-۱۳۹۷، ۱۱:۴۶ ق.ظ
آخرین ارسال: فردین آژغ
  کد شناسایی مسیر معیوب لایه ها در MXD فردین آژغ 0 1,281 ۰۸-۱۲-۱۳۹۷، ۰۵:۱۱ ب.ظ
آخرین ارسال: فردین آژغ
  مشکل در نصب ArcEngine mhd.amini 0 1,554 ۰۳-۲۷-۱۳۹۶، ۰۳:۱۰ ب.ظ
آخرین ارسال: mhd.amini
  برنامه نویسی تحت اتوکد محمد عباسی 10 11,635 ۰۸-۲۵-۱۳۹۵، ۰۲:۱۸ ب.ظ
آخرین ارسال: mehranolomi
  فرمول محاسبه مساحت با استفاده از مختصات shahrokh1 1 4,522 ۰۷-۱۱-۱۳۹۵، ۰۸:۵۹ ب.ظ
آخرین ارسال: erfankt19

پرش به انجمن:


کاربرانِ درحال بازدید از این موضوع: 1 مهمان

برای عضویت در خبرنامه جی آی اس ایمیل خود را وارد نمایید:

Delivered by خبرنامه جی آی اس