9,867 karma · joined Aug 20, 2015 (11y ago) · 5,528 submissions
comment 10y ago · link · parent
But (this is unrelated matter) why is it possible to steal someone's money just by copying several short numbers? We have all kinds of advanced cryptography today but some payment systems still rely on transistor era technologies.
And even worse, companies can track customers using CC numbers. That is wrong too. The shop should not get your name or other unique identifier when you just buy something with a card.
comment 10y ago · link · parent
Oppressive governments can do even worse things to human rights activists, like banning a person from international travel (like Mr. Snowden or Wikileaks founder) and getting them extradicted from other countries.
comment 10y ago · link · parent
> Why do backbones allow it to be carried?
Because they get paid for any traffic passing through. The more traffic they have the more profit they earn.
comment 10y ago · link · parent
And investigation is difficult because attacking nodes might be in different countries, in some of which DDOS attacks are not illegal.
Maybe it is time to start building international firewalls to protect local infrastructure?
comment 10y ago · link · parent
I use Chromium (because unlike Chrome it is open source). Video playback doesn't work even on twitter and vimeo (who can afford to hire good developers) let alone smaller websites. But it works on Youtube (not always, some videos require flash) and Wikipedia.
UPD: That is why I think people sould learn from Wikipedia developers and not some hipster guys explaining how to connect Redux to Angular2 using ES7.
comment 10y ago · link · parent
In fact google just doesn't want to moderate illegal content. It doesn't even remove the websites with infringing material, only single links.
comment 10y ago · link · parent
comment 10y ago · link · parent
By the way, PHP has type hints for functions that help to understand what are the types of arguments and the return type.
comment 10y ago · link · parent
This code might also include HTML templates and CSS or JS files that can easily grow large.
comment 10y ago · link · parent
Improving and perfecting the code is a task that can take infinite amount of time.
comment 10y ago · link · parent
The "SQL and arrays" approach is much worse and doesn't scale. Without ORM and classes you will get undocumented JSON trees (or arrays) passed around.
> http://solnic.eu/2015/09/18/ditch-your-orm.html
It seems to me that author wants to replace complex approach (OOP and ORM) with even more complex one. So instead of having one object representing an entity we can have ten objects representing the entity at different moments in time. So we have to find out which one is the latest. And we will need even more memory to keep them.
He writes:
> There is no User but it’s very likely there is SignupUser.
And soon there will be LoginUser, GuestUser, ProfileEditUser, UserForReport and others. And a bunch of methods to convert between them.
I don't understand what is the problem with mutable entities. They are supposed to be mutable. I never had problems because of functions modifying arguments given to them.
I don't believe functional programming can be use instead of OOP. Can you represent a DOM tree, collection of GUI widgets, a graph of related database entitites, a form with validation rules with functional programming? You will just end up emulating classes and objects.
The author probably just likes the idealized concept and did not try to apply it to a real world application (but if anyone did it would be interesting to see the code).
I also took a look at Ruby Object Mapper he mentions in a post and don't really like it. It uses arrays (that are called ROM::Struct there) a lot and I don't see much functional programming there.
I also have read this article http://seldo.com/weblog/2011/06/15/orm_is_an_antipattern and I partially disagree with the conclusion. Using key-value storage instead of a database is generally bad idea. It doesn't solve "N + 1 queries" problem, it doesn't provide foreign keys (and often transactions), and you have to write messy custom code instead of shorter and better readable SQL query (example: https://www.kchodorow.com/blog/wp-content/uploads/2011/12/SQ... ).
comment 10y ago · link · parent
But it has other advantages: you can use objects for your models, you can use lazy loading and relations between models, you don't have to save modified entities explicitly. So it helps to avoid writing low level code for saving and loading data from a database. You don't have to write routine methods like "get something by id", "get tags for post" or "update a field in a table".
> it encourages the promiscuous mingling of code and behavior, and makes it very difficult to produce code which can be understood without reference to complex interactions among many instances of many classes.
That might be over-engineering. OOP doesn't require you to use every single pattern from a book or build multilevel hierarchies of abstract classes. Abstract classes and interfaces might be necessary when you try to build reusable libraries or components but you don't have to use them inside a monolith application.
But you need to learn things like single responsibility principle so you can divide complex tasks into smaller parts. You have to remember that your code will be maintained by other people so it needs to be easy to understand without searching through all the codebase and hard to break.
And whatever approach you use when you have an application with large codebase written by many people it will be complicated anyway. OOP can help you to organize this code.
> ORM in a typed language
PHP is not statically typed language but you can use type hints for functions. So if you have an argument with a class name specified you can quickly look up what properties and methods the object has (and your IDE will suggest autocomplete options). And you cannot have any such information if the argument is an array.
I used to work with large applications written using "SQL and arrays" approach and they were bad. I had to spend most time figuring out what kind of array is passed to some function and how it is used to display something on a page. And it is hard to check if you don't break something by removing or changing a single element in that array. That is why I think this approach is not scalable beyond small applications written by a single developer. It has no relation to whether mixed arrays are allowed in a language or not. You can get same kind of code if you misuse collections in Java or C# or maybe Go.
You can look at Drupal if you need an example of complex open source application with those problems. It passes a lot of arrays around that are not even documented anywhere. And as an example of OOP application you can see Magento. It is large and very customizable so they had to use different abstractions.
comment 10y ago · link · parent
{{ var }}
That is a big difference because beginners always forget about escaping.> Nevertheless, I used DOM/libxml on the server side in PHP/C,
There used to be XSLT templates but they don't seem to be popular now. Constructing DOM trees in the code without using templates is probably inconvinient and produces bloated code.
comment 10y ago · link · parent
And when you get to more complicated characters like 感 it becomes even more confusing.
comment 10y ago · link · parent
That is why you should prefer Twig or other templating engine with autoescaping.
> They all start as an attempt to remove the possibility of writing meaningful code
I don't think so. Twig developers have a large list of reasons on their frontpage: http://twig.sensiolabs.org/