Ask HN: I'm starting a new job as a PHP developer tomorrow
I've been working with Rails remotely since 2008 (~7 years in total). However, remote work has died out and decreased dramatically.
Is there anything you guys could recommend? I haven't worked with PHP in years so I'm worried about my performance with PHP on the new job.
I know how to program but I'm not familiar with PHP anymore, in fact I don't recall anything about it.
The reason I'm going back to PHP? Sorry, it's not my decision, and there aren't many local jobs in my area, so I'm taking what I can, and that's work with PHP at the moment.
Hopefully I'll find other jobs with saner languages in the future.
One other thing I want to mention is that I'm a Linux person, I can't use anything else. However, I've noticed that the company that wants to hire me is a Windows shop, they use Windows mostly (Windows desktops, Sublime Text, and so on).
Do you guys think it's acceptable if I use Arch Linux on a VM (VirtualBox) and I fullscreen the VM? I use things like i3-wm and vim and I'm really used to tiling WM these days, so using Windows would be very painful.
I asked if I could install Arch Linux on bare metal but they said no. They said I have to use a VM. They also mentioned I can't bring my own hardware.
I've been using Linux for 15 years and I currently use Arch Linux at home and on my laptop.
Suggestions welcome.
95 comments
[ 3.3 ms ] story [ 171 ms ] threadUse PHP... and you will become familiar with PHP.
https://laracasts.com/series/laravel-5-fundamentals
It wasn't OOP at the start and had weird warts.
As PHP mature it's much better than its past and have fixed some complaints but unfortunately the bad rep still stuck. Plus there are some fundamental warts that you can't just fix.
In general, I'm happy that PHP is thriving and continue to improve. It looked bleak for a while and I regretted choosing PHP over Python or Ruby for web dev.
I find that it doesn't matter much if you're using MVC frameworks such as Laravel. You hardly need to memorize or use crazy stuff with PHP and most of the time you're just googling framework stuff how to grab param from route, etc...
I've done Scala Play framework that that language get in the way a lot on top of googling how to do stuff with play framework.
But I suspect that this observation is because more of dynamic language vs type language more than PHP vs Scala.
--
I think in general it's just language evolve and got better.
Perl started web dev and then PHP was better then Python came along and after that Ruby. With each subsequent programming languages the languages got prettier and had more thoughts into the design.
http://www.phptherightway.com/ is a great resource for most things you'll need to know when working with modern PHP. Definitely start here.
Familiarize yourself with the ecosystem by poking at the most popular frameworks, at least skimming the docs to understand the types of things they provide and how they're structured: Zend, Symfony and Symfony Components, Laravel, Slim, Silex. Study WordPress, the "stereotypically bad" piece of software, for anti-patterns, but there's also a lot of good stuff in there and some improvements on the roadmap.
Composer is the npm of PHP. Check out packagist (horrible UI though) or browse github's PHP repos to find some of PHP's commonly used packages, like Monolog and phpunit. You can build a simple app in minutes in Laravel, and even put together a small product MVP using 90% boilerplate code within a matter of days on Laravel. Since there's a growing ecosystem for these tools now, it's getting easier and easier to write quality software in PHP, and it's actually a relatively pleasant experience.
Plus shipping and managing PHP in production is a breeze -- it's the most widely supported web platform, after all. We've got support on great CI systems like circleci and scrutinizer-ci.
Anyways, start there and good luck!
* The language has comes leaps and bounds since you last used it
* Install composer and learn how to use it (PHP package manager)
* Read up on Laravel, IMHO it's the best PHP Framework out there right now. They guy behind it is a genius and has great vision for it.
* You'll want to use nginx + php5-fpm (No more apache and php_mod)
* Check our PHPStorm, if you are going to use an IDE you can't bear intelij IMHO and PHPStorm has support for a myriad of things
* ORM's have greatly improved, even if you aren't going to use Laravel read up on it's ORM to see what is possible
* Much more OO now especially when it comes to interacting with the DB (no more mysql_connect/mysql_query nonsense)
> if you are going to use an IDE you can't bear intelij
if you are going to use an IDE you can't beat intelij. They are also the people behind resharper.
Readers, if you are a student, please check out https://www.jetbrains.com/student/
Read up on Composer and Packagist. It's basically NPM, Gems, or PyPi for PHP. There are now solid interoperable libraries for most common tasks.
- https://getcomposer.org
- https://packagist.org
Laravel is a great framework, but quite a bit of what's out there seems to be built on the Symfony foundation.
- http://laravel.com
- http://symfony.com
There are also great coding guidelines and tools that are evolving. The PHP Framework Interoperability Group has produced some solid coding standards and tooling has followed.
- http://www.php-fig.org
WordPress...it makes me sad. But it's ubiquitous. If you're stuck doing WP work, take a look at the Roots project. It's a sane, modern approach with good tooling.
- https://roots.io
I talked about what they use on their PHP stacks and they mentioned they don't use any frameworks at all. They use AngularJS for their front-end but on the PHP side they use pure PHP and no frameworks at all.
The bigger gotcha will be getting used to the execution model, if it's standard LAMP-y type application hacking. Remember that, in this style of app, all of your state has to be either explicitly stored in a backend or in the browser cookies. The script begins not knowing anything, lives briefly, excreting HTML or JSON, and then dies, leaving behind only what it's explicitly saved. In some ways it's more complex than a Rails-type model, and in others it's simpler.
In any case, you should be up to speed in a week or two of hacking at it full time.
In PHP-land you're just as likely to walk into a job where interns have been hacking crazy stuff into a Simple Machines forum for the last year as encounter something built on a framework. And of course, mixing javascript, css and php together with whatever happens to come out of a database query (which is encoded in who knows what) is not at all uncommon, so even frontend knowledge is helpful.
I asked if they can let me install Linux on the computers, they said I have to use a VM.
I'm fine with a VM but I also need my window manager of choice (i3-wm) and so on.
Would it be okay if I install Arch Linux on VirtualBox and I fullscreen the VM? What about performance then?
All the other developers are using Windows and putty shells and Sublime Text as their editor.
I asked if I could bring my own laptop but they said I can't.
Suggestions welcome.
Changing from Linux to Windows is indeed rather painful. As others have mentioned, depending on deployment/process etc -- you might still be better off trying to live on the windows side.
I'm not a windows dev, but from what I've seen mentioned by others -- running php on windows w/IIS and SQL server works fine -- but you'll want to have a test/dev environment that matches prod -- or you'll just constantly run in to pain points -- especially if the team isn't on board/interested in investing in a full heterogeneous environment.
For a small example with node, see eg:
https://github.com/keithamus/npm-scripts-example/issues/5
Hopefully your new team has some automation in place -- it's unlikely it'll work out of the box under linux if it's never been tested/linux has never been a requirement.
On the bright side, vim works fine under windows, and with some mingw32/64[2], things aren't entirely painful. If you're used to script things with ruby, that should be even easier. Having to work with cmd.exe and it's nasty find.exe rather than grep, feels like running with one leg tied behind your back.
Lack of proper tabbed/keyboard-friendly window manager is probably the biggest productivity drain -- thought there are some alternatives for that too[3].
[1] http://www.hanselman.com/blog/SwitchEasilyBetweenVirtualBoxA...
[2] http://msys2.github.io/
[3] https://github.com/fuhsjr00/bug.n
That said, I think you will be able to adjust if you want. Just use vim on Windows, or use sublime with vim keybindings. You can also use a VM fullscreen. Works fine, I've done it before.
Is your objection to using win 8.1 for doing documentation in word and using outlook?
Just use win8.1 and use hyperv to run your VM is one option
>Suggestions welcome.
Keep looking for a new job. I guarantee this is the tip of the nightmare iceberg you're about to hit.
I hope I am wrong, but I've seen this enough times before to know that I'm probably not.
Please spend first 90 days building a good reputation and impression for yourself with your supervisor and coworkers and later use your reputation to drive any changes. By insisting on using Arch Linux, you will be wasting yours and others time in accommodating your preferences in recreating the workflow and tools that everyone else is used too.
You should focus on learning the tools and workflow used by your employer. You are no longer a freelancer who can chose their own tools and workflow, you are a cog in a machine now and learn how machine operates.
Your first priority should be to learn Windows and Development tools used by your coworkers. Find out what PHP framework and technology stack being used. And learning them is your next priority.
For example, at my job everyone runs OS X, so build scripts, etc are all written with that assumption in mind.
They mentioned they use OOP and things like that, but their codebase appears to be plain PHP with no frameworks.
They created an account for me on the Windows machines. I'm on my way to set up an Arch VM.
I spent my own time, i.e. lunch breaks, adopting the company workflows to my dev environment.
Given the availability of most of the good stuff on Windows, I don't think my workflow would change very much if I were forced onto a Windows box right now, apart from the occasional bummer about some bleeding edge software being unported or some library assuming Mac/Linux. Indeed, it was being forced to work on a Windows machine for a couple years that made me switch from TextMate to Vim (it made sense to become proficient with a single cross-platform editor).
They develop on Windows with Sublime Text.
At the company I work for, we have people on Windows, and we have people on OSX. We've never had a problem with it. Our build scripts are agnostic because we deploy to Linux anyways. If someone doesn't have a piece of software on a specific OS, we just run it on a VM.
I just can't think of a good reason to why you would need to switch to Windows in a PHP environment. I think it might be understandable if you work on a platform that forces you to run a specific operating system (like specific game engines), but I doubt he'll have any issues doing PHP dev on a Linux machine and switching to a different OS is just going to slow him down.
I assume the reason the company is not allowing you to run on metal is so they can install company software to monitor and install software updates on your machine, not because of the development environment associated with PHP.
I wouldn't switch my OS for a company unless the work absolutely requires it. My environment is highly automated for OSX and I can get up and running in under an hour. All my software is installed automatically, I have set directories where websites live and nginx is already configured to run from those directories.
PHP is a language like any other. it has good and bad parts. what might prove useful is to focus on learning the codebase.
Good luck!
> I asked if I could install Arch Linux on bare metal but they said no. They said I have to use a VM. They also mentioned I can't bring my own hardware.
Beggars can't be choosers :(
Whether your Linux VM setup is acceptable will depend entirely on what the rest of the shop is used to. For example, if they develop on Windows desktops and deploy to Windows servers, you may need to use Windows scripts and test for Windows-specific corner cases, which would be difficult to do on a Linux VM. You may need to adjust all of your tools to use Windows line endings (CRLF). You may find that some of your tools don't work correctly on a vboxsf or samba filesystem. Be prepared to make compromises where necessary.
On the other hand, if they deploy to Linux servers, your knowledge of Linux and your VM might end up being a valuable asset for the shop.
In any case, don't say that you "can't use anything else". Of course you can. Learning to use a new OS or editor is not terribly different from learning a new language. If you can learn a new language, you can certainly learn to use Sublime Text or whatever.
Unwillingness to try a new tool just because it's outside of your comfort zone could reflect poorly on you, no matter how well justified you think your choices are. Your employer has shown flexibility by letting you run a VM. Try to show some flexibility in return.
Now, with the hindsight, it was a big mistake : it did make me loose so much time ! I did had to fix one script out of 2, the build system was not working properly, etc... And linux and Os X are not that different !
Don't do that... Use the tools that you company gives you, and try to fit in the company. Otherwise, you will be seen as the guy who does not want to do stuff the same way as the others. Even if everything goes well with your coworkers, you will end up waisting time every day.
You can install vim on windows (and sublime text does have quite a few almost decent vim plugins). You will miss i3wm a lot, but you don't need it to do good work.
Learn how to use the most efficiently the tools your company gives you (Windows and PHP). If you want to change something (at least for your first couple of month), try to change something that will make everyone life easier, not more complicated.
If they have trouble helping you just because you run a different OS then they don't sound like they're skilled enough to begin with.
And it's probably them who can't adapt rather than you.
Yes. This should work provided you have a system with memory > 8GB, but you might face some issues when using a folder shared from windows. If something involves symlinks, then tread carefully. And file access to a shared folder is pretty slow too.
I am not going into how bad of an idea is going back to php since you have already considered it. But I will just say that php is every bit as bad as it was. I recommend /r/lolphp for an updated list of php gotchas...
Granted some (most?) of these modern php features aren't quite as nice as they are in other languages, and there is still some weirdness (/r/lolphp as you mentioned), and an inconsistently named standard library... But php has made some strides in the past 8 years. Once you're aware of the gotchas its not as bad as everyone makes it out to be.
> Once you're aware of the gotchas (and keep your head stuffed with this useless info the whole time you are working with PHP) its not as bad as everyone makes it out to be..
First, you need to be aware of the gotchas. But this is not possible because,
1. We are still counting (take a look at /r/lolphp).
2. Even experienced (8+ years) php programmers know a very small percentage of the php gotchas. See this http://www.reddit.com/r/PHP/comments/2zhg6z/how_true_is_this.... You can see one commenter. who is an experienced php programmer who was not aware of that at the time. I myself had 8 years of experience when I was bitten by this bug..ahem..feature. So unless you haven't gone through all of /r/lolphp and commited the relavent ones to your memory and check them for every single line of code you write, you are bound to be bitten by one of those.
3. And documentation does not help. Even php core develpers agree that some of the important parts of documentation is incorrect but NO ONE CARES about things like that. Every one is out to implement flashy new stuff that fanboy can brag about. Even the existing documentation is does not go much deep into details. eg this is the php.net page regarding exception handling
http://php.net/manual/en/language.exceptions.php
compare this to Pythons documentation
https://docs.python.org/3/tutorial/errors.html
https://docs.python.org/3/reference/compound_stmts.html#try
If you want to find how a return statement behaves inside of a finally block, the info simple isn't present in the php's documentation. Because "who cares because we copy stuff from java, so we probably does not not what is important to document anyway."..
I mean, it is very subtle and the recent 'facelift' that php received makes it hard to see its truly shitty nature for newcomers. When they look, they see all the shinny new features (often half assed) and think that php is on the same level as Python or whatever....
A few things come to mind of Windows if you choose to give it a try. 1. Vim for windows works pretty well 2. It's pretty fast to switch to a different application context on windows using win-key. On windows 7 still win + 1-9 switches to the cirresponding application on task bar - and the order of applications can be reordered by dragging a mouse.
Windows nowadays is pretty solid tech but it's aimed at a general demographic so finding all the power user levers take a while. Of these:
-powershell ISE is a really nice command line (well, better than cmd) and it comes out of the box
- some people swear by automation through autohotkey scripting
- win-r is a fast way to start apps and scripts
- hitting win key and typing the name of an application is a fast way to start applucations by just the exe name
Good luck on the new job!
The community is massive and full of people who are deeply passionate about best practices. There are more quality frameworks than you can hope to keep up with (if your ranking of quality is the meager toy that rails is, you'll be happy here). The frameworks are really good at abstracting away the awful API choices the language makes.
That said, if you're writing in "PHP" instead of a given set of frameworks... you're working at a company that hired someone who wrote a lot of code with no experience of what makes a good system... but you'll soon find the JS looks exactly like that too, because that's not a PHP problem.
For your OS: You can get windows analogues to all those things (in the case of vim, you can also just... use vim on windows). They offered me a mac or a windows machine where I work and I opted for mac because it's just BSD4... but like... the WM is a pile, and I wish I was using Windows98 over mac. But none of that has stopped me from making huge contributions to the team.
You can always install Windows via Boot Camp. There's little reason to even have this kind of discussion these days.
At one place we insisted on having machines from the same production run and ideally all the DASD (disks) would be from the same batch.
If your tools are sane, dev how you want.
However, my problem is that I'm stuck with Windows 7 at work, so I have to use something like VirtualBox to run Arch on it.
I'll try getting one of those SATA-over-USB converters and I'll get my SSD to the office, hopefully they'll allow me to boot over USB so I can run Arch and bypass Windows completely.
PHP is honestly a pretty swell language despite its irregularities and reputation amongst people who work with newer, more trendy language. It has a great community, and the language its self keeps getting updated with modern features, even if they're sometimes done in a slightly awkward manner.
1) if you switching from ruby to php because there is no remote jobs.. well, there are plenty of them
2) you didn't touched php for 8 years, so why go php?
3) they are locked to windows and you can't install linux, well, don't go there
4) you can't even bring hardware! wtf! don't go there x2
1) Show me where are the remote jobs you're talking about. I've been looking for a long time on different sites, e.g."Who's hiring" (Hacker News), We Work Remotely, and so on.
The standard response I always get is:
- "Thanks for reply. No this is Full time only."
- "Thanks for getting in touch. Unfortunately we are looking for someone to join our London team."
- "Unfortunately, we’re not looking for remote engineers at this time."
I've got enough of this shit.
2) Because there's nothing else I can find. I don't live in SF where you have a lot of options about where to work and the toolsets you can use.
3) They allowed me to use Linux on a VM so I can use Linux. I'm just stuck with a VM for now and while that's not optimal, it's still better than nothing. I'll try booting Linux from USB and see if they allow me to do this, so I can bypass Windows completely.
4) Lots of companies don't allow this, and this is full time employment, not your cool and fancy startup in SF where they allow you to play video games in the office.