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
Jewel
May 2, 2009

Can someone explain why die would be needed or what that code is abusing to get some strange necessary result?

Adbot
ADBOT LOVES YOU

canis minor
May 4, 2011

Jewel posted:

Can someone explain why die would be needed or what that code is abusing to get some strange necessary result?

Sorry - I'll try to explain stuff next time. The code "works" because it's used in some AJAX handling - this way echoing "success" on the screen is the intended behaviour and you don't want to output anything else afterwards.
However, `die()`ing a script, in the middle of function at that, is not really any sort of solution you should use. Relying on global variables isn't an approach you should use. Overall - this is more of a function fail - why use function at all? (yes, it's used only once)

fritz
Jul 26, 2003

A dude I have to work with is leaving and he finally pushed his code up to a sandbox branch on the repo and it's over a hundred days out of sync with master.

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal
Ugh getting tired of my job and the horrors surrounding it. Enough so that I may consider looking elsewhere, as things have especially gone downhill lately.

Today I started working on a comprehensive mobile application for Windows Phone. When I asked for a source control repository to start committing everything, I was told to put it on our backup drive until that can get setup. I'm guessing that might be 2 weeks down the road at least? It bothers me greatly that my boss thinks that source control is used solely for backups, because I've run into this exact same issue with him before in the past.

I've also been told that "clients don't care if the code looks pretty". OK I guess the client won't give a gently caress when we have to work on the program (with no source control) again and it takes us 3 times as long every single time since there's no time to refactor. Nevermind the fact that this particular program no one wants to spend time on has a host of terrible bugs and problems and they look at me wondering why the gently caress it won't work. Maybe using a library from 1995 that the previous terrible coder chose isn't the right choice just saying.

[/rant]

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Knyteguy posted:

Ugh getting tired of my job and the horrors surrounding it. Enough so that I may consider looking elsewhere, as things have especially gone downhill lately.

Today I started working on a comprehensive mobile application for Windows Phone. When I asked for a source control repository to start committing everything, I was told to put it on our backup drive until that can get setup. I'm guessing that might be 2 weeks down the road at least? It bothers me greatly that my boss thinks that source control is used solely for backups, because I've run into this exact same issue with him before in the past.

I've also been told that "clients don't care if the code looks pretty". OK I guess the client won't give a gently caress when we have to work on the program (with no source control) again and it takes us 3 times as long every single time since there's no time to refactor. Nevermind the fact that this particular program no one wants to spend time on has a host of terrible bugs and problems and they look at me wondering why the gently caress it won't work. Maybe using a library from 1995 that the previous terrible coder chose isn't the right choice just saying.

[/rant]

Yeah, if they don't "get" source control, it's probably time to move on.

pigdog
Apr 23, 2004

by Smythe
There's no reason (or more like, no excuse) for not using your own source control. Use git for your project directory at least locally. You can always migrate.

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal

pigdog posted:

There's no reason (or more like, no excuse) for not using your own source control. Use git for your project directory at least locally. You can always migrate.

I do use git locally when I have to, and I am for this project, but it still is incredibly annoying.

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



fritz posted:

A dude I have to work with is leaving and he finally pushed his code up to a sandbox branch on the repo and it's over a hundred days out of sync with master.

Hahah that is amazing. Hundred days thats p much 3 months so like probationary period right? I mean, hopefully he did not work there for years. Like, I picture whoever showing him around checking out a branch for him just as a courtesy like, so yeah this is where we push & pull. And then he just kept working against his own local branch for 3 months and got fired.

Lucian Tide
Aug 1, 2014
The project I work on has seen two major iterations and currently suffering through it's third. The baseline written in the early 90s, the second iteration written in the late 90s, and the current iteration being worked on for the past 5 years.

The baseline portion appears as if it was organized to minimize the number of header/source files. This means headers contain multiple declarations and defines, and source files are tens of thousands of lines. Everything is global and structs are used for organization. Executables require a majority of the project dynamic libraries be linked due to pervasiveness of libraries dependent upon libraries dependent upon libraries.

The second iteration added functionality directly on top of the legacy capability. On the bright side, all the new code was written using "OOP". Classes make use of proper data encapsulation and source files are broken out accordingly. However, instead of separate classes to separate responsibilities and promote encapsulation, there are simply high level classes that handle a vast array of capability. To manage these beasts, the class method definitions are organized by similar functionality and put into a source file named so as to classify that functionality. (Kudos for at least naming the files appropriately!) With this design, all the classes are massive and all-inclusive with no interface(s). How do the monster classes interface with each other you ask? Make everyone a friend class of everyone else! This way, the private data is just available without the need for a proper interface. Problem solved.

In the third iteration, my team and I have done our best to re-factor and improve. However, due to the size of the code base, schedule constraints and contract scope not everything can be fixed at once. Everything in due time.

fritz
Jul 26, 2003

Snapchat A Titty posted:

Hahah that is amazing. Hundred days thats p much 3 months so like probationary period right? I mean, hopefully he did not work there for years. Like, I picture whoever showing him around checking out a branch for him just as a courtesy like, so yeah this is where we push & pull. And then he just kept working against his own local branch for 3 months and got fired.

This isn't the 'coder horror' thread so I'll just say that you might be surprised.

ijustam
Jun 20, 2005

I had a coworker leave and didn't check in their latest revisions. I had to pull their hard drive from their machine which, thankfully, never got picked up by It. They had 3 directories full of code and some of them had multiple versions of the same code. There was a lot of code-2" and "code-2-bak"

Ugh.

EAT THE EGGS RICOLA
May 29, 2008

ijustam posted:

I had a coworker leave and didn't check in their latest revisions. I had to pull their hard drive from their machine which, thankfully, never got picked up by It. They had 3 directories full of code and some of them had multiple versions of the same code. There was a lot of code-2" and "code-2-bak"

Ugh.

I just started a new job a couple months ago, and my boss (who has been working on my project for ~ 4 years) hasn't ever used proper version control for anything, so everything is just nested directories named "templates", "templates2", "templatesbak", "templatesnotworking", "templates20140202", etc.

Newf
Feb 14, 2006
I appreciate hacky sack on a much deeper level than you.
What does 'bak' here stand for?

EAT THE EGGS RICOLA
May 29, 2008

Newf posted:

What does 'bak' here stand for?

backup?

canis minor
May 4, 2011

Newf posted:

What does 'bak' here stand for?

Winmerge automatically creates .bak files if you do any sort of changes - I always thought it stands for backup.

At my first job we didn't have any version control and the "process" was to modify files through ftp and yelling which file you're editing. To put things more in perspective it had DB tables called "sex" and "god"; when I dropped "god" on my local nothing happened, but dropping "sex" crashed the site. Oh, the allegories :allears:

titaniumone
Jun 10, 2001

Color Gray posted:

On a related note, I once saw someone link to this "rebuttal" to that article:

http://forums.devshed.com/php-development-5/php-fractal-bad-design-hardly-929746.html

Except that they ignored the part where the author of the article himself ("Eevee") shows up and (very politely) shits all over his arguments. :laugh:

Fake edit: I forgot that the guy attempting the rebuttal also gave us such gems as "JavaScript is not a loosely typed language." :downs:

holy fuuuuuuuuuuck I tried to read that thread and it's just embarrassingly difficult to read. The general level of understanding in there is shockingly bad. Eevee explains most of his issues reasonably well but the other people totally fail to grasp any of the problems he's presenting.

shrughes
Oct 11, 2008

(call/cc call/cc)
Oh devshed. I think I had an account there.

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?
I like the part where a poster tries to excuse the language based on it's history and how it came about. As if that was an argument in it's favor. These people are so emotionally invested, it's like PHP is their child. "You can't criticize PHP for that until you've walked a mile in it's shoes! You don't know the hard life it's had to live!" It's a programming language. Who gives a poo poo why it's bad, if it's bad then don't use it.

Someone else asks what's the point of this criticism, even if it's flawed PHP is going to remain popular and won't be going anywhere. Hmm, you think maybe it wouldn't be so popular if people looking to build new sites were warned about it? You know, by others who had used it and elucidated its flaws in articles for the rest of us to read? Nah, that's just pointless navel gazing, no one is interested in that sort of thing.

It's strange the things people will come up with when they start with their conclusion and reason backwards.

Westie
May 30, 2013



Baboon Simulator

HappyHippo posted:

It's strange the things people will come up with when they start with their conclusion and reason backwards.

And yet when PHP is used properly it's amazing.

Soricidus
Oct 21, 2010
freedom-hating statist shill

Westie posted:

And yet when PHP is used properly it's amazing.
Agreed, I too am amazed whenever someone manages to take PHP and produce something good.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Westie posted:

And yet when PHP is used properly it's amazing.

I'm not sure if this is trolling or not, but I don't think anyone would claim you can't write something amazing with PHP, or even that you can't write amazing PHP code.

The question is...why would you choose PHP to do this? AFAICT, there are very few reasons to do so.

Westie
May 30, 2013



Baboon Simulator

Thermopyle posted:

I'm not sure if this is trolling or not, but I don't think anyone would claim you can't write something amazing with PHP, or even that you can't write amazing PHP code.

The question is...why would you choose PHP to do this? AFAICT, there are very few reasons to do so.

It's not trolling.

But then again, the stupid stuff you have to do to objects in PHP to actually make them useful in terms of implementing stuff like ActiveRecord or getter/setter methods is insane. It's like getting your code and injecting it with heroin and cocaine. Somehow it's amazing but you end up dying inside.

I don't know why I don't follow my friend's lead and use Python/Go or something else as equally hipster.

Never Ruby though. Too omakaze for me.

No Safe Word
Feb 26, 2005

Westie posted:

And yet when PHP is used properly it's amazing.


Westie posted:

But then again, the stupid stuff you have to do to objects in PHP to actually make them useful in terms of implementing stuff like ActiveRecord or getter/setter methods is insane. It's like getting your code and injecting it with heroin and cocaine. Somehow it's amazing but you end up dying inside.

When you have to do "stupid stuff" to make something be considered "used properly", you probably shouldn't use it.

qntm
Jun 17, 2009

Westie posted:

And yet when PHP is used properly it's amazing.

That's a tautology.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe

Westie posted:

And yet when PHP is used properly it's amazing.

When my abusive boyfriend doesn't beat me the relationship is amazing.

Mogomra
Nov 5, 2005

simply having a wonderful time

Westie posted:

It's not trolling.

But then again, the stupid stuff you have to do to objects in PHP to actually make them useful in terms of implementing stuff like ActiveRecord or getter/setter methods is insane. It's like getting your code and injecting it with heroin and cocaine. Somehow it's amazing but you end up dying inside.

I don't know why I don't follow my friend's lead and use Python/Go or something else as equally hipster.

Never Ruby though. Too omakaze for me.

I'm genuinely interested in what is considered "stupid" stuff. PHP really sucks mostly because there's no internal consistency as far as I can tell. Some function names are camel case, some get underscores, some are just all the words mashed together. How can anyone keep that poo poo straight?

Don't get me started on error handling.

JawnV6
Jul 4, 2004

So hot ...

Mogomra posted:

I'm genuinely interested in what is considered "stupid" stuff.

I've heard this guy Terrence is an expert.

Mogomra
Nov 5, 2005

simply having a wonderful time
I'm honestly just curious what other people think. v:shobon:v

Strong Sauce
Jul 2, 2003

You know I am not really your father.





Westie posted:

It's not trolling.

But then again, the stupid stuff you have to do to objects in PHP to actually make them useful in terms of implementing stuff like ActiveRecord or getter/setter methods is insane. It's like getting your code and injecting it with heroin and cocaine. Somehow it's amazing but you end up dying inside.

I don't know why I don't follow my friend's lead and use Python/Go or something else as equally hipster.

Never Ruby though. Too omakaze for me.

Rails is omakaze dude. Get it right.

xtal
Jan 9, 2011

by Fluffdaddy

Westie posted:

It's not trolling.

But then again, the stupid stuff you have to do to objects in PHP to actually make them useful in terms of implementing stuff like ActiveRecord or getter/setter methods is insane. It's like getting your code and injecting it with heroin and cocaine. Somehow it's amazing but you end up dying inside.

I don't know why I don't follow my friend's lead and use Python/Go or something else as equally hipster.

Never Ruby though. Too omakaze for me.

Ruby is one of the most flexible languages there is (perhaps to its detriment.) Rails is omakase, and that isn't to say it's inflexible. Omakase is shorthand for "convention over configuration."

nielsm
Jun 1, 2009



xtal posted:

Omakase is shorthand for "convention over configuration."

Sorry, no. It's Japanese for "my way or the highway".

Or in other terms, "really inflexible".

Westie
May 30, 2013



Baboon Simulator

Mogomra posted:

PHP really sucks mostly because there's no internal consistency as far as I can tell. Some function names are camel case, some get underscores, some are just all the words mashed together. How can anyone keep that poo poo straight?

There is consistency - it's about as consistent as custard. Keep jumping on it and you'll stay afloat, rest for a moment and you'll find yourself knee deep in the stuff.

All procedural functions are usually styled after C naming conventions - underscores, so, stuff like file_get_contents, curl_init, html_entity_decode, htmlentities, oh drat it.
All object methods tend to be styled after Java naming conventions, camelCase and the like - and that's pretty consistent. Well, I say consistent - have a look at the MySQLi class, that's consistent in the fact that both procedural and object calls both use underscores, which, considering how much Java is seeping into PHP, is rather odd.

But it pays the bills.

TheresaJayne
Jul 1, 2011
I think this argument for/against PHP is futile.

PHP is provided with apache webserver as default. (LAMP/XAMP etc)

To add Tomcat/another language you usually have to download and install said language/tool

PHP has a foothold much like Windows has.

The first web language most newbies will touch therefore will be php.

Knowing that. Is it such a bad thing? those who know better will not use it. Let the newbies use it until they realise that it is not as good as they thought - but by then they have the knowledge to know what is a better language.

For instance at college i learnt a "4GL" (basically DB front end where it automatically created the forms)

Ruby on Rails struck me as just being a Web based version of that.

QuarkJets
Sep 8, 2008

These arguments won't convince the hardcore dug-in PHP veterans, but if it leads to at least one PHP newbie trying something else, then is it actually futile?

ninjeff
Jan 19, 2004

TheresaJayne posted:

but by then they have the knowledge to know what is a better language.

No they don't, by then they have a massive sunk cost and a huge pile of "evidence" that using PHP is productive.

PrBacterio
Jul 19, 2000

Westie posted:

PHP [...] used properly
You mean like this?
code:
~$ sudo apt-get remove --purge php5

canis minor
May 4, 2011

So, which language has naming consistency?

Sebbe
Feb 29, 2004

eithedog posted:

So, which language has naming consistency?

Brainfuck sticks pretty well to its one-character-per-instruction naming convention.

Mogomra
Nov 5, 2005

simply having a wonderful time

Westie posted:

All procedural functions are usually styled after C naming conventions

I always hear that reasoning, but it's still a poo poo reason. :colbert:

Adbot
ADBOT LOVES YOU

Subjunctive
Sep 12, 2006

✨sparkle and shine✨

Keith Adams gave a talk about why we still use and improve PHP at Facebook: http://www.infoq.com/presentations/php-history

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