cspray.net

  • saying goodbye to SprayFire

    By Charles Sprayberry today
    Category: programming

    If you’ve read my blog before you know about a project I worked on called SprayFire. It was my homebrewed framework. It taught me a lot about design patterns, the need for modular libraries, and helped get me a job. Some time ago I deleted the project. This post talks about why I deleted the project and what I’ve been working on instead.

  • you decided to write a framework anyway

    By Charles Sprayberry 1 year and 6 months ago
    Category: programming

    In case you missed my post you shouldn’t write a framework I’m not a huge proponent of writing your own PHP framework. This may sound contradictory coming from a guy who has devoted a not-insignificant amount of time working on his own framework. Regardless of all the reasons why you shouldn’t write your own framework you’re probably going to anyway; it almost seems to be a rite of passage in the PHP community. I’m not here to convince you of the folly in doing so but instead give you some advice for your own framework creation. I’ve always thought if you’re gonna do something stupid you might as well do it as smartly as you can.

  • thoughts on JSON and OSS licensing

    By Charles Sprayberry 1 year and 11 months ago
    Category: programming

    If you’re not aware, recently there’s been some PHP drama about PHP “losing” JSON support. Obviously this isn’t the case and it turns out some people, getting their PHP through certain distributions, weren’t getting the JSON extension by default. It all boils back to this “bug” reported to PHP.

  • Web Development, the problem

    By Charles Sprayberry 2 years and 1 week ago
    Category: tech-and-society

    This is part 1 of a 2 part series regarding my thoughts on the current state of web development. This article discusses the problems the web software industry faces today. The second part will discuss some potential solutions to some of the problems discussed.

  • why I TDD

    By Charles Sprayberry 2 years and 1 month ago
    Category: programming

    A little over a year and a half ago I started working on the SprayFire project and Test Driven Development. At the time I started with unit testing I really wasn’t sure what the benefits, if any, would be. Now having had time spent writing a decent sized codebase and many unit tests the benefits are obvious and numerous.

  • you shouldn't write a framework

    By Charles Sprayberry 2 years and 5 months ago
    Category: programming

    It is almost a rite of passage in the PHP community. If you’ve ever done any serious object oriented PHP you’ve probably created, or at least used, a framework of some kind. There are literally thousands of shitty frameworks out there that will never get used for anything. Mine is SprayFire.

  • programming is not just writing code

    By Charles Sprayberry 2 years and 11 months ago
    Category: programming

    When I first started my journey to become a professional programmer almost 2 years ago I focused almost entirely on the “learning how to code” aspect. While this is very important, and something I would recommend to beginners, there are other aspects to becoming a great programmer that are just as, if not more, important than actually knowing how to write code. A lot of these things apply to all manners of professions but really become evident in the programming industry.

  • the model, a layer and a class

    By Charles Sprayberry 3 years and 3 weeks ago
    Category: programming

    Lately I’ve been giving some thought to the Model in SprayFire and figured I would flesh out the concept as a blog post. I’m going to discuss how my interpretation of this, most critical of layers, differs from many you may have already encountered or read about. For starters, the Model, in OOP designed architecture, is actually two-headed; it is both a layer and a class.

  • when and why to use Value Objects

    By Charles Sprayberry 3 years and 1 month ago
    Category: programming

    Recently I’ve dived back into SprayFire and one of the things that I have been working on is making use of Value Objects. I have given some thought to when should I use a Value Object and when should I just use an associative array. After all, PHP is not a purely object-oriented language, there are many paths to your destination, and arrays in PHP are extremely powerful and useful. But, then again, so are objects. When should you use a value object over an array? Why should you use a Value Objects?

  • stop calling them getters and setters

    By Charles Sprayberry 3 years and 2 months ago
    Category: programming

    I was having a talk with a fellow programmer and he said something to the effect that if a class property is commonly used it might as well just be public because it is easier to work with. I rebutted that you should just use getters and setters and, of course, the discussion turned toward the validity of getters and setters and whether they break encapsulation. Having had some time to chew on the information I’ve come to a couple conclusions, the foremost being that we should stop calling them getters and setters and the second being that the use of these mutator and accessor methods does not break encapsulation.

  • spaghetti triage

    By Charles Sprayberry 3 years and 4 months ago
    Category: programming

    I was having lunch today with a fellow developer and the conversation included flawed web-based systems. Systems in which there are fundamental flaws and there are numerous issues to fix. Imagine a typical spaghetti-fied, insecure mess. I asked the guy what he would fix first. His answer was, in principle, the same as my answer…separate concerns, especially getting the “view” out of the business logic.

  • a community gone mad

    By Charles Sprayberry 3 years and 5 months ago
    Category: programming

    I mentioned in my last post about going from amateur to professional developer about getting involed in a community. My community of choice is Stack Overflow and some of the other Stack Exchange sites. I like the concept but love the execution. It’s easy to come up with great ideas; to actually implement them in a way that works is just awesome.

  • going from solo to professional

    By Charles Sprayberry 3 years and 5 months ago
    Category: programming

    As I alluded to in my previous post about leaving school and the state of the modern CIS program, I recently got a job! I’m really excited about this opportunity and wanted to take a look at it from a different kind of light. What I didn’t really talk about much in the previous post was what it took for a solo amateur developer to join the ranks of the paid professionals. Maybe you’re in the same boat and want to become a developer in one of the most awesome industries ever. Well, this is how I did it; maybe some of the stuff I learned can help you in your own journey.

  • why I quit school and what it would take to stay

    By Charles Sprayberry 3 years and 5 months ago
    Category: tech-and-society

    About three years ago I moved to the upstate New York area as a start to “rebooting” my life. I had entered the full-time work force after graduation and 10 years later, while the resume looked ok, there was a huge void. I was just kinda floundering at my job and going through the motions. I knew if I stayed where I was I would only continue to flounder. A change was needed, so I moved.

  • DI and global state

    By Charles Sprayberry 3 years and 6 months ago
    Category: programming

    In a previous post I talked about why you should use Dependency Injection. It garnered a little bit of attention, getting some votes on reddit/r/PHP and also showing up on phpdeveloper.org. With the attention came some criticism, justly served, particularly in regards to a lack of code examples. To help better explain each of the three aspects of DI I discussed in the previous article I’ll be going over each more thoroughly and with those code examples requested. I’ll be going through each point one at a time as the explanations will likely be of some length compared to the original post.

  • why you should use DI

    By Charles Sprayberry 3 years and 6 months ago
    Category: programming

    Dependency Injection is all the rage these days, particularly when you slap the word ‘Container’ in there somewhere. Dependency Injection is just a fancy term for passing dependencies to the object needing them instead of letting the object create its own. Hopefully, you’ve watched this great Google Clean Code talk about dependency injection Misko Hevery where he talks about why you should ask for things instead of looking for them.

  • you better pay attention to details

    By Charles Sprayberry 3 years and 6 months ago
    Category: programming

    I like tea. Particularly sweet tea. When its cold give it to me iced; if its hot I’ll take it steaming with a little bit of milk. When its cold I tend to drink a lot of tea and I go through a lot of tea bags. Normally you wouldn’t expect to care too much about the design of a tea bag. I mean, it is a little pouch of tea leaves that allows water to come in and out but keeps the tea leaves in the pouch, with no leaves escaping. There should probably be a string with some kind of handle to easily retrieve the tea bag from hot water. That about sums up the totality of a good tea bag. So, when you encounter a horrendously designed tea bag it really stands out.

  • dog training your code

    By Charles Sprayberry 3 years and 6 months ago
    Category: programming

    When I worked with the Monks of New Skete I got a first-hand opportunity to learn about dog training from world-reknowned dog trainers. I thoroughly enjoyed the chance to learn more about communicating with our canine friends and have taken on dog training as a more serious hobby. It has been a wonderful experience being able to truly connect with a dog, who really just wants to play and have a good time. But, dog training is serious fun business. It isn’t just obedience commands, no more than programming is just writing code. I believe that it is composed of the communication, discipline, love and respect between canine and man in its entirety. How you go about living your life with your dog is dog training; obedience is simply one aspect of that life style.

  • how to be great at $x

    By Charles Sprayberry 3 years and 6 months ago
    Category: programming

    I was sitting in the Graphic Design Corner chat room over at chat.stackexchange.com with Dyana, my fiancé, last night where we talked with a professional graphic designer. He said something that I had heard before, in fact something I had heard quite a bit from a variety of sources. Here's what he said:

  • SprayFire and MVC design pattern

    By Charles Sprayberry 3 years and 7 months ago
    Category: programming

    MVC must be one of the most over-used acronyms in the PHP framework community. In SprayFire docs and source code I’ve made a concerted effort to avoid use of the term MVC, except where appropriate. Too many people have their preconceived notions on how this design pattern should work and often anything that diverges from the traditional implementation is treated as some form of abomination, a code pariah to be dumped as soon as possible. Reading this article, and the other articles talking about SprayFire’s interpretation of the pattern, I ask that you open your mind. Drop your preconceived notions. There is nothing wrong with new ideas, even if you don’t agree with them. If an idea winds up not working, it won’t survive. If it does wind up working it might just make things better. To not even consider the idea, I believe, would be folly.

  • comments aren't evil; comment your code

    By Charles Sprayberry 3 years and 7 months ago
    Category: programming

    • Dissenter: Charles, you noob! Comments are evil. They can muddy up your code, nobody keeps them up to date and they're completely unnecessary. Write short, concise code and you don't need comments!

    • Me: You're absolutely right. Comments can be evil. But you're taking it too far! Not all comments are evil and the innocent are perishing in your genocide!

    • Dissenter: Hog-wallop! All comments are evil. You have simply not transcended to a higher level of programming.

    • Me: Perhaps. But, comments are not inherently evil. Their intent, the methods in which they are utilized, is the true evil! Comments don't kill code, programmer's kill code.

  • writing better commits with github

    By Charles Sprayberry 3 years and 7 months ago
    Category: programming

    As the development of SprayFire progresses I'm constantly evaluating what I'm doing, how I'm doing it and what tools I'm using. Lately I've been thinking about the way I use git, my version control software of choice. Looking through some of the commits for SprayFire I can tell that my commit strategy needs some work. Commit messages are sometimes lengthy or don't really convey what the commit is doing. What are some things that I can do to improve my commits and make for a more maintainable project?