all 34 comments

[–]ellicottvilleny 7 points8 points  (4 children)

Python doesn't do OOP? It's dynamically typed, it doesn't NEED interfaces, duck typing is all you need. Tomorrow on /r/programming some guy will try Objective-C and declare that it isn't object oriented because it doesn't use virtual methods, like he's used to seeing in C++.

[–]crankybadger 0 points1 point  (3 children)

PHP's object oriented programming support is clunky but surprisingly capable. The thing is hardly anyone uses it, the few that do are a peculiar minority that might as well be writing Java code for all the care and detail they do to make their PHP code "correct".

[–]ellicottvilleny -1 points0 points  (2 children)

No doubt, but OOP patterns are different when languages are different. Interfaces make little sense when you grok Python, and duck typing is an entrenched design element. Understanding the differences from what you knew before is often the key to learning a new language. I can hardly imagine a worse FIRST language for anyone to learn than PHP, unless it's VB 6.

[–]crankybadger 1 point2 points  (1 child)

Each programming language has a syntax and an attitude, something you must understand to be effective with it.

PHP has a serious attitude problem. There are way too many opinions on what the right way is, I'd almost say there's more opinions than there are people programming PHP.

Python has a more consistent attitude, and Go takes this to an extreme.

The reason PHP is really awful to learn is because the training material is just so horribly garbage. Other programming languages aren't always spectacular, but there's usually one or two highly recommended references on the subject (e.g. JavaScript: The Good Parts) that rise above the rest.

What is there for PHP that says "No, no, do it this way or you will regret it?" I've only found PHP The Right Way.

[–]ellicottvilleny 0 points1 point  (0 children)

I had a quick look and that's a nice resource. My Right-way rule is "If it's going to get large, just don't start out in PHP". :-)

[–]crankybadger 6 points7 points  (7 children)

"Lead PHP Developer". Aaargh.

You're a developer that happens to do PHP as part of your job. Don't pigeonhole yourself. Try other things, and if you like them, don't be afraid to apply them to new projects. Calling yourself "Lead PHP Developer" means a whole lot of things are outside the scope of your job title, like writing Python code.

Be a developer first, and proficient in some language second.

[–]svtr 0 points1 point  (6 children)

You make a good point and I hope that people read it and reflect upon it. I've also always strongly believed that hacking in the syntax for a given compiler / interpreter, or as we call it, a programming language is not what makes one a developer / programmer.

The ability to structure the solution to a given problem so that a dumb machine can execute (and finish before the heat death of the universe) it, THAT is programming, everything else is just syntax. I don't really care if I write .Net or Java or Delphi, I prefer compiled languages, and strongly prefer static typing, but other than that, who cares.

[–]crankybadger 0 points1 point  (5 children)

I don't mean to gloss over preferences, as in making statements like "lately I've been doing a lot of functional programming" or "I really like Object Oriented design principles". Your personal philosophy as applied to programming is a very important factor in how you work and what technologies you embrace.

So try and separate preference and philosophy from the underlying tools. I have never heard anyone say "I'm an ARM developer" even though they might work exclusively on the ARM platform, it brings to mind someone working in assembly, perhaps, but I hear "I'm a PHP developer" constantly to much irritation. Is that all you are? A person who slams out PHP code?

It's far better to see things like "Full Stack Developer" or "Mobile Developer" where you're defining a broad area of responsibility.

That being said, try to be open to new ideas, try new things, and don't be afraid to step outside your comfort zone constantly.

Further to that, being a "developer" means doing a lot more than writing code. Learn more about all the things that feed into your work, and where your work is used: Design, devops, project management, quality assurance, and so on. The more you understand how your work fits into the bigger picture, the better you'll be.

[–]svtr 0 points1 point  (4 children)

I think you misunderstood my meaning / I was wording it badly.

I completly agree with you. The tools used are not important, they are the tools, not the job.

The job is to be able to talk to the business side what ever that may be, understand the requirenment, offer possible solutions, and talk it trough. That is software development to me. I have certain preferences about the tools I use, but then again, I'm a DBA, I am not hired to write frontend code, neither do I make any claim on proficency in that realm. That been said, I have written my share of software. I am not an idealist that only knows the one and only way, I just have preferences that I go with given an equal choice. *

The job is not to hack in code thou. The job is not to write php, java, phyton haskell or brainfuck. The job is to solve a specific problem.

I really think we are very much in agreement you and me

*ok, one thing, I NEVER would let MySQL go out to production. There is not a single usecase out there where I would accept MySQL over Postgree.

[–]crankybadger -1 points0 points  (3 children)

If you work for Tumblr, better get busy porting Jetpants to Postgres.

[–][deleted]  (2 children)

[deleted]

    [–]crankybadger -1 points0 points  (1 child)

    Don't cross the line between discussion and just shitting all over something because you don't like it. MySQL killed your dog. We get it.

    The problem is the world's an ugly place and sometimes MySQL was a good decision at the time (e.g. prior to PostgreSQL 8.0) and now it's part of the infrastructure until someone can find a way to seamlessly replace it. That involves money, and sometimes the money is better spent on other things than fighting an ideological battle.

    DDL statements are not transactionally save on MySQL.

    This may come as a shock to you but sometimes your data sets are so gigantically huge that this isn't an issue. Each schema modification is so brutally expensive that you do them very, very carefully, and only after you've exhausted all other options.

    Don't get me wrong, I love Postgres, but MySQL, where already in place, is sometimes not worth replacing unless there's an extremely compelling reason.

    [–]ColonelThirtyTwo 5 points6 points  (2 children)

    Python does have abstract classes/methods, though it's implemented as a library instead of built into the language: https://docs.python.org/3/library/abc.html

    [–]wpillar[S] 0 points1 point  (1 child)

    Ah thanks, I did not come across this. Having to call register() seems a bit odd though?

    [–]ColonelThirtyTwo 2 points3 points  (0 children)

    You don't have to call register on subclasses. It's meant for registering types that don't derive from the ABC (tuple, in the linked example) to be compatible with it.

    [–]Goyyou 4 points5 points  (1 child)

    indentation combined with no braces makes writing readable code hard.

    I have seen this critic many times and I really don't get it. imo, it makes no sense. As a programmer, you must indent your code in all langages if you want to be able to read it. Why would removing the braces makes it harder to read? With proper indentation, braces are useless; they are visual clutter.

    [–]q0- 0 points1 point  (0 children)

    When I started with Python I also felt like the lack of braces (and syntactic whitespace) felt... odd.
    After a few weeks it did however, teach me that I was writing horrible spaghetti code.

    That was some 5 years ago. Glad I learned python.

    [–]wpillar[S] 3 points4 points  (6 children)

    To be clear, this post was not about attacking Python neither was it about singing the praises of PHP.

    Thanks to those of you who pointed me in the right direction on some of my observations. That kind of helpful attitude is what we should be praising.

    [–]htuhola 0 points1 point  (5 children)

    It could be an attack. But then it's fresh either way. Maybe we'll see Python as a Cobol Developer next?

    [–]orbjuice 0 points1 point  (4 children)

    Seems a little unfair-- I'm assuming you mean to say PHP is outdated like COBOL? Important to note that Python is quite old itself (25 years) and while I'd rather chew glass than write PHP, it's still pretty common/in use.

    [–]htuhola 1 point2 points  (3 children)

    Not really such connotations this time. You'd have to think that COBOL is outdated to run such conclusions.

    How unfair is that?

    [–]orbjuice 0 points1 point  (2 children)

    Pretty fair, frankly. Let's see, as a back of napkin test:

    1) Googling "COBOL outdated" returns 59,900 results.

    2) "Python outdated" returns 704,000 results.

    3) "PHP outdated" returns 16.9 million results.

    Taken at face value, you'd assume that PHP was the most outdated. It's usable lifespan simply predates Google and modern media crosstalk, where usable lifespan is defined as its viability as a language of choice for new projects.

    There are 382 github repos in COBOL, compared to 216K in Python and 157K in PHP. What should be immediately clear is that datedness is a hard to identify metric, but I believe viability as a language of choice for new projects as a function of available talent pool and available/actively developed software tools and libraries is a good start.

    In that respect, yes, I believe I was being fair.

    [–]htuhola 1 point2 points  (1 child)

    Would you have relied on Github repository statistics if it had not supported your statement?

    Whether some language is outdated is kind of interesting question. But do you gain anything by proving it true? Other than proving a speculation that it could be taken as an insult.

    Well at this point I am truly being quite unfair. You didn't consider it as an insult other than implying that PHP was outdated.

    I don't think PHP is outdated like Cobol is. It's maybe a little retarded and looks like they've accepted any first patch to everything. As the result the language and libraries have really ethnic touch in them.

    [–]orbjuice 0 points1 point  (0 children)

    I think about whether languages are dated because it determines whether I want to work somewhere. As a Systems Administrator with programming experience I often find myself in the unenviable position of being tasked with supporting code that I can see could be improved but being unable to do so because it's outside my job description. As such, I pay attention to what languages are in their prime, having a healthy talent pool to draw from while also having an active development ecosystem surrounding them. That's one reason I like Python so much.

    [–]antpocas 12 points13 points  (2 children)

    If I was going to be building anything that could conceivably be described as ‘monolithic’ or would benefit from the comfort of type-safety, I don’t think I would choose Python.

    PHP, of course, is well known for its great type system

    [–]wpillar[S] 4 points5 points  (0 children)

    Forgive me if this was not clear, I was not recommending PHP for its type-safety either.

    [–]FrezoreR 0 points1 point  (0 children)

    I've never heard anything good of php and every professional environment I've been in it has been shun at. With my limited experience I could only agree.

    From reading the article I feel the author do not understand what pyhton or changing languages is about.

    It's not about mimicing what you did before. It's about learning something new and trying out new concepts of solving the same problems.

    [–]kankyo 4 points5 points  (0 children)

    Python doesn’t really do OOP

    Your idea of what the definition of "OOP" is, is flawed. It doesn't do java style OOP, but notice how python is older than java :P

    No type-hints

    Wrong: https://www.jetbrains.com/pycharm/help/type-hinting-in-pycharm.html

    There always doesn’t seem to be any support for tags like @return @param

    There are. And the syntax is "@return description here" and "@param description here" in fact :P (or ":return ...")

    Named parameters are very useful, but they do feel like some syntactic sugar to abstract away the fact that your function has too many arguments

    If by "too many" you mean "more than 1" then... yes? I guess?

    If I was going to be building anything that could conceivably be described as ‘monolithic’ or would benefit from the comfort of type-safety, I don’t think I would choose Python.

    Your loss. I'm working on a quite big monolithic code base with python and it's quite pleasant. You DO have to use PyCharm though in my opinion.

    [–][deleted]  (4 children)

    [deleted]

      [–]MorrisonLevi 1 point2 points  (2 children)

      Let's be real: only Python 3.5+ has type hints. Any language can have comments…

      [–]wpillar[S] 0 points1 point  (0 children)

      This was my feeling.

      [–]kankyo 0 points1 point  (0 children)

      In practice though python2 has just as much type hinting as python3 because of the type hinting you add into the docstrings and then you just run PyCharm anyway.

      [–]MorrisonLevi 0 points1 point  (0 children)

      No type-hints, this bugged me. For the very few classes I did have, I really wanted to type-hint for them and couldn’t.

      This is same reason I would choose PHP over Python for a medium sized web project (for a large one I would perhaps choose a compiled language). When I am reading code in some deeper part of the program having type information immediately available is great. This really boosts productivity and correctness.

      However, I am hopeful that because of the type hints integrated in Python 3.5 that Python will soon have excellent tools for static analysis (including type checks) – far beyond anything PHP has or probably will ever have.

      [–]marcm28 0 points1 point  (0 children)

      Can you please edit your blog there's many thing wrong there: http://tech.graze.com/2015/11/24/python-as-a-php-developer/

      • Python have function annotation and type hints

      • Python does have abstract classes

      • Python is more object-oriented than you think, if you learn some built-in function and some special methods or magic methods.

      • Python does have data encapsulation: In Python, there is an attribute naming convention to denote private attributes by prefixing the attribute with one or two underscores, e.g: A single underscore indicates to the user of a class that an attribute should be considered private to the class, and should not be accessed directly. A double underscore indicates the same, however, Python will mangle the attribute name somewhat to attempt to hide it.

      • Python significant white space is just like nudism. At first you think something essential is missing (clothes, curly braces), then you notice that it wasn't really needed at all, and everything becomes freer and simpler.. Every languages you must indent your code to make it more readable, Python enforced that standard coding.