Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
duck monster
Dec 15, 2004

Are there any php lint tools that can reliably detect uninitiated variables? I'm trying to refactor some terrible code that is dependent on magical lala register globals (yeah, I know man, I know... I inhereted this mess, I didnt write it) and due to the sheer size of the code I need something to lint various files with to find these uninitiated variable horror shows. Any suggestions?


edit: Trying to convince the boss of the need for a rewrite, I showed him the DJANGO code for a rent management system I just use to track me and my flatmates rent, that fits in under a page of code + model + template, and man you should have seen the dude. Gears grinding hard in his head as I said "This line verifys the form. This line saves the form. This line creates a new form". He was actually almost in disbelief..... Going to stick with a php one, but I think he's coming around, because the sight of a mid-moderate complexity web app in a page of code with validation, ajax and all the fruit kind of blew his mind especially after I explained theres probably a 1000+ lines of code required to rewrite it in the long-drop (code starts at top, proceeds to bottom, then the coder hangs himself in despair) style of mingled html, php and sql vs about 100 lines, including the models and 50 lines of dreamweaver generated template.

duck monster fucked around with this message at 09:49 on May 10, 2013

Adbot
ADBOT LOVES YOU

duck monster
Dec 15, 2004

Well I'm liking Symfony2 so far, but gently caress me does doctrine have the whiff of over-engineering to it.

I'm tempted to put it in the "optional" category and drag in an ORM that isn't written by insane java victims.

duck monster
Dec 15, 2004

Pochoclo posted:

I've been using Symfony2 for 2 and a half years now, and Symfony 1.4 before that... I don't think Doctrine is over-engineered at all. I used Propel, too, and prefer Doctrine.
Some people speak against ORMs, but I think they're neat. I usually work in huge multi-year multi-team projects with dozens of business entities and complex associations between them, though. If your projects all have 2-5 business entities or something like that, then yeah, you might want to look into Silex (sans Doctrine) or Yii or whatever.

The more I read, the more I think your right, however what it *IS* is poorly documented. I still cant work out how to get the doctrine command to stop bitching about some undefined variable, and whenver I google it, its either worthless stackoverflow "This means its not configured right" or not stackoverfow "This means its not configured right. Ok, well that was already clear but htf do I configure it right! Google that "CLOSED: NOT CONSTRUCTIVE" I might pass on it as I need something dead simple that I can explain to the boss and not spend weeks bashing my head around a minimalistic poorly written manual. To be honest, I'd rather just stick with easy old activeRecord than a complicated mapping ORM... unless that mapping ORM was django, but thats been taken off the table by my boss who insists we use PHP.

Yii I'll pass on. Too clownshoes for my liking.

I'm actually finding laraval really nice, though I'm not yet sure if I can get it to generate me an initial schema from the stupidly huge database the existing app uses that I can then push around with model driven migrations. But blam, 2 pages into the tute and I "get" this one.

duck monster
Dec 15, 2004

McGlockenshire posted:

There are more lightweight alternatives in that realm, though few that are actually updated.

Hey I like that one.. One line per field, much better.

quote:

Data mappers beat the hell out of ActiveRecord, by the way...

Ehhh.......

The question is "What does this do to my productivity", and anything that involves lots and lots of loving around with xml files and associated horseshit seems to violate what I consider a rock solid rule of development: Throwing hardware at problems is always cheaper than throwing labor at it.

That said, given a choice between Djangos data-mapper and RoR's active record, I'll pick djangos one any day. The question is, whats its PHP equivilent.

duck monster fucked around with this message at 13:14 on May 13, 2013

duck monster
Dec 15, 2004

Looks like we'll be going with Laravel. Seems to hit that sweet point between lots of features and easy learning curve.

I'm not totally sold on eloquent, as it seems to have the opposite problem of doctrine, its a bit *too* simple (I'd like *some* sort of mapping facility!) , but it'll do the job for now.

duck monster
Dec 15, 2004

Winter is Cuming posted:

What exactly is a mapping facility?

The db has a number of fields with German names and it'd be nice to have the benutzername field appear on the model as username.

I guess I can always cheat with a MySQL view

duck monster
Dec 15, 2004

Depressing Box posted:

Would custom accessors solve that problem?

Kludge. Still end up searching "benutzername" for username because I'll be a monkeys uncle if it can translate its getters and setters into search filters.

edit:

Looks like we are going with symfony. Spent the whole day in pitched violent combat with its auth system.

Being told to use the app/console to generate accessors (why not just use public propertys you deranged java victims ffs!) only to have it poo poo itself for not having the accessors because they forgot to mention to comment out the protocol declaration (implements xxxxx) first, really sucks, but if it was documented, hey I could live with that.

God drat symfonys documentation blows goats.

Combined with "zend_mm_heap corrupted" because it turns out you can explode php and the server it runs on if you try and run a ->method() on an uninitialized object (php 5.4.something debian wheezy). Just give me an error message, dont loving segfault apache! aaaaa
:negative:

But I could learn to love doctrine if it stops being a bitch. Or specifically if its documentation stops being a bitch.or it was in python, gently caress you management.

duck monster fucked around with this message at 10:32 on May 20, 2013

duck monster
Dec 15, 2004

Pochoclo posted:

I'll give you the auth system, it does suck.

But there's a solid reason for not doing public properties, and that is doctrine hydration and proxy classes and poo poo.
Also, I like encapsulation, keep in mind that the whole public properties vs. getters/setters issue is a holy war argument waiting to happen.

The segfault thing never happened to me.

Yeah, I might well have stumbled on something a bit broken in the distros php. If it turns up again I'll get my mate whos a debian maintainer to file a bug report for me. Debian is usually pretty rock solid, so who knows whats up here.

duck monster
Dec 15, 2004

SimonNotGarfunkel posted:

We all excited for the official Laravel 4 release today?

I bet you are.

I think they cocked that release up actually. The documentation isnt finished (Seriously, where is auth documented? half the api isnt even in the phpdocs, or at least I cant find the drat stuff) and thats a real hassle when trying to migrate from 3 to 4.

The "Just stay with 3" thing doesnt really cut it either, since its pretty clear its been completely dropped.

This isn't how you manage a migration people! Dont just nuke all docs and downloads for the legacy guys (where legacy is defined as "yesterday or earlier") and then dont completely document the changes!!!!!

I really do like laravel, and laravel 4 is great (pro-tip install that symfony style profiler bar, its great stuff) but they need to pay a bit of attention to how the other guys manage change a bit better.

edit: Oh hey looking today, actually it looks like that stuff IS there. Time to read exactly what I'm doing wrong!

duck monster
Dec 15, 2004

I should note with FirePHP, its easy to overwhelm it and have it stop working. It works by putting logging lines in the header. Header space however appears to be limited, so buyer beware.

Its *fantastic* for ajax-y type stuff however, since it stops logging output from messing up your json/whatever.

duck monster
Dec 15, 2004

I used to feel the same way about EMACS. Like 15 years ago. Honestly a good autocompleting IDE is worth its weight in gold.

Which of course makes Sublime Text all that. With Code intel and the various plugins, you get great autocomplete, plus you can drive the whole drat thing from the keyboard, and its got a lot of the string processing cleverness that made emacs a joy to work with. Its the non insane lovechild of eclipse and emacs/vi.

Of course if one still likes old text mode IDEs , pretty much all the things people DIDNT like EMACS for back in the day, specifically its hugeness, is almost quaint in 2013. Its huge, but compared to the big graphical IDEs, its actually quite slim.

duck monster fucked around with this message at 00:29 on Jul 22, 2013

duck monster
Dec 15, 2004

Depressing Box posted:

Since Artisan runs through the Laravel core something that breaks your site will usually break Artisan too. I'd say check the error page and see what it's complaining about.

I love laravel, but its error handling makes me want to break things. That loving error handler is the most broken thing in the laravel stack, and that worries me.

duck monster
Dec 15, 2004

OOP is one of those things that seem a bit mysterious, even plain baffling at first until you encounter a really good example and then BLAMMO it all makes sense and nothing is ever the same. (Functional is a bit like that too) I do advocate learning a few patterns (No need to turn into a raving martin fowler prototype lunatic, unless your coding JAVA or chained to some lovely Zend 2 style monstrosity in which case welp!) particularly MVC and try and get an apreciation for *modelling* your problem. Learning UML can be useful to this even though its rarely as practical in real life stressful deadline situations than it would seem. I at least try and draw up entity relationship diagrams and work through use cases and the like.

But yeah, ultimately its great stuff and totally worth learning ,even if you just end up doing a hybrid approach like I find myself doing when under time pressure.

duck monster
Dec 15, 2004

LET IT BE KNOWN that Symfony can go and eat a bag of dicks. Never let java programmers near your framework people, things can only go wrong.

:negative:

duck monster
Dec 15, 2004

v1nce posted:

Hahaha more fool you if you think that the Symfony Bundle standard is the lovely end of the stick. Symfony and Zend are exactly the same in their fat-bitch structure and it's all in an effort to support testing, which they do really quite well.

Maybe its a PHPs rather than symfony problem, but frameworks in other languages, notably Django and Rails, seem to have solved these problems and can do full coverage fully mocked testing without all the bureacracy and without ending up in the lobotomized state Laravel is in (Laravel is actually OK imho, its just that its ORM is garbage and it really needs to swap out its shity regexy template thingo for something like Twig or even Smarty. For *small* sites its great.)

i dunno, I feel like I''ve spent the past your fighting the framework instead of getting projects out the door.

Adbot
ADBOT LOVES YOU

duck monster
Dec 15, 2004

revmoo posted:

Not sure why you'd use that when Eloquent exists and is good.

I wrote a billing portal in Laravel that pulls data from a TON of sources; remote DBs, memcached, remote APIs, local APIs, etc. Word of advice: keep everything as modular as possible. I broke each piece of data down into its own classes, and then wrote an artisan task that can run them separately or together, along with Laravel's scheduled task support for daily pulls. On the data storage side I used eloquent ORMs for each piece. So I have a) Data puller, b) Model, and c) Artisan task all broken out separate for each piece of the application.

And boy am I glad I did. I recently had a new feature request that was way outside the box and it took no time at all to implement. Also find out at the very very beginning if you need to store history, and how much. I'm able to nuke my individual data sets and start over each time, but if you're expected to log changes things can get messy quick and you'll want to address it from the get-go.

Eloquent, in my view , isn't even in Doctrines league, and doctrine itself is, in my view a bit of a mess.

Eloquent falls apart when you start needing to do highly complex joins and then query across them, and I dont know if it can be fixed without fundamentally rethinking it.

Doctrines not that hard to set up. app/console doctrine:generate:entities; app/console doctrine:migrations:diff; app/console doctrine:migrations:migrate and thats it to take nice YML specification of the model, poo poo out a POPO model with all the correct accessors, and then line it up with auto-generated migrations. Your DB is now reproducable. None of these hold a candle to monsters like Hibernate or the Django or Rails ORMs but for PHP , Doctrine seems to be the way to go. Doctrine does have a lot of faults, but it works well, and its YML->POPO->migration pipeline works drat well for getting complicated DBs out the door.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply