News for hackers. Stuff that matters.
Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by markhuus on Monday June 18, 2012 @04:49PM (#4128449)
I can't believe you hardcoded this for MySQL instead of using PHP's excellent and versatile PDOs, and I can't believe the 10k line count. Gosh. Is "de-engineering" a suitable term here? Thumbs up for open sourcing your work, though.
Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by sandollars on Monday June 18, 2012 @05:01PM (#4128514)
This is the sort of comment that keeps a lot of people from publishing their source code.

Make a pull request, sir.

Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by renownedmedia on Monday June 18, 2012 @04:55PM (#4128476)
I built it using CodeIgniter, and wasn't as proficient in PHP as I am now. CI is a beginner framework and doesn't teach a lot of good practices (e.g. it loads external classes as singletons and uses a class loading script developed during the PHP4 days).

Here is the suggested CI method for executing database queries: http://codeigniter.com/user_guide/database/examples.html

Nowadays, I prefer (PHP) frameworks with real autoloaders and better OOP usage (like Zend or Kohana).

Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by jwdunne on Monday June 18, 2012 @05:46PM (#4128754)
Please can you point me to documentation that shows that you can easily switch vendor when using PDO? The PHP docs clearly state database abstraction isn't purpose of PDO. The purpose of PDO is to abstract access to a database.

http://www.php.net/manual/en/intro.pdo.php

In this sense, wouldn't it have been better to either recommend that he should have used a DBA library? Or even recommend that he used PDO in place of CodeIgniter's own DB access library?

The OP's experience aside, I think you're also missing that this was written on top of CodeIgniter. From my own experience and learning, CodeIgniter isn't really the best tool for writing larger applications. It's architecture isn't so great and is largely a remanent of the past. To end a rant about CodeIgniter short, it seems more natural to write namespaced procedures using classes rather than taking full advantage of objects and OO (again, probably due to it being largely a PHP4 framework).

Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by tonywebster on Tuesday June 19, 2012 @12:04AM (#4130195)
Really disappointing to see someone's work get trashed. Rock on for open sourcing it.
Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by ericingram on Monday June 18, 2012 @06:00PM (#4128834)
"markhaus" has -15 karma. I think his goal is to accumulate negative karma. That or he is just a real jerk.

Plus, I really disagree with his comment.

Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by markhuus on Monday June 18, 2012 @04:54PM (#4128471)
No I'm serious here, renownedmedia. Don't disregard my rant with a silly downvote, but do instead indulge yourself in the PDO methods instead of painting yourself and your projects into corners: http://php.net/manual/en/book.pdo.php
Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by rpeden on Monday June 18, 2012 @04:58PM (#4128500)
What makes you think he was the one who downvoted you? You could easily have asked him about his technical decisions without being a jerk.

Besides, this was a personal project, probably created without the intention of eventually open sourcing it. If he only ever intended to use MySQL, and portability across RDBMS systems wasn't a goal, then it's fine as it is.

Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by renownedmedia on Monday June 18, 2012 @05:09PM (#4128565)
You hit the nail on the head. I never knew I would open source this, I didn't even plan on it getting as feature-rich as it had become.
Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by citricsquid on Monday June 18, 2012 @04:56PM (#4128481)
You can't downvote comments that are a reply to your own item, the person that downvoted you is not the OP -- unless he used an alternative account. I would suspect someone else did, the tone of your comment isn't one that really fits with the HN environment even if your point is valid.
Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by savories on Monday June 18, 2012 @04:58PM (#4128498)
You probably got down voted because you seem like a dick, rather than a helpful, nice, encouraging person.
Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by aaronpk on Monday June 18, 2012 @04:57PM (#4128492)
Having just converted an app to use Postgres from MySQL, I can tell you that the PDO drivers only get you so far. You're still ultimately going to be writing SQL, and then you have to get into the differences between MySQL's `key`="val" and Postgres' "key"='val' quoting differences.
Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by renownedmedia on Monday June 18, 2012 @04:56PM (#4128480)
It wasn't me who downvoted you, I promise! I love PDO; please read my other comment.
Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by jakejake on Monday June 18, 2012 @05:15PM (#4128599)
Your very first comment on HN got a down-vote, I haven't actually seen a -5 karma before. On the bright side you've nowhere to go but up.

Seriously though I agree with your point about PDO. Perhaps the down-vote was due to the comment about de-engineering and apparently making fun of 10k LOC?

I took a look at the app and it's got a huge amount of features. 10k is not really that much code for a "enterprise" app I suppose you could call it. The OP probably is just trying to express the amount of labor that went into the app. Unfortunately other developers may judge your LOC as either a positive or negative, so it's probably best to avoid mentioning it (unless you've written an app in an unbelievably low number of lines).

Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by renownedmedia on Monday June 18, 2012 @06:31PM (#4128940)
It was the first metric that came to mind, it was hard to describe in time since development was on and off for a while. I just wanted people to know it wasn't a small project.
Re:Just open sourced my 10k LOC PHP & MySQL invoicing app by jakejake on Tuesday June 19, 2012 @01:38AM (#4130417)
It actually looks like a nice product. I can tell from your video that you feel about the same way I do of many of my projects. Even after a few months it's hard for me to look at my work and not see the flaws and missing features. But it's good to keep in mind that people who aren't building the app don't usually see those things.