Live data from Hacker News

PHP 7 Released

github.com

201–210 of 317 posts

Re: PHP 7 Released

#201

Earlier quoted context omitted.

I am an experienced programmer but I've only touched PHP a few times, years ago. What are the best books or tutorials to get an overview of modern PHP?

I think the question is why should you bother with PHP at all? It had its time in the history of the web but that time has passed, long, long ago.

>I think the question is why should you bother with PHP at all?

Because some people just prefer it. They know its warts and have learned to work around it. For me it is a much easier prototyping tool. The crazy number of built in functions and libraries out there makes it so. Eg: Want to turn on and off an IoT device at sunrise and sunset? Well for other languages you have to go find some library or depend on an external service but no not for PHP. For PHP there is freaking built in date_sunrise and date_sunset functions! [1]

[1]http://php.net/manual/en/function.date-sunrise.php

Re: PHP 7 Released

#202

Earlier quoted context omitted.

> instead of playing to the language's advantages and using light-weight tools and libraries that would allow them to move faster. Depending on what you mean by "move faster", I may have to disagree. Besides a one-off script, I can't envision a scenario where using "tools and libraries" would allow you to move faster than using Laravel. Laravel comes with an unbelievable amount of stuff done for you, right out of the…

Until you hit something the framework wasn't design to do (which happens 100% of the time in my experience). Now you're working for the framework instead of it working for you. This guy said it better: “Frameworks invert control. They control the lifecycle of the app, and give you entry points where your code runs. You’re still responsible for the final code, but you’re not in control.” https://aerotwist.com/blog/the…

I'm not a big fan or frameworks for that reason. I do like some of the framework functionality and my apps are relatively small so I ended up going the micro framework route (Silex), using what I want (routing, forms, twig) and basically building the rest of the application in my own way.

Re: PHP 7 Released

#203
post #160

Earlier quoted context omitted.

Weird, I've been using my IKEA bed, wardrobe and drawers for many years now and they're fine. Maybe I'm just happy to make do with convenience - like many PHP developers.

The intersection of the sets 'Ikea furniture owners', 'People that think Ikea furniture is low quality' and 'PHP programmers' isn't empty.

It's interesting how a discussion can end, seriously, what a quote :)

Re: PHP 7 Released

#204

The one thing I'd love to see is a native concurrency story with PHP. I'd put my vote in specifically to have Communicating Sequential Processes. I think that feature alone would take the language to another level. I know they've got stream_select, et al. and I've really enjoyed pecl event, reactphp, and of course there's HackLang's Async / Await if you want to convert, but having some modern / native constructs woul…

PHP has pthreads which are slowly becoming a real thing. There are a few relatively non-minor stumbling blocks in the way, but I imagine that it'll be only 12-18 months between when it can be a priority and when it'll be part of PHP. I expect you'll be able to do true concurrency in PHP in the next ~3 years.

Re: PHP 7 Released

#205

Given how dependent php is on hosts to upgrade, and how slow php hosts traditionally move, it would seem that php would benefit from a 7-to-5 transpiler, similar to Babel for JS. Does anything like this exist already?

Honestly, bigger PHP sites aren't dependent on hosts but on Linux distributions for staying up to date. Once there's an AMI of Amazon Linux and an Ubuntu LTS shipping with PHP7, there should be a huge upswing in adoption.

Re: PHP 7 Released

#206

OK, great! Clicking the main page[1], see the top of README: "build error". Wait, what? You just released it, it should definitely work! Clicking that icon[2], checking the failed build[3]: ERROR: no certificate subject alternative name matches requested host name `pear.php.net'. To connect to pear.php.net insecurely, use `--no-check-certificate'. Really? See what's in http://pear.php.net/ > The server running pear.p…

> In 2015? Cool. Do you actually think there's a point in time where mechanical hard drives are going to last forever? If so I have a bridge to sell you.

I'd wager it's commentary on the lack of redundancy that would allow such an important resource to be unavailable.

Hard disks fail, but if you're hosting something important on them, you might want more than one (to grossly oversimplify things).

Re: PHP 7 Released

#207
post #75

Earlier quoted context omitted.

> What is controversial about AR? How it represents rows as objects. How it makes people think about them. How it conflates modelling the domain with database structure. https://www.google.co.uk/search?q=activerecord+vs+datamapper

> How it represents rows as objects. A row is the DBMS's model of an entity in the domain. An object is an object-oriented programming language's model of an entity in the domain. Representing domain entities as objects in the PL that are backed by rows in a database relation (view or table), which is what the Active Record pattern does, is reasonable. > How it conflates modelling the domain with database structure.…

> A row is the DBMS's model of an entity in the domain. An object is an object-oriented programming language's model of an entity in the domain.

There's why we disagree. I believe the DBMS's model shouldn't be conflated with the application's model. Sometimes the row is an entity in the domain; however consider a normalised data structure, where the entity as the application understands it may span a couple of tables. Or involve data from another source.

My understanding is ORMs were originally developed to handle the mapping between domains, and https://en.wikipedia.org/wiki/Object-relational_impedance_mi....

DataMappers also shine when working against a legacy database or one that cannot be changed. But ActiveRecord is a heck of a lot simpler to work with.

> Modelling the domain should drive both application and database structure

I am luke-warm on this coupling; too often it leads to the application structured around the database representation, as you point out. Sometimes this is sensible (e.g. a data-processing system), but in my experience it comes back to bite later on.

I'm interested to hear your experience - do your application models match the database structure?

Re: PHP 7 Released

#208

I was so excited when I saw this post. Then I realized it's another 'too early' post claiming the tag == release. It's not released until it happens on the PHP site. This is just a tag in the repo. Sure, it likely won't change now, but it could.

PHP 7 has been very stable, but a serious bug was discovered close to launch that made them delay the release by two weeks. There have been no serious issues found since that time, so release should be imminent.

Re: PHP 7 Released

#209
post #136
post #75

Earlier quoted context omitted.

> What is controversial about AR? How it represents rows as objects. How it makes people think about them. How it conflates modelling the domain with database structure. https://www.google.co.uk/search?q=activerecord+vs+datamapper

Soooo one row of a collection represented as an object instance of a collection of instances is bad? Why?

No not at all :)

Slavishly mapping a row in a database table to an application object is bad. Off the top of my head, an example could be a Product, where the tables are something like:

    product - main product details
    product_option - options (e.g. Size, Colour)
    product_option_values - values for that specific option instance
In my application I don't care about the database structure - whether the tables are normalised or storing everything in one huge serialized blob (or CouchDB, or ElasticSearch or... you get the picture). Instead you want to get the options and save changes straight back when editing the product.

Now this is where my example breaks down as the Product needs to 'know' about what options are available (either to provide a nice API or to know what to display in the UI) and my schema doesn't allow for that (save a Product.getAllOptions() method) but I'll leave that as an exercise for my reader :)

Post reply on HN