150 6571
On 20 Dec 2005 13:52:17 -0800, "Chung Leong"
<ch***********@ hotmail.com> wrote: I guess I'm not the only one who's unhappy about the direction that PHP is going. It's larger issue that goes beyond backward compatibility. I see it as a conflict between two points of view: an academic's vs. an engineer. An engineer sees a problem and tries to solve it. The outcome is what matters, while aesthetics and principles are secondary.
I don't agree that an engineer's don't care for aesthetics! In fact,
the products with the best aesthetics are often considered good
engineering.
But I do see a conflict between "solving a problem" and doing it "the
PHP way". I loved the early years of PHP (after switching from ASP)
because each new revision would include some feature I desperately
wanted in the previous version. There were solving problems as fast
as I was coming up with them.
Lately, things have been leaning away from solving problems and more
towards to trying to do things "the PHP way" -- whatever that is. For
example, I want type-hints for all the variable types so I don't have
to double check the parameters to my functions are, for example,
actually integers! That would be USEFUL! But that feature is ignored
because it's not "PHP like".. what the hell. So we have to write
type-checking code over and over because they don't want to pollute
the language with a useful feature? That's far from the only example.
I think PHP5 was a good step in the right direction in principle. We
need the features that it provides. But then there's lots of
overengineering going on as well -- especially with respect to the
built-in classes; there's a dozen different iterator types but I've
never used a single one of them -- and I haven't seen any code that
does either. What problem is all this code trying to solve?
On 20 Dec 2005 23:53:00 GMT, "Default User" <de***********@ yahoo.com>
wrote: If you deprecate something, and no one cares, then it can be removed quickly. On the other hand, if it will have a huge affect, then it's smart to wait and see.
Of course, given that PHP issues a warning (under E_STRICT) for
depreciated elements the effect is pretty huge always. Unlike
compiled languages like C/C++ were the warning exists only at compile
time, PHP warnings have a much bigger effect.
How much time? THAT is the question. There are some deprecated elements in C and C++ that expect will outlive me.
PHP should move at a much faster pace than C/C++. There are
significant differences between the platforms, the applications, and
the environments that they aren't entirely comparable. Since PHP5
breaks so much backwards compatibility anyway I don't think
depreciated elements should stick around as long -- it's not as if you
have as much legacy code around that is running that is not already
being modified.
PHP also has way more mistakes in it than, for example C/C++, that
should be corrected. PHP started out as a big ball of hacks!!
Oli Filth wrote: Engineering isn't just about finding the first thing that works, it's about finding the best solution given particular constraints, and hopefully thinking about aspects such as long-term maintenance as well.
Normally, it might be true that aesthetics and principles are secondary, but in the case of a computer language, these two qualities are often intrinsically related to the semantics, structure and useability, and so can't be ignored. Ignoring them is what led to PHP 4.
"Secondary" hardly means "it should be ignored." To spell out the
obvious, secondary means "not primary" and objectives that are
secondary do not take precedent over those that are primary. The
primary objective of PHP is to run PHP code. If a new version of PHP
cannot run a piece of existing code, then it fails. In engineering, of
course, failures aren't always avoidable and might be acceptable
provided that they're small or happen rarely. To argue though, that if
we fail once we should fail some more, is simply crazy.
By most measures PHP 4 has been a great engineering success so I don't
know what you're hinting at.
I think the developers have realised, however, that there are millions of programmers out there who are used to OO features (for example) in more "structured " languages, but laughed at PHP 4's attempt at OO, and still laugh at the mish-mash nonsense of inconsistency that litters PHP 5. To attract these hardened programmers who are used to the formalities of, for instance, Java, and view PHP as a toy not to be used for any serious purpose, the developers know that from now on, the future of PHP needs to be *planned* rather than *hacked*, and some of the embarrassing legacy swept under the carpet.
Well, implementing something because critics are laughing at you is not
exactly good engineering now is it? Embarassment is hardly a technical
parameter either. Vanity is a trait of many an academics, so I think
you're proving my point.
Unfortuantely (well, maybe not, depending on your opinion), that may be at the expense of the "PHP is great for hacking together any old unprogrammatic atrocity" ethos. But then again, that ethos is the self-fulfilling prophecy that fosters the liberal use of eval(), numbered variables rather than arrays, dynamic class definitions, code replication and nested-ifs instead of polymorphism, etc., etc...
Bad coding won't get you any closer to a working program so I don't see
the logic in this prophecy of your. What I do know is this: a working
program is better than a non-working one with polymorphism.
To properly design a language, it necessarily involves a large amount of "academic" input - in the sense that it involves sitting down for a *long* time and working out the whole plan in fine detail.
Computer languages are called languages for a reason. Fundamentally,
that's how they're used: a programmer is communicating his desires to
the computer. A good language allows its user to efficiently express
the widest range of ideas. As no one can anticipate what others will be
thinking, a language developed unguided by usage will inevitably be
overly introspective that cramps people's thought. It's no accident
that PHP is as successful as it is. The ad hoc manner by which it
developed is the source of its strength, not its weakness.
That was the linguist in me speaking :-)
Wayne wrote: On 20 Dec 2005 23:53:00 GMT, "Default User" <de***********@ yahoo.com> wrote:
If you deprecate something, and no one cares, then it can be removed quickly. On the other hand, if it will have a huge affect, then it's smart to wait and see.
Of course, given that PHP issues a warning (under E_STRICT) for depreciated elements the effect is pretty huge always. Unlike compiled languages like C/C++ were the warning exists only at compile time, PHP warnings have a much bigger effect.
How much time? THAT is the question. There are some deprecated elements in C and C++ that expect will outlive me.
PHP should move at a much faster pace than C/C++. There are significant differences between the platforms, the applications, and the environments that they aren't entirely comparable. Since PHP5 breaks so much backwards compatibility anyway I don't think depreciated elements should stick around as long -- it's not as if you have as much legacy code around that is running that is not already being modified.
PHP also has way more mistakes in it than, for example C/C++, that should be corrected. PHP started out as a big ball of hacks!!
Wayne,
I agree with you. Deprecated elements should be removed eventually. Not
necessarily the next release, but they shouldn't be kept around forever,
either.
And if Default User needs the function that badly, he can always
recreate it. Most deprecated functions can be recreated with other PHP
code. And if it can't, he can always go back to the previous version's
PHP source and compile that section of the code into the new PHP version
(or at least something which does the same). A definite advantage of
having the source!
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp. js*******@attgl obal.net
=============== ===
Q: "Can you name me one single problem where introducing
case-sensitivity was the solution?"
A: Consistency.
Inconsistency is not a "real" problem as it does not cause the program
to produce wrong results. The fact that you personally like all
variables and function names to be in one case or the other is nothing
but a personal view and should NOT be forced upon others.
The idea of consistency might be good in theory, but the fact that this
allows the SAME word to have DIFFERENT meanings just because of a
slight change in case is far more serious. But that's just my opinion.
>> You are not improving the language, you are killing it. On the contrary. PHP could be a *lot* more strict in my opinion. I like
the type hinting in PHP 5, as it saves me a *huge* amount of work in
parameter checking.
Type hinting is good, but this is an *addition* to the laguage that has
no effect on existing code.
If you following "design by contract", you either
accept a parameter as valid and do something with it or reject it. Most
legacy code I encounter just accepts anything and hopes it does not
explode. Yuck. I even don't like the automatic string-number
conversion.
If I pass a string to a numeric function, there's something
fundamentally wrong with my code.
Automatic string-number conversion is there for a very good reason -
all input received from the HTML form is delivered as a string
regardless of whether it's supposed to be a date, a number or whatever.
The *feature* means that the programmer does not have to waste time
performing manual type conversions before being able to process each
field.
I don't want that covered up by the
language, I want to get a decent error message. *Off course* foreach
should give an error when something other than an array is passed!
If you give it a string or a number, yes. But insisting that a null
value cannot automatically be treated as an empty array is going over
the top.
>> ... Please notice that 'breaking existing features' does NOT appear in that list. Times change. Live with it. Acient DOS programs do not run under
Windows. Lots of Windows 3.1 drivers are totally useless for Windows
95.
Comparing a computer language with an operating system or device driver
is wandering off track. Expecting an ancient DOS program to run under
the latest version of Windows is unrealistic. I would, however, expect
a DOS program to run under *any* version of DOS just as I would expect
PHP code that I wrote last year to run under next year's version of
PHP.
>> ... Providing an elegantly-coded solution, or a technically pure solution, is secondary. Where have you been for the last 20 years? In the 80s, we programmed so
the computer could understand it. Now we program so your computer *and
your colleague* can understand it. Code has grown larger and larger and
is rarely written anymore by one lonely hacker who stays with the
company for 30 years. Legibility is everything.
You are missing the point. Writing code that satisfies the end users
takes a higher priority than writing code that satisfies the
programmers. Clean code that does not satisfy user requirements is
useless. Code that *does* satisfy user requirements, whether clean or
dirty, is a step in the right direction. Having code which is both
useful and clean would be perfect, but in this cruel world nothing is
ever perfect.
So, PHP makers, if you are reading this:
Please, please, please, *PLEASE* drop the ternary operator from future
PHP versions! Just read the legacy code I'm confronted with and you
understand why.
Now there I would agree 100%. Every time I see the ternary operator I
want to puke.
>> If it ain't broke, don't fix it Again, where have you been in the last 20 years? If a statement does not
appear to be executed because it "silences" any error condition, you
have a hell of a time finding bugs. PHP code can be very hard to read
because of its un-strictness. When I see a parameter initialised as
FALSE, I assume it is a boolean. I mean, the initialization is also
documentation. You see the parameters in your editor wherever you use
them. But it may be an array, a string, or whatever. But FALSE will not
break the code. You can write monstrous code that coincidentally works
with the parameter types you pass. Now code that is illegible is not
legible by your collegue either, *SO IT IS BROKE*. And, *YES, IT NEEDS
TO BE FIXED*.
You are missing the point. I'm talking about the situation where a
developer looks at an existing function which works in thousands (if
not millions) of scripts, and decides that the code is not elegant or
clean enough for his taste, so he decides to refactor it, but this
refactoring then breaks a lot of scripts. The argument that the code is
now *cleaner* or *purer* is irrelevant to the customers - all they know
is that previously valid scripts do not work any more. They do not care
if the code is clean or dirty, just that it keeps on working as
expected.
>>When you speak of 'proper' languages you mean 'languages that you are used to'. But why should the syntax of PHP be changed just to suit the preferences of a few individuals? The PHP syntax is based on C and C++ -- it's doesn't really have it's
own syntax. Every syntax element in PHP is borrowed, in some way,
from other languages. I'm really not sure what you're arguing against
here.
The origins of PHP syntax are irrelevant. What I am objecting to is
that people moving to PHP from other languages look at the current PHP
syntax and see that it is different from what they are used to, and
they want it to change so that they do not have to cope with the
differences. If they cannot learn to cope with the differences then
they should not bother trying to use a different language. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jason Mobarak |
last post by:
Greetings!
Say that it's desirable to provide backwards compatibility for methods
of an object, consider the case where...
class Foo:
def bar (self, a, b):
pass
....is a defined class that can be serialized and later be deserialized.
|
by: Sonny |
last post by:
I need to port a library that is written entirely in C to C++. The
library is supported on quite a few platforms (windows, Solaris,
Linux, AIX, HP-UX, OSX, etc...) and there's quite an existing customer
base that uses it. I need to maintain backwards compatibility such
that existing users won't have to do anything to their existing
applications other than a re-compile when they upgrade to this new
version of the library. I figure that I...
|
by: py |
last post by:
I have function which takes an argument. My code needs that argument
to be an iterable (something i can loop over)...so I dont care if its a
list, tuple, etc. So I need a way to make sure that the argument is an
iterable before using it. I know I could do...
def foo(inputVal):
if isinstance(inputVal, (list, tuple)):
for val in inputVal:
# do stuff
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |