Software engineering surveys are unintentionally hilarious

So… this was in my inbox today…

Most Loved/Hated Programming languages according to Hired
#PythonIsSexyAgain #NowPictureGuidoVanRossumNaked #SEXY? #NowTryGettingThatPictureOutOfYourMind #GlobalInterpreterLockAmIRight?
#<HTML>IsAProgrammingLanguage</HTML>
#EverythingIsAwesome #JavaCanDoEverything #JavaIsAwesome #NoWaitMaybeNot
#AtLeastPHPIsNumberOneAtSomething
#YouCodeForTheLOLsICodeForTheLULZ
#EveryTimeATabIndentsOneThreeOrSevenSpacesGetTheirWings
#OneTypingToRuleThemAll

(There are many other gems in there, like any good tragicomedy.)

What MVC framework for web development?

Answered in Quora:

Q: Why should I learn the combination of Python/Django rather than PHP, JS/Node? I am a web designer moving to web development. What is the scope of Python/Django?

Python/Django is like learning Ruby/Ruby on Rails. The equivalent in the PHP world would be PHP/Drupal or PHP/Laravel. Equivalents in NodeJS is not Node/JS but NodeJS/Meteor or NodeJS/Sails. In all those examples above the first part would be the underlying web language, and the second would be a MVC framework on top of the language.

(There exist web frameworks that do not provide MVC but just the web server and HTTP request-response plumbing. This isn’t common in PHP since it is embedded in a web server such as Apache or nginx, but in Python it would be flask and in NodeJS it would be Express or Koa— these are sometimes referred to as “microframeworks.”)

However, unlike on the front-end with things like Vue.js, React/Redux and AngularJS, full-service MVC web frameworks have increasingly less utility on the back-end. This is because most the the advantage a framework provides is to do heavy-lifting of tedious but repeatable tasks that require a lot of code (very common when building a user interface) the bulk of which has been moved onto the client in web development. What value is a MVC’s templating system and router when both have moved into javascript on the client-side and all interactions are through an API? This becomes more extreme with standardization of the data interface (a la GraphQL) and the prevalence of more service-oriented architecture popularized by microservices or serverless FaaS architectures.

MVC web-frameworks still provide things such as a configuration management, a data object model and abstraction, but even those can get in the way as a website becomes more mature and this pre-fab approach becomes a hinderance to future scalability and optimization.

Also, when not building to scale or building proof-of-concept, a full MVC architecture will help you starting out on server-side web development because it does all the heavy lifting for you. So it might be good to start out with one, though YMMV (your mileage my vary).

Continue reading about the state of web frameworks after the jump

Vagrant, Time Machine, and waiting forever for a backup

For some reason, moving to the new MacBook Air hasn’t been very successful. My Alfred spotlight is broken, Apple Mail slows to a crawl for no good reason even though everything is in the cloud, and I have a \<50% success rate of backing up my Time Machine during my workday. Basically if it doesn’t complete before lunch, it isn’t going to finish at all.

That last one seems to be well within the realm of what’s feasible. I mean why is it backing up 15GB of new files each day and why is it when I really get working the last 2GB never seems to complete? Not to mention that this 5TB drive I purchased four years ago to back up what is only a 500GB SSD (was smaller in years back) is now starting to appear full.

Well I think I figured it out. I’ve been using Vagrant for the last 5 years to build out virtual machines for development and each of them is a single (very large) virtualbox file that needs to be re-imaged every time and is constantly changing if the machine is up during the backup process.

After some research here are some suggestions on what to exclude from your time machine backups

Working scratch folders:

Things like ~/.Trash and ~/Library/Caches should automatically be excluded by Time Machine in general, but for me, I use ~/Downloads as scratch space for stuff that I don’t care if I lose. If it’s important, I usually drag that to desktop, so I added that. You can add something similar

Cloud files

I added ~/Dropbox because that stuff will be built from Dropbox, and Time Machine or migration restores will just confuse the backup system. If I used Google Drive, I’d probably add that too.

Virtual machines and other dev related environments

For me that’s ~/.vagrant.d and ~/VirtualBox VMs where vagrant downloads the boxes and where, by default, it puts the VirtualBox VMs. The actual boxes that I might image to do Windows/IE development are manually created and imaged in ~/Documents so there is no need to exclude those. If you want to keep your plugins then save ~/.vagrant.d/boxes only.

I also added ~/Library/Containers/com.docker.docker because sometimes I did Docker development and that’s where those instances are.

Also if you have a standard place where you put Python virtual environments with virtualenv you should probably add that too. I don’t develop on localhost anymore so that isn’t the case for me.

Local software caches

I added ~/.gem for Ruby and ~/.npm for NodeJS. I’d probably look into what I can torch from rbenv and rvm but I no longer do local Ruby development, but if you do, add those to your checklist.

Games

I don’t have this on my work computer, but on my home one, I added ~/Library/Application Support Steam/steamapps because those are big files that are downloaded from the internet anyway. When I get home, I’ll have to make sure that sort of thing wasn’t moved into /Users/Shared.

Unknown unknowns

I probably should figure out where Ulysses puts its files because every time I do Migration Assistant I have unresolved conflicts which take forever to clean up. It’s not a big deal though since almost all copies are actually the same file.

Know of any other things I need to add?

Running Python scripts on a schedule in AWS

Answered in Quora:

Q: What is the easiest/fastest way to set up AWS to repeatedly run a small Python or PHP script (24×7)?

Probably the easiest way is to use Lambda. It has a built-in scheduler and you only pay for the time it is running. (Note that in PHP you have to create a lambda package using this tutorial or via node Serverless here.)

If you mean continuously, and not repeatedly, then the caveat for PHP at least, it is a bad idea to have it repeat forever in the process because it was designed to be set up and torn down and might leak memory (with the proper setting to set_time_limit and ignore_user_abort, have it run forever). In those cases you would have something else constantly call the php script via command line and restart.

Other than that, whether PHP or Python or whatever, it is better to create a non-burstable EC2 instance and run it, since it will always have some load. You can write something simple to the crontab that will make sure the process is always running or, better yet, use forever.

Which has better packages, Python or PHP?

Answered in Quora

Q: Which has better packages, Python or PHP?

It depends on the target utility. In the Python world, the most common package installer is pip; the PHP world didn’t settle on a dominant format/installation for packages until composer, and that was relatively recently (last 4 years).

The reason for this is because PHP is a language almost exclusively designed for websites, and the economy of the open-source world has found that a dedicated application, instead of a framework or library could serve the bulk of most commercial needs. For instance, a single application, WordPress, four years ago (2014) accounted for nearly 20% of all websites and 50% of all blogs. There is little need package management when a single download and install (or a single click during ISP/hosting account creation or visit to site like Bitnami) can set up everything a typical website might need, fully under your control, with its own package infrastructure (plugin and theme ecosystem) where the underlying language (PHP) is pretty much irrelevant to the user.

Other languages like Ruby (with gems) or Go (import) or Javascript (with npm) which matured later and are more general purpose had a more robust package management and installation system. PHP Composer, in fact, is most modeled on npm.

Python, like Perl, predates these languages, but its general purpose demanded package management early in its development. However, because of this, pip takes less advantage of web conventions that npm does. Python has the added headache of version compatibility with its core runtime. Still pip is perfectly workable and relatively seamless and easy to use.

So which has better packages? The answer is it depends on the domain. In nearly any language you can find an adequate package for any of your needs, but overall you will find the packages are higher quality, more up-to-date, and sometimes just better overall in the domain the language seems to target well.

In my opinion, packages for data science/AI/ML applications, Python packages are second to none. As a PHP expert, I wouldn’t even bother looking in Composer for them and would instead find a PHP extension that binded to a dedicated engine optimized for the problem area or write a dedicated solution/web service in Python/flask and call it from PHP. If, for some crazy reason, I needed to do this entirely within PHP, I would search for the best solution in Python and see if someone has a port for that in PHP.

I would expect the same in DevOps for Python, but right now that space, like blogging (WordPress), seems to have dedicated solutions where a domain-specific language has abstracted one from the language-specific package management solution. For instance, in the configuration management space the top four applications are: Puppet, Chef, Ansible, and SaltStack. Of those four, I believe only one (Chef) exposes the underlying language (Ruby), and it does this to the DevOps engineer no more than WordPress exposes PHP to a blogger.

For server-side web-based packages, I feel PHP and Composer are going to have a solution for any problem PHP itself is capable of solving. That is a restricted set, however, as more and more work for web applications is being done on the client-side in Javascript and there is already an adequate toolchain for that (as well as a package management system in npm). Other web-based languages will probably have adequate solutions in this space with decreasing order/quality: Ruby (on Rails), Javascript (NodeJS), Python, Go, Perl, Java… The web problem is now pretty discovered at this point so there is less a need to adopt the bleeding edge in the web problem.

Sometimes they really are indistinguishable

“Any sufficiently advanced technology is indistinguishable from magic.”
Arthur C. Clarke

When a non-techie friend of mine moved to San Francisco, she overheard two guys talking next to her.

“What are you up to,” one of them asks?

The other replied, “Oh, I’m trying to learn Python.”

“Excuse me,” my friend interrupted them. “But I believe it’s called Parseltongue.”

(After living here for a while longer, she became very embarrassed. And though it wasn’t exactly what he meant, I still think Mr. Clarke would approve.)

You lost me there, bub

Reading [this blog post ranting on PHP][phphorrors]

> No corporation supports PHP’s growth & maturity like Sun & Google do for Java, Google (Guido van Rossum) for Python (jnc Django framework), Ruby (inc RoR) by 37 signals etc…

37Signals & Ruby? Thank his noodly appendage PHP’s support isn’t as terrible as that company on that language.

You lost me there, bub.

When it comes to engineering choice, programming language is not even in the top 10 of important choices a software architect has to make. If you’re worried about the language, you’re worried about the wrong thing. (I’m also a little amused that the author holds Python as a language with great unicode support.)

[phphorrors]:http://www.theroadtosiliconvalley.com/technology/php-coding-horrors-poor-excuses/ “PHP: coding horrors & poor excuses—The Road to Silicon Valley”

Learning Programming Part 3: C/C++ superiority

Previously, Part 1 and Part 2.

The other day, Marie pointed me to an interesting article where Jolie O’Dell decides to go back to school to get a computer science degree. She asked me what my thoughts were on some comments concerning the necessity of learning C/C++. I’ll paraphrase in order to avoid singling anyone out.

“Scripting languages create holes in proper programming. All a language, like PHP, will do is make you a PHP programmer, while a language like C or C++ will give you a fundamental understanding that can be applied to all languages and make you a better programmer no matter what the language. This is because these languages expose you to the way the computer really works (instead of abstraction): for instance, how a string is really created, or an array, or dynamic memory allocation. If you learn PHP, you will never bother to learn the low-level reality.”

The above is a munge of many commenters’ discussions.

What do you think of the above statement?
Continue reading my reply after the jump.

Who puts the P in LAMP?

Received this yesterday:

So I’m thinking of starting a new web project and was wondering if I could seek your advice. My tendency is to use PHP since that’s what I know and have used most in the past. Though, after talking to a lot of folks (namely Googlers…go figure), I’ve been encouraged to instead choose Python.

Seeing as you’re my favorite PHP Terrorist I was wondering if you have any specific thoughts on the subject.

I still need to write another article on Python, but the short answer is I think if it’s web, PHP is probably the better choice.

“PHP is the shortest point between two distances on the web.”
—Me, tongue-tied at a talk

However there are some mitigating factors to consider:Continue reading about Python vs. PHP for web after the jump

1500 Lines of Code

Original article posted to PHP Advent 2009, Click to jump to discussion. Happy Holidays to you and yours!

Even the best of us can only write 1500 lines of code a day, so we need to make those lines count.

There were so many great articles in PHP Advent this year, that I couldn’t think of a good topic—I like to believe my peers stole all the good ideas this year… 🙂
Continue reading about Read about 1500 lines of code after the jump