Anyone else hate not being a programmer?

Just won another project guys.

I started contacting ex or old clients asking how things are going and one guy told me about a problem they have managing one of their business processes. I pitched a solution, we haggled and they gave me the project. I started work today - deadline for v1 is end of January.

:banana_sml:
 


If it is for anything else than for a small script, absolutely yes. Maintainability > a small speed increase.

Also avoid 99% of the tutorials out there, they are crap. Good luck bro.

Hmmmm .... my son, who's a .Net developer, thinks I'm insane to not use OO.

Don't know though - I look at a script that connects to mySQL, does a SELECT, mashes the data a bit, builds the html and passes it back to the AJAX call. How could that be improved with OO?
 
Hmmmm .... my son, who's a .Net developer, thinks I'm insane to not use OO.

Don't know though - I look at a script that connects to mySQL, does a SELECT, mashes the data a bit, builds the html and passes it back to the AJAX call. How could that be improved with OO?

From your description it sounds like a bunch of spaghetti code that will be unmaintainable after a few months of not looking at it, mixing HTML, SQL and PHP all in one?

I really recommend you learn OOP, the clean code talks are a good start. You will never want to go back.

Start here and work your way up: php - MVC For advanced developers - Stack Overflow
 
From your description it sounds like a bunch of spaghetti code that will be unmaintainable after a few months of not looking at it, mixing HTML, SQL and PHP all in one?

I really recommend you learn OOP, the clean code talks are a good start. You will never want to go back.

Start here and work your way up: php - MVC For advanced developers - Stack Overflow

Code is ok - everything in separate files, descriptive file names, lots of comments, logic and presentation kept apart as much as possible - but I am interested in this area partly because I think it could open the door to more work, but also I keep hearing these comments about 'never going back' once you've got into OO.

Thanks for the link.
 
It's more about MVC than OOP really, IMO.

No. MVC is pretty much impossible on the web, at least with the frameworks available. What you probably think of is MVP.

MV* is just about separating presentation logic from the domain model stuff (entities, collections, factories, service layer etc). Then you also need to abstract the persistence layer from the domain model.

Sadly frameworks like rails (and many of it's php offshoots) have created a misunderstanding about proper system architecture.

Thats a good talk about this topic (not ruby specific): https://www.youtube.com/watch?v=WpkDN78P884
 
Code is ok - everything in separate files, descriptive file names, lots of comments, logic and presentation kept apart as much as possible - but I am interested in this area partly because I think it could open the door to more work, but also I keep hearing these comments about 'never going back' once you've got into OO.

Thanks for the link.

If you are just needing something to store data (like a struct in C), you can get away with using associative arrays; if you want a class instead, for the same purpose, you can use stdClass();

A case where you might want to use OOP is if you want to take advantage of inheritance to reuse existing code. Like if you have a Rectangle class with a method getArea(), you can extend it with a Square class, so you wouldn't need to write a new getArea() for he Square- if you call it on a Square, it will just use the one in Rectangle.

If you go OOP and never look back, you will be limiting yourself. OOP is just another tool you can use to solve a problem.
 
If you are just needing something to store data (like a struct in C), you can get away with using associative arrays; if you want a class instead, for the same purpose, you can use stdClass();

A case where you might want to use OOP is if you want to take advantage of inheritance to reuse existing code. Like if you have a Rectangle class with a method getArea(), you can extend it with a Square class, so you wouldn't need to write a new getArea() for he Square- if you call it on a Square, it will just use the one in Rectangle.

If you go OOP and never look back, you will be limiting yourself. OOP is just another tool you can use to solve a problem.

I was thinking about this yesterday. OOP involves extra work, e.g. to grab the return value of a function inside a php script:

* Procedural:

Include the script.
Assign a var to the return of thefunction();

* With OOP you have an extra step:

Include the class definition.
Create a new object.
Do -> the stuff

Doesn't this extra step have a performance overhead?
 
* With OOP you have an extra step:

Include the class definition.
Create a new object.
Do -> the stuff

Doesn't this extra step have a performance overhead?

You're doing it wrong. What kind of projects are you working on that you're worried about "performance"?

Somehow I get a feeling that you've got this all wrong and are worrying about totally irrelevant details/things.
 
Highly likely.

What are you working on? Give us some more details - not the exact spec but like... what type of projects? :)

If you know php and mysql and want to get building fast - laravel.com. Flexible, beautiful syntax, very well structured and logical.

Depends on what you're building though.
 
Thanks for helping. To give you an idea of where I'm coming from, it's prehistoric times: I learned programming on an IBM 4381 mainframe where we had to fit everything into 64K of RAM and disk I/O was a total bottle neck, so I constantly worry about speed, I/O, loops stuff like that because back then we had to be so efficient.

I'm building a couple of Facebook apps which involves PHP selecting data from mySQL, then grabbing data for each record from the FB graph (I'm using a FB batch file for this), parsing the data, then write the html with the data (still within the PHP script), then it is echoed back to the AJAX call and JQuery populates a div with the html.

The front-end runs nicely.

I am building the back-end admin system where the client can add edit and delete his own records.

So the PHP stuff is straightforward.

I don't really have a high level strategy for projects though - I think this is a big weak point. I've more or less won a reasonable PHP sized project starting for February, the value is around $25K, so I need to get my act together to handle that - any strategic advice would be really appreciated! My son keeps telling me to use a framework so I am now going to watch some videos about laravel.

Thanks again.
 
No. MVC is pretty much impossible on the web, at least with the frameworks available. What you probably think of is MVP.

MV* is just about separating presentation logic from the domain model stuff (entities, collections, factories, service layer etc). Then you also need to abstract the persistence layer from the domain model.

Sadly frameworks like rails (and many of it's php offshoots) have created a misunderstanding about proper system architecture.

Thats a good talk about this topic (not ruby specific): https://www.youtube.com/watch?v=WpkDN78P884

I do MVC with webapps. I don't use Django or Rails, or any PHP stuff. If you have factories in your project, please format your computer and start again.
 
Thanks for helping. To give you an idea of where I'm coming from, it's prehistoric times: I learned programming on an IBM 4381 mainframe where we had to fit everything into 64K of RAM and disk I/O was a total bottle neck, so I constantly worry about speed, I/O, loops stuff like that because back then we had to be so efficient.

I'm building a couple of Facebook apps which involves PHP selecting data from mySQL, then grabbing data for each record from the FB graph (I'm using a FB batch file for this), parsing the data, then write the html with the data (still within the PHP script), then it is echoed back to the AJAX call and JQuery populates a div with the html.

The front-end runs nicely.

I am building the back-end admin system where the client can add edit and delete his own records.

So the PHP stuff is straightforward.

I don't really have a high level strategy for project though - I think this is my weak point. My son keeps telling me to use a framework.

Your PHP stuff is horizontally scalable. As in, if you add more webservers, you will get more performance (until MySQL is a bottleneck, which will take a while, if you are using it efficiently).
 
I was thinking about this yesterday. OOP involves extra work, e.g. to grab the return value of a function inside a php script:

* Procedural:

Include the script.
Assign a var to the return of thefunction();

* With OOP you have an extra step:

Include the class definition.
Create a new object.
Do -> the stuff

Doesn't this extra step have a performance overhead?


Yes, but it's a scripting language, so it already comes with some overhead. You have to be considerate how you design classes, and don't do things like make large objects in a loop, when you could just make 1 and do the same thing. Lately, I've been in the habit of making everything static.

I do make new stdClass objects in a loop when I have to, but the difference between doing that and using an associative array is negligible.

But if you're from the old days, you will find php provides a lot of WTF moments, mostly in an effort to make bad code run, and whoever wrote the code feel like a real programmer.
 
Bump.

I spent 30 minutes a couple of days ago reading posts on stackoverflow and quora looking for more iOS and Objective-C resources and learning materials.

Someone on Quora recommended this: Ray Wenderlich | Tutorials for iPhone / iOS Developers and Gamers

I ended up opting in to their newsletter and downloading the first tutorial in a series they've created called "iOS Apprentice".

After only going through a small portion of the PDF tons of lightbulbs started going off for me in regards to Objective-C. In the previous obj-c video course I was taking, and in the big nerd ranch book, a lot of the Objective-C stuff just wasn't clicking for me.

There is something special about that first iOS Apprentice tutorial. The author does a great job, includes illustrations. Everything is explained very simply and I learned a lot more about Objective-C syntax.

I completed that first tutorial in the series, and purchased the bundle today. Will be starting the 2nd one on Wednesday and my goal is to have it finished by Wednesday night.

I'm very excited to make it to the 3rd tutorial in the series because it is supposed to teach you a lot more about Objective-C and claims that by the end of it you should be able to make some apps on your own with little to no help.

Going to start the 3rd tutorial Saturday morning and try and have it done by Monday afternoon.

I'm no longer completely lost with Objective-C and the syntax is starting to make a lot more sense to me now.

If anyone else is interested in learning iOS programming then I highly recommend you check out the ray wenderlich tutorials.