by Kevin Schroeder | 12:00 am

Implementing asynchronous functionality in Magento

ECommerce is a small thing, right? Nobody’s doing it and it’s so simple that everyone who does it is doing it right. When that Cyber Monday hits, nobody panics; sites stay up, they’re able to handle the load and nobody gets yelled at, right?

OK, maybe 20 years ago.

  READ ARTICLE
1568 words ()
by Kevin Schroeder | 12:00 am

Objections to dynamic typing

I am about to head out to Magento Imagine to speak on queuing and scalability. So what is today’s blog post about? Dynamic typing; which has absolutely nothing to do with scalability.
Every once in a while I inject my opinions into places where they are not welcome. I have heard from people in the staticly-typed realm of how amateur dynamic typing is. Some people are interested in understanding how to use dynamic typing, others, not so much. So what I would like to do is talk about some of the arguements made against dynamic typing. Clearly PHP will be my reference point, but many of my points will be salient across many dynamically typed languages.
The biggest misconception about PHP is that it is a strictly dynamicly typed language. In other words that cannot have typed variables. Where you are using the OOP mechanisms in PHP, you have the opportunity to strictly type your variables.class Test {}
class ExecuteTest
{
public function exec(Test $test)
{
doSomethingWithTest($test);
}
}
$et = new ExecuteTest();
$et->exec(new Test());
What happens when this code gets compiled?Catchable fatal error: Argument 1 passed to ExecuteTest::exec() must be an instance of Test, instance of Test2 given, called in test.php on line 17 and defined in test.php on line 9
Fatal error. This is because the type of object passed in was incorrect. So data types do exist in PHP and many other languages. The only downside is that you need to actually run the code on your web server or in a unit test to compile it. Some would (and have argued extensively) that this is a significant drawback. There’s truth to that, but on a very limited scope. Is it a drawback? Yes. Is it signficant? Not by a long shot. Whether it’s PHP, Java, C, Perl, Ruby, VB, C#, JavaScript, etc. etc, if you deploy code that you haven’t tested then you deserve every error and every sleepless night you get. It’s called being responsible for your code. And don’t think that having your code pre-compiled is much better. I have a lot of compiled applications running on my computer. Cakewalk SONAR, Firefox, Apache, PHP (the binaries), MySQL, Tweetdeck, Java, etc., etc. And you know what? Shit still happens with compiled code! Sometimes even type-related errors! Compiling your code ahead of time as you do with C, Java, and the like does not protect you from type-based errors. Can you catch some fat-fingered errors? Sure. Are you safe? No.
For example, take this Java codeSystem.out.print(
Integer.MAX_VALUE
);
Running it provides an output of2147483647
What about this code?System.out.print(
Integer.MAX_VALUE + 1
);

  READ ARTICLE
1577 words ()
by Kevin Schroeder | 12:00 am

ZendCon 2010 Podcast – Pragmatic Guide to Git

Speaker

Travis Swicegood

Abstract

Git is hard; at least if you listen to the naysayers. Actually, you need to know a handful of commands to navigate Git successfully. This talk demystifies Git. Once we’re finished you’ll know everything you need to start using Git in your day-to-day projects and collaboratively with other developers..

Licensing:

The ZendCon Sessions are distributed under a creative commons Attribution-Noncommercial-No Derivative Works 3.0 License, Please honor this license and the rights of our authors.

  READ ARTICLE
218 words ()
by Kevin Schroeder | 12:00 am

ZendCon 2010 Podcast – Unit Testing in Zend Framework 1.8

Speaker

Michelangelo van Dam

Abstract

Zend Framework 1.8 has improved and simplified how you can test your applications, providing you with excellent techniques to streamline your quality assurance processes and reduce your maintenance costs.

Licensing:

The ZendCon Sessions are distributed under a creative commons Attribution-Noncommercial-No Derivative Works 3.0 License, Please honor this license and the rights of our authors.

Slides

  READ ARTICLE
219 words ()
by Kevin Schroeder | 12:00 am

ZendCon 2010 Podcast – Introducing Zend Framework 2.0

Speaker

Ralph Schindler (Penn) and Matthew Weier O’Phinney (Teller)

Abstract

Zend Framework has grown tremendously since the first public preview release in March 2006. Originally a slim, MVC framework with a number of standalone components, it has grown to a codebase more than 2M lines of code. Work now turns to version 2, with goals of increased simplicity and advanced PHP 5.3 usage.

Licensing:

  READ ARTICLE
243 words ()
by Kevin Schroeder | 12:00 am

ZendCon 2010 Podcast – Do You Queue?

Speaker

Kevin Schroeder

Abstract

There has been a lot of talk over the past several years about the difference between performance and scalability. When talking about building a scalable application queuing is a concept that many PHP developers are not overly familiar with. In this talk we will demonstrate how you can use the Zend Server Job Queue to scale your application.

Licensing:

  READ ARTICLE
243 words ()
by Kevin Schroeder | 12:00 am

Subnet validation with Zend Framework

(Note – I accidentally gave conflicting instructions to the person who runs our newsletter. If you are actually interested in the article I wrote about people being silly about dynamicly typed languages you can go here)

I saw on a StackOverflow posting, someone was asking to see how you could use a Zend Framework validator to tell if an IP address was between two addresses. The individual was trying to use Zend_Validate_Between to do the checking. However, IP addresses generally are not checked between two arbitrary addresses such as between 192.168.0.45 and 192.168.0.60. Instead, the check is usually done to validate an IP address against a subnet.

  READ ARTICLE
553 words ()
by Kevin Schroeder | 12:00 am

ZendCon 2010 Podcast – A New Approach To Object Persistence In PHP

Speaker

Stefan Priebsch

Abstract

The object-relational impedance mismatch makes persisting PHP objects in a relational database a daunting task. How about these new schemaless NoSQL databases? We will have a look at the problems involved with persisting PHP objects, and introduce design patterns that help solving these problems. Putting the patterns to good use, we will build a working PHP object persistence solution for MongoDB.

Licensing:

  READ ARTICLE
195 words ()
by Kevin Schroeder | 12:00 am

Podcasts are a-coming

Just a real quick note. I received the podcasts from ZendCon 2010 back in December and opened up a contest to let people choose which order they wanted to hear the sessions in. The order is in and I have already started posting them, starting with Dependency Injection. I would have done the Unit Testing after ZF 1.8 but Michelangelo is doing a webinar with us on the 19th, so I will post the recording of his ZendCon session afterwards.

  READ ARTICLE
922 words ()
by Kevin Schroeder | 12:00 am

Pre-caching FTW

I just had an epiphany. I’ve talked about pre-caching content before and the benefits thereof before. But this is the first time I realized not only that there are benefits, but that doing it is BETTER than caching inline. Let me sum up… no, there is to much. Let me explain.

Typically caching is done like this (stolen from the ZF caching docs):

  READ ARTICLE
299 words ()