Code or it didn’t happen

August 31st, 2014

Last night I was watching Alvaro Videla having a talk about RabbitMQ as I wanted to learn more about working with an AMQP broker server.
I already had a plan to start reading the “RabbitMQ in action” book, dive into the library and write some tutorials about working with RabbitMQ using PHP. But that slide from the presentation with “Code or it didn’t happen” got my attention. This morning I woke up and here it is: My goodbye post. I’m closing this blog.

code

Why I decided to close my blog

I first started this blog with the purpose of learning. I wanted to learn more about Magento and write along some series. It was a failure. Why? Because although I did covered most of Magento parts, I lost a lot of time writing about them. By the time I was about to take the Magento certification I just didn’t care anymore.
While I do think that teaching others is really good,  I’m in no position of doing that. I’m only 25 years old. I plan to learn a lot of stuff, but I don’t want to lose time writing about it. Yes, maybe I’m egocentric, but let’s face it: I have nothing to show for now.

And instead of losing my time or yours, I should focus on the only thing that counts: building stuff. For example I had a great time building MoneyTablet because I wanted to learn Laravel. Nobody uses it, but me. I don’t care. I shipped something and learned along the way.

Practice, practice, practice.

The focused developer

In the future I plan to attain 2 qualities as a developer: experienced & reliable.

I can only become more experienced by practising and experimenting. There are no shortcuts. And I believe that if I would convert all the lines from this blog in lines of code, right now I would have been a different developer. So from now on, my Github profile will replace this blog.

https://github.com/zuzuleinen

https://gist.github.com/zuzuleinen/

Did you learned a new library? Code & push to Github. Do you want to learn Angular? Think about a small project. Code & push to Github. Code or it didn’t happen.

Do you want to help others? Go to StackOverflow and help others, contribute to open source projects. And if you want to connect with other developers go to meet-ups.

And maybe after some years someone can say about me: “That dude it’s reliable”. In the end this is what counts: people putting their trust and money in you.

Add a comment »


CSV Response in Symfony controller action

May 21st, 2014

 

Add a comment »


Reddit picks

May 13th, 2014

I want to start sharing some Reddit posts I found interesting or posts I’ve created myself. So for my first series here they are:

Wrapper methods: are they good or not? Here you can find some interesting insights on wrapper methods subject I wrote last time.

BDD or TDD? I recently asked what path should I take when testing my application and I got some good comments on the subject.

Container parameters or configuration values? On this post I asked why configuration values are better then service parameters in Symfony2 and I got a response from the author of the presentation I was referring.

Method chaining: yes or no? Although this is not one of my posts, the subject is quite interesting. I always thought  that returning $this from a method is a good idea, but apparently is not. Check the comments to read why.

Add a comment »


Tools for coding standards

May 8th, 2014

As a professional developer I try as much as possible to create a discipline for clean projects. And one of the measure I take is to respect the coding standards specification. It’s not hard and it doesn’t take much time especially if you start respecting the standards from the beginning of your project.

Here is a list with the coding standards I use. And here are the tools I use every time:

1 Comment »


Using the php \Soap client with a .p12 file

May 7th, 2014

1. Convert the certificate from .p12 to .pem

2. Create the SOAP client and check the available functions:

Add a comment »


Wrapper methods: are they good or not?

May 3rd, 2014

Last week I was doing some pairing programming with a colleague of mine, and we were designing an API client class and at one point inside a method I had this piece of code:

And I suggested we should modify these lines like this:

“Why would you that? It would be only a wrapper method for the container getParameterMethod()” my colleague asked me.

So the question is: does it worth to create a wrapper method for only one line of code?

I think it depends on how you choose to structure your code, but I usually do for these reasons:

1. Readability

getCompanyAddress() it’s way more readable than getContainer()->getParameter(‘client.subscribe.deliveryAddress’). Yes, for you it might be the same, but think about future programmers who will work on your code. When we are reading code lines, we are doing this with the sole purpose of understanding what it does. A getCompanyAddress will give the exact answer without reading and trying to understand what a bunch of lines do.

2. Avoiding comments

I think if you need comments above a line of code, then your code is not self-explanatory, and it’s often a hint that you should create a new method with a good naming. I like to think my wrapper methods like “working comments”, because they are like a comment which is executing and does stuff.

So as a rule of thumb when I feel the need to comment code I ask myself if method with a descriptive name should be added instead.

3. Better debugging and fixing code

I think for a new programmer it will be easier for him to find where the problem is when a bug is occurring. And if he needs to fix it then he will be sure that if he will fix that method the code is working.

What do you think? Are wrapper methods a waste of time and space or do you make use of them?

4 Comments »


Best practices in Symfony2

May 3rd, 2014

Add a comment »


Mailchimp is using PHP

January 24th, 2014

“We’ve built a framework for developing applications in PHP specifically designed to allow for fast innovation in the high-load, high-performance environment we live in every day while still keeping the API extremely simple to deal with. This isn’t your grandfather’s PHP, or even your slightly older brother’s. I can say without doubt that it is the most sophisticated framework for this environment that I’ve heard of except for perhaps what Facebook uses. Our architecture is heavily sharded, fast, and scalable to handle the absurd amount of growth we’ve had in the last few years.

We use this architecture to process well over thirty million emails sent by tens of thousands of users every day, generating tens of millions of bounces, opens, clicks, and unsubscribes that all need to be handled in near-real time. We further process millions of API requests and millions of subscribes and confirmations every day. All told, we handle well over 500 million dynamic page views a month. Our backend systems run millions of jobs every day, calculating statistics, querying geographic data, and scanning everything for bad behavior and abuse.”

Read more here: Ewww, You Use PHP?

Add a comment »


Some Symfony resources

January 15th, 2014

This year my main professional objective will be to learn more about the Symfony framework.
While I still enjoy working with Laravel, Symfony is the main framework I use at work and I want to focus on it. Here are 3 resources I intend to follow:
Create your own framework… on top of the Symfony2 Components
Diving Into Symfony 2

Learning Symfony 2

Add a comment »


Working with relations in Laravel

December 23rd, 2013

Let’s say you have this piece of code:

Can you tell me what is the difference between line 3 and line 5?

When I first started with relationships in Laravel I found them really easy to use, but I couldn’t figure it out what should I use when querying for data: the property or the method?

The property is a collection object

To be more precise is the Illuminate\Database\Eloquent\Collection class. In our case we will have the comments collection loaded for our post. You can check that class out to see what methods supports.

The method is a relation

In our case it would be a Illuminate\Database\Eloquent\Relations\HasMany class. No matter the relation type, they all extend the Illuminate\Database\Eloquent\Relations\Relation abstract class. When using a relation we can add more conditions to our query such as where. Why is that?

The __call() method of Relation class is called when invoking inaccessible methods. So when we add a where clause such as:

We can see on line 10 that the method ‘where’ will be called on this->query with the parameters ‘title’, ‘=’, ‘foo’. And this->query is the query builder: Illuminate\Database\Eloquent\Builder class which will support all these methods.

Conclusion:

When you need to access only the collection without any filters use the property, and when you need to use the query builder functionality use the method.

Add a comment »