 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
DZone.com: The Duck is a Lie
by Chris Cornutt June 27, 2012 @ 09:55:22
In this recent post to DZone.com Giorgio Sironi looks at duck typing and compares it in a few different languages (PHP, Ruby and Java). "Duck typing" is where the methods/functions define the structure or common interface rather than being functional.
What follows is my experience with Java, PHP and Ruby. I mainly use PHP as a dynamic language that supports duck typing but also the definition of Java-like interfaces, but does not force any of the two approaches as you can define interfaces whose method arguments accept any variable or not using interfaces at all. Is duck typing that a revolution?
He shares some of the common misconceptions he's seen including the idea that duck typing can help completely different objects work together and that, sometimes, despite naming conventions, functionality was intended to be different. He shows how even interfaces in PHP can be implemented loosely and the "acts as" and "single callback" architecture ideas.
voice your opinion now!
duck typing interface misconception actsas callback
Pim Elshoff's Blog: In favour of typing
by Chris Cornutt April 25, 2012 @ 13:57:38
Pim Elshoff has a new post to his blog that shares his preference on typing (keystrokes, not variables) in applications (hint: he likes it):
We sometimes conceive of ideas that are arduous to express in code. Like persisting data, or some other uncommon task (sarcasm). It's not difficult, but it takes a lot of keystrokes to write. Being problem solvers, we find it difficult doing this kind of manual labour, especially when machines can do it for us. Still, I would like to take this opportunity to say that typing rocks and solutions that save typing suck.
He talks about the abstraction that frameworks provide (less typing, more work) and and some of the "magic" that comes with them. He gives specific examples of some of his pervious experience with frameworks (including some pains with Symfony2) and how some of the magic he's seen is easy to write but hard to read.
voice your opinion now!
favor typing keystrokes framework magic opinion
Evert Pot's Blog: Numeric string comparison in PHP
by Chris Cornutt April 26, 2011 @ 09:23:47
In this new post to his blog Evert Pot reminds you (the PHP developer) about the loose and strict typing checks that you need to do when checking the values of your variables and never just assume. PHP's loose typing tendencies can cause issues if you're not paying attention.
As long as you make sure you always use strict checking (=== and !==) where you can, and fall back to the loose checks when you must. As a PHP developer, I think it's very important to understand and memorize exactly how these work, whether you're writing new code, or maintaining existing code.
He points out a specific example of some code that seems counter-intuitive when you compare how it reads and how it actually works (strings converted to floats and evaluated)
The moral is: always do strict checks when you are able to.
voice your opinion now!
numeric comparison evaluate loose typing typecheck
Giorgio Sironi's Blog: Java versus PHP
by Chris Cornutt April 16, 2010 @ 10:55:19
In a new post to his blog Giorgio Sironi has a (more balanced) comparison of Java versus PHP that them on topics like how they handle typing and their execution models.
If you exclude C and its child C++, the most popular programming languages in the world are Java and PHP, which power most of the dynamic web. I have working experience with PHP and for academical purposes I am deepening my knowledge of Java, thus I'd like to point out similarities and key differences between these two languages. Every language has its pros and cons, so there's no absolute winner here.
He briefly covers their history, java's static versus PHP's dynamic typing, how they both handle objects, their execution plans and how easy they are to deploy when it comes to general applications.
voice your opinion now!
java comparison typing oop execution infrastructure
Jani Hartikainen's Blog: Static/Dynamic typing sweet spot
by Chris Cornutt October 08, 2008 @ 10:24:28
In a new post today Jani Hartikainen takes a look at one of the things that makes PHP both powerful and unpredictable at times - its variable typing, static versus dynamic.
It seems that PHP has moved a bit towards static typing, and languages like C# seem to be implementing some dynamic features. Are we going towards a "mixed" language with static and dynamic typing? What's the "sweet spot" between completely static (like C++) and completely dynamic typing (like Python)?
He compares the benefits of static and dynamic, and a particular place where PHP falls a bit flat - type hinting in certain situations. He agrees, though, that dynamic typing is "the way to go" since it gives the developer the flexibility they might need for more "typing tricks" in their apps. Oh, and "duck typing"...
voice your opinion now!
static dynamic typing type variable hint compare
Matthew Turland's Blog: The Yin and Yang of Typing
by Chris Cornutt February 01, 2008 @ 11:58:00
A little while back Matthew Turland posted about something that some developers moving over to PHP from more strict languages have an issue with - variable typing - and how its evolved in languages over time.
Without a little background in programming languages or computer science in general, it's entirely possible that typing systems are not something that have crossed your mind. I thought I'd take a blog entry to share some of my thoughts on how it's affecting the creation and evolution of languages.
He walks through history a bit, mentioning C, Java, Python and PHP and how they differ in their default type handling. He especially focuses on the "blurred line" between strong and weak typing and how some if offers special features to the language that uses the method.
voice your opinion now!
typing strong weak strict dynamic java python c
|
Community Events
Don't see your event here? Let us know!
|