Jump to content

Namespaces (ProcessWire 3.0?)


mindplay.dk
 Share

Recommended Posts

I'm always willing to take a fresh look at tools other people like. There was no VIM mode back when I used PhpStorm, so that sounds interesting from that aspect (as does the sublime vintage mode). But should qualify that I'm not naive about this, have spent a lot of time in IDEs, and used dozens of different editing environments over the years. Back when I was a C++ programmer working for another company, I didn't have a choice. I also used PhpStorm for a couple weeks when it was new (with ProcessWire), as well as Zend's IDE for some time. I even grew up in Turbo Pascal and Borland C++ IDEs, using them for years. But my mind always ends up more in the editor than in the code. For me, less has always been more. It's not about what's practical, easy or fast. VIM takes me to a place where I can think, and it took me years to find it. I lose creativity and enjoyment when you take away the minimalism. Coding becomes about work rather than code. I lose track of stuff when something is keeping track of it for me. What can I say, this is how I am about all my tools except maybe Photoshop. No doubt IDEs can be time savers when it comes to certain tasks, but I've not found it worth the tradeoff. (Though TextWrangler is my go-to for anything involving regex search/replaces across mass amounts of files). I will keep trying out tools that other people like and recommend, but I think most of the time we're looking for different things. I'm not trying to sway anyone towards using what I use. It's not practical, and it's slightly insane. In fact, I would say you should avoid the likes of VIM if you enjoy using an IDE.

This is all beside the point on PSR-0 changes to the core. I can put up with more files, as the inconvenience is relatively minor. But I thought it was worth asking if there were any compliant conventions for including a similarly-named group of classes in one file. For instance, a file named Selector_.php might include classes beginning with the word "Selector", which are already grouped together in a file by intention and design.

  • Like 2
Link to comment
Share on other sites

Ryan,

I also spent lots of time with many different IDEs over the years - I too started out in Borland/Turbo/Delphi, and like you, Photoshop is one of the only non-minimalist apps I've been lugging around for over a decade. I think we have a lot in common that way. I have tried every PHP IDE there is, big and small, and PhpStorm finally swayed me, so they must be doing something right! If you're like me, it'll take your a week or two to discover the settings to tweak to turn "too much" into "just enough" - like all IDEs, Storm does a lot of hand-holding out of the box. But I'm really happy with it now and can't really imagine programming without it at this point.

Anyway, I wasn't trying to turn this into an IDE discussion, but I really think you might like this - it sounds like we have some of the same mind-set and background ;)

For instance, a file named Selector_.php might include classes beginning with the word "Selector", which are already grouped together in a file by intention and design.

Don't count on FIG recommending this, as the only purpose that would serve (for most people) is performance, and only to a very minimal extend - and not even that, unless you're hosting PHP without a bytecode-cache...

Link to comment
Share on other sites

That's cool to hear we have similar roots! I trust what you are saying and will certainly give PhpStorm another try.

Though I have to admit, I can't get enough of VIM. :) It really is one of my favorite tools. The only reason I don't tout it more here is that I recognize it's quite difficult to use until you get used to it. Though once you get used to it, it's difficult to use anything else. But I try and keep an open mind about trying new editors. If PhpStorm will let me use a VIM key set and not annoy me with lots of menus, autosuggestions, autoindenting, code collapsing, etc., then that'll go a long way.

Link to comment
Share on other sites

That's cool to hear we have similar roots! I trust what you are saying and will certainly give PhpStorm another try.

Though I have to admit, I can't get enough of VIM. :) It really is one of my favorite tools. The only reason I don't tout it more here is that I recognize it's quite difficult to use until you get used to it. Though once you get used to it, it's difficult to use anything else. But I try and keep an open mind about trying new editors. If PhpStorm will let me use a VIM key set and not annoy me with lots of menus, autosuggestions, autoindenting, code collapsing, etc., then that'll go a long way.

Then I would really recommend Submline Text 2 as it's minimal and unlike the other big cluttered IDE's and faster than light, fullscreen, distraction free edition! VIM keys are no problem. I choose sublime because of all of this. ;)

  • Like 1
Link to comment
Share on other sites

Then I would really recommend Submline Text 2 as it's minimal and unlike the other big cluttered IDE's and faster than light, fullscreen, distraction free editing! VIM keys are no problem. I choose sublime because of all of this. ;)

+1 for Sublime Text 2. Been using it a couple of weeks now and i'm a fan. Will probably buy a license.

Link to comment
Share on other sites

If PhpStorm will let me use a VIM key set and not annoy me with lots of menus, autosuggestions, autoindenting, code collapsing, etc., then that'll go a long way.

Out of the box, there will be plenty of auto-complete, auto-indent, code-collapsing, auto-everything - you will figure out how to turn most of that stuff off or adjust it to minimize the noise.

What's really helpful is things like function-parameter hints, and the ability to rename a function or variable and have the changes propagate automatically. Support for doc-blocks is something I really enjoy as well - it encourages you to document properly, declaring return-types, etc. The "code style" configuration is really detailed and helps correct inconsistencies in code-formatting. In a lot of ways, it just whips you into shape - or if you're already a total stickler, it helps you catch up quickly when you make a simple typo or forget to document a change etc...

Link to comment
Share on other sites

Function param hints I can also do without, though certainly understand why people like them. I've got major ADD and anything popping up when I'm typing and thinking is a huge distraction (even if the intention is to help). But so long as everything can be disabled, and I can have my black background, all is good. :) I've already been using doc-blocks forever, though my to-do list has expansion of the doc blocks to include @property, @internal and others, which I've not used, so it actually would be helpful to have an editor that recognizes these things. I'm not too worried about inconsistency of code formatting, as I've stuck to the same format for years. But I can see this being helpful for the times when doing my manual pull-requests that might include copy/paste, like we talked about before. Sounds like I need to try both PhpStorm and Sublime.

Link to comment
Share on other sites

A similar color scheme is available in PhpStorm. I haven't used Sublime, because I finally found my IDE - but I have heard many developers say very nice things about it... For one, it's supposed to be extremely fast - where most other IDEs (including Storm) feel kind of sluggish in terms of display updates...

Link to comment
Share on other sites

Anyhow, to the subject at hand - if you don't want to merge my changes, can you post here and let me know when similar changes have been implemented on your codebase? I'd like to pursue the namespace-conversion, but as mentioned I can't continue from my own branch since your changes would not be identical to mine...

  • Like 2
Link to comment
Share on other sites

@SiNNuT: That distraction free mode looks nice. The giant left margin is a little unusual, but the result here is pretty great. Thanks for the screenshot.

@mindplay.dk: I'm going to merge your changes, but on a more manual basis so I can go through each file one at a time and think through any possible hiccups or optimizations in the right context as I go through it. I have a week off coming up in August, so planning to do it then along with some other updates. Though if I get another unexpected free day off work like I did earlier this week, I'm going to get started with the PSR-0 changes earlier. Thanks again for your help with these changes.

Link to comment
Share on other sites

  • 3 years later...

I just stumbled over the roadmap for version 3 and couldn't do anything about asking myself, what the state of namespaces and the implementation of psr0/4 in ProcessWire is right now? With Drupal having just released the first RC for v8, I suppose this is going to be an important topic for all content management systems in the very near future.

@mindplay.dk already did most of the heavy lifting years ago, but his changes were never pulled and his repository is now gone. This will be quite a lot of work, so how can we approach this? How can the community be of help?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...