python 安卓移至_从php移至python

python 安卓移至

I have been a PHP developer(and fan) for a decade. It formed my perspective on what a programming language should be. Now I’m joining the Python camp and here are my reasons.

我已经成为PHP开发人员(和爱好者)已有十年了。 它形成了我对什么是编程语言的看法。 现在我要加入Python训练营,这就是我的原因。

整洁的代码 (Neat Code)

How many times do you have to rub your eyes and look closer to match the ending brackets of statements?

您需要揉搓眼睛并仔细观察几次以匹配语句的结尾括号?

I did it everyday when coding with PHP. Before a proper IDE came into play, I literally placed a ruler on monitor screen to vertically line up brackets!

我每天都使用PHP进行编码。 在使用合适的IDE之前,我确实在监视器屏幕上放置了一个标尺以垂直对齐支架!

Here is an example of ending brackets in PHP

这是一个用PHP结尾的示例


}
}
}
}
}
}
}

Here is an example Python function

这是一个Python函数示例

def hello(arg):
if arg == 'hello':
print('world')
else:
print('!')

That’s right, just use indentation to group your statements. No need of brackets or ending semicolons! It might not be a big deal for a few lines of code here. But it makes your code base much neater and therefore improves code readability.

没错,只需使用缩进将语句分组即可。 不需要括号或结尾的分号! 对于这里的几行代码来说,这可能不是什么大问题。 但这使您的代码库更加整洁,因此提高了代码的可读性。

Imagine you are reviewing Pull Request from your co-worker, the code is much easier to read now. This allows you to focus on the code logic rather than the formatting.

想象一下,您正在查看同事的“拉取请求”,该代码现在更容易阅读。 这使您可以专注于代码逻辑而不是格式。

简易清单操作 (Easy List Manipulation)

In Python world, processing data structure(such as list, dictionary etc) is made so simple. This is an important one, as processing data structure is such a daily routine for every developer.

在Python世界中,数据结构(如列表,字典等)的处理变得如此简单。 这很重要,因为处理数据结构对于每个开发人员来说都是日常工作。

Below are code snippets to find even numbers in a list.

以下是用于在列表中查找偶数的代码段。

In Python

在Python中

def find_even (numbers):
return [num for num in numbers if

In PHP

在PHP中

function find_even ($numbers) {    
$results = [];
foreach ($numbers as $num) {
if (
$results[] = $num;
}
}
return $results
}

The syntax in Python is so neat. It might look a little confusing in the beginning (as it did for me), but soon you will find writing this kind of syntax is easy and time-saving for little tasks like this.

Python中的语法非常简洁。 一开始可能看起来有些混乱(就像对我所做的那样),但是很快您会发现编写此类语法非常容易,而且可以节省诸如此类的小任务。

数据科学 (Data Science)

Python is the most popular programming language in the data science world, thanks to its compatibility and simple syntax. To me, this means there are great libraries, tools and communities for data science study.

由于Python的兼容性和简单语法,它是数据科学世界中最流行的编程语言。 对我来说,这意味着有大量用于数据科学研究的图书馆,工具和社区。

When I was learning data science online, I have been taught to use Jupyter Notebook, Scikit-learn, Pandas, Numpy and Spark. The course is designed around Python. As a result, I have to learn a great deal of Python. The communities like Kraggle and articles on medium helped me a lot on data science learning.

当我在线学习数据科学时,我被教导要使用Jupyter Notebook,Scikit学习,Pandas,Numpy和Spark。 本课程围绕Python设计。 结果,我必须学习大量的Python。 像Kraggle这样的社区和有关媒体的文章对我在数据科学学习方面的帮助很大。

There is simply no such thing in PHP world.

PHP世界中根本没有这样的东西。

非常适合微服务 (Great for Micro-service)

Object Orientation(OO) and framework play a big part in PHP. You are encouraged to write code in OO style and you are probably going to use a MVC framework, such as Laravel, which is perfect for a traditional website.

面向对象(OO)和框架在PHP中起着重要作用。 我们鼓励您以OO风格编写代码,并且您可能会使用MVC框架,例如Laravel,它非常适合传统网站。

The software architecture today is shifting to an agile, micro-service pattern. You are required to code light-weight micro-service, deployed on cloud, exposed as API. For a micro-service, a strong OO and heavy-weight framework really makes little sense. It also slows down agile process (building a MVP takes longer)

当今的软件架构正在转变为敏捷的微服务模式。 您需要对轻量级微服务进行编码,这些微服务部署在以API形式公开的云中。 对于微服务,强大的OO和重量级框架确实没有任何意义。 它还会减慢敏捷过程(构建MVP需要更长的时间)

And AWS Lambda doesn’t even support PHP! It natively supports Python and node.js etc. You would prefer all of your code written in same language, so Python becomes an all-rounder in the cloud.

而且AWS Lambda甚至不支持PHP! 它本身支持Python和node.js等。您可能希望所有用同一语言编写的代码,因此Python成为云计算的全能者。

All of these reasons make Python and lightweight framework standing out as a good choice for micro-service.

所有这些原因使Python和轻量级框架脱颖而出,成为微服务的不错选择。

性能 (Performance)

PHP is slightly faster than Python in terms of execution speed(but who cares).

就执行速度而言,PHP比Python略快(但谁在乎)。

I used to be thrilled by the performance gains of PHP over last couple of years. But in today’s cloud computing world, it is becoming less of a concern.

过去几年来,我对PHP的性能提升感到非常兴奋。 但是,在当今的云计算世界中,它变得不再那么重要了。

The biggest impact of performance of your application could be coming from your app architecture, cloud infrastructure and maybe even a block of your code.

应用程序性能的最大影响可能来自应用程序体系结构,云基础架构,甚至可能是代码块。

I hardly hear anyone complaining about a programming language’s execution speed these days. It’s more likely other factors causing a performance problem.

这些天,我几乎没有听到有人抱怨编程语言的执行速度。 更有可能是其他因素导致性能问题。

人才市场 (Job Market)

The mindset in job market right now is that PHP is for building traditional website and it is a little out-dated. Therefore the pay range is usually lower than trending language such as Python.

目前,就业市场的心态是PHP是用于构建传统网站的,而且有些过时了。 因此,薪资范围通常低于趋势语言(如Python)。

It is true a good developer can master any language, however it is undeniable that Python is a sought-after language in today’s market because it is a key skill to have for booming areas such as cloud, AI, data science, cryptocurrencies and more.

优秀的开发人员可以熟练掌握任何语言,这是真的,但是不可否认,Python是当今市场上广受欢迎的语言,因为它是诸如云,人工智能,数据科学,加密货币等新兴领域的一项关键技能。

And you want to future-proof your career. So you might want to consider starting to learn Python today.

而且您想使自己的职业生涯适应未来。 因此,您可能要考虑立即开始学习Python。

简单易学 (Easy to Learn)

With years of experience coding with PHP and JS, it doesn’t take long for me to confidently write Python code and even do it in Pythonic style.

凭借多年使用PHP和JS进行编码的经验,我很快就可以自信地编写Python代码,甚至以Pythonic风格进行编写。

Tricky concept like decorator is similar to that of functional composition of JS. You can always find similarities with your existing skillset. Although it might take some time to learn framework, libraries and tools in Python, the language itself is quite sweet to pick up.

像装饰器这样的棘手概念类似于JS的功能组成。 您总是可以找到与现有技能组的相似之处。 尽管用Python学习框架,库和工具可能要花费一些时间,但是语言本身还是很不错的。

摘要 (Summary)

There are plenty of articles out there comparing PHP with Python, and one with another. Most of them are technical focused. I offered my opinions from a software developer’s perspective as I switched from PHP to Python.

有很多文章将PHP与Python进行了比较,而另一篇文章进行了比较。 其中大多数是技术重点。 从PHP切换到Python时,我从软件开发人员的角度提出了自己的观点。

I was really impressed by the neatness and agileness of Python and excited by its possibilities with AI and data science. It is also trending in job market right now and turns out easy to learn.

Python的简洁性和敏捷性给我留下了深刻的印象,并且它对AI和数据科学的可能性感到非常兴奋。 目前,它在就业市场上也有发展趋势,并且易于学习。

翻译自: https://medium.com/swlh/moving-to-python-from-php-eb9dfa798e8f

python 安卓移至

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值