如何提高自己的“进阶”对 PHP 进一步了解? (迅速地)

发布于 2024-09-03 20:50:55 字数 715 浏览 10 评论 0 原文

我使用 PHP 已经很多年了,对这门语言有了很好的掌握,创建了许多运行良好的先进和不太先进的系统。

我遇到的问题是,只有当我发现需要一些我以前没有学过的东西时,我才会学习。这使我查找解决方案和处理问题的其他代码,因此我将了解以前从未见过的新函数或结构。正是通过这种方式,我学到了许多更好的技术(例如学习亚马逊、谷歌或其他大公司推出的课程)。

这样做的主要问题是如果你不知道某些东西存在就无法学习它的概念。例如,我花了几个月的时间来学习 empty() 函数,我只是使用 strlen() 检查字符串长度来检查空值。

我现在开始构建越来越大的系统,并且我开始阅读 highscalability.com 等博客,并一直在研究 MySQL 复制和服务器数据以进行扩展。我知道代码的结构对于使整个系统正常工作非常重要。

在阅读了最近一篇有关 Reddit 结构的博客后,我开始怀疑是否存在一些标准或“公认的系统”。

我研究过框架(我使用过 Kohana,我很遗憾,但我认为 PHP 框架不适合我)并且我更喜欢自己的函数库而不是框架。

我目前的结构是 WordPress、Kohana 和我自己的知识的混合。

我认为可能有益的方法有:

  • 阅读博客
  • 阅读教程
  • 与其他人合作
  • 阅读一本书

“进入下一个级别”成为一名非常优秀的系统开发人员的最佳方法是什么?

I have been working with PHP for years and gotten a very good grasp of the language, created many advanced and not-so-advanced systems that are working very well.

The problem I'm running into is that I only learn when I find a need for something that I haven't learned before. This causes me to look up solutions and other code that handles the problem, and so I will learn about a new function or structure that I hadn't seen before. It is in this way that I have learned many of my better techniques (such as studying classes put out by Amazon, Google or other major companies).

The main problem with this is the concept of not being able to learn something if you don't know it exists. For instance, it took me several months of programming to learn about the empty() function, and I simply would check the string length using strlen() to check for empty values.

I'm now getting into building bigger and bigger systems, and I've started to read blogs like highscalability.com and been researching MySQL replication and server data for scaling. I know that structure of your code is very important to make full systems work.

After reading a recent blog about reddit's structure, it made me question if there is some standard or "accepted systems" out there.

I have looked into frameworks (I've used Kohana, which I regretted, but decided that PHP frameworks were not for me) and I prefer my own library of functions rather than having a framework.

My current structure is a mix between WordPress, Kohana and my own knowledge.

The ways I can see as being potentially beneficial are:

  • Read blogs
  • Read tutorials
  • Work with someone else
  • Read a book

What would be the best way(s) to "get to the next level" the level of being a very good system developer?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(15

孤凫 2024-09-10 20:50:55

每个想成为 PHP 程序员的人,总是只看第一个词,完全忽略第二个词。

虽然“编程”比“PHP”更重要,但要成为一名 PHP 专业人士,首先应该是一名程序员。

所以,我会投票给最后一个——读书。不是关于 PHP,而是关于一般编程。 Grady Booch 的,Martin Fowler,甚至老Donald Knuth 的。
看看其他一些语言也很好,比如 Java 或 Python。不是转向他们,而是向他们学习。

Everyone who wants to be a PHP programmer, always takes only the first word and completely ignores the second.

While "programming" is WAY more important than "PHP", to be a PHP professional, one should be a programmer in the first place.

So, I'd vote for the last one - reading books. Not on PHP, but on the programming in general. Grady Booch's, Martin Fowler's and even the old Donald Knuth's ones.
It would be also be nice to take a look at some other languages, like Java or Python. Not to switch to them, but to learn from them.

说不完的你爱 2024-09-10 20:50:55

我更喜欢我自己的函数库
而不是有一个框架

您将“函数库”和“框架”视为不同的概念(很好!)那么为什么不尝试提高一点赌注并将该函数库变成一个框架呢?请注意,这是一种很好的学习方式,但不是获得适销对路的技能的最佳方式;)

这也是一种学习错误的好方法,所以在开始之前你必须做一些研究。

“必须具备”的功能

几乎所有框架都具有某些功能,这是有原因的。研究它们;找出它们存在的原因以及它们的变化;选择您希望在框架中包含哪些实现。

您想要了解和模拟的非 PHP 平台的功能

我不知道你对什么感兴趣,所以我就到此为止。

发布吧!

这部分很重要,因为内森是对的:你的工作必须被其他人看到、挑战、批评和纠正。不要把那盏灯放在斗下——它需要被看见;把它放在谷歌代码或sourceforge之类的东西上,如果人们愿意认真地看它,你就需要认真对待它;您需要维护单元测试和回归测试;你需要使用版本控制;您需要对其进行良好的注释,在每个文件的顶部添加一个大的 /* header comment */ ,并为每个类及其成员提供有用的文档生成注释。

总结

如果您完成了所有这些,您就可以(在高水平上)了解其他平台。作为一名 PHP 开发人员,你绝对可以“叮 40”。您可以了解单元测试;关于回归测试。您可以了解如何有效地记录。

保证你的框架会“与众不同,而且可能很糟糕”,但你可以从编写它中学到很多东西。请记住,框架不是产品;而是产品。这是一段旅程……某种意义上。

I prefer my own library of functions
rather than having a framework

You refer to a 'library of functions' and 'a' framework' as distinct concepts (good!) so why not try and up the ante a bit and turn that library of functions into a framework? Mind you this is a great way to learn but not the best way to have marketable skills ;)

It's also a great way to learn wrong so before you start you have to do some research.

The "must have" features

There are certain features almost all frameworks have, and there's a reason for that. Research them; find out why they are present and what their variations are; choose which implementations you'd prefer to include in your framework.

  • Object Oriented (this is key to why you'd write a framework as opposed to just using your library of functions)
  • Use of Patterns (check out and start asking yourself why so many frameworks use Application Controller as opposed to Front Controller... and are there some platforms which use Page Controllers?
  • Basic MVC structure
  • Clean URLs

Features of non-PHP platforms you want to understand and emulate

I have no idea what interests you so I'll stop there.

Publish it!

This part is important, because Nathan is right: your work has to be seen, challenged, critiqued and corrected by other people. Don't leave that lamp under a bushel - it needs to be seen; put it on Google code or sourceforge or something, and if people are going to bother looking at it seriously you need to take it seriously; you need to maintain unit tests and regression tests; you need to use version control; you need to comment it well, with a big /* header comment */ at the top of each file and useful doc-generating comments for each class and member thereof.

Summary

If you do all this, you can learn (at a high level) about other platforms. You can definitely "ding 40" as a PHP developer. You can learn about unit testing; about regression testing. You can learn about documenting effectively.

Guaranteed your framework will come out "idiosyncratic and probably sucky", but you can learn a lot from writing it. Just keep in mind that the framework isn't a product; it's a journey... of sorts.

桃扇骨 2024-09-10 20:50:55
  1. 查看 PHP 的隐藏功能PHP 的预定义接口
  2. 学习不同的语言。学习比 PHP 学习曲线更陡峭的语言。每当我指出其他语言相对于 PHP 的优势时,我都会被指责为攻击 PHP,而这些人大多显然从未真正掌握过另一种高级语言。但我要冒这个险。我建议使用 Ruby、Python、Pearl 和 haXe (作为严格类型的对应项)。完成后,尝试将您的新知识应用到 PHP 中。或者干脆放弃 PHP,以防万一您不想回去(我认为这不太可能发生)。
  3. 学会应对批评。你对内森帖子的反应很清楚地表明你还无法处理它。他是绝对正确的。
    • 现在看看我的第一个 PHP 框架,我不得不说它非常糟糕。当时我认为它很棒(而且它仍然比我已经部署的许多生产代码更好)。尽管如此,它还是有很多缺陷。除非你是一个十足的天才,否则如果你几年后回顾它们(假设你不断发展),你的第一个框架看起来会很糟糕。
    • 实际上,随着时间的推移,您将创建的任何框架都会看起来更糟(假设您不停止发展)。因此,您不妨使用可用的框架并更多地关注应用程序开发。如果您使用的框架有限制,请考虑做出贡献,而不是编写另一个 PHP 框架。
    • 选择编写自己的框架(不仅仅是为了乐趣/学习,而是为了生产部署)的时间点是当您的需求超过其他框架提供的功能时,而不是当您只是不喜欢工作的想法时与一个。这是一个常见的错误,我自己也犯过。但现在我可以说,我已经从中吸取了教训。但如果你寻求建议(不幸的是我当时没有这样做),你会得到这样的答案。
    • 通过使用不是您自己编写的代码,您可以学到很多东西。您不仅可以学到其他人投入大量思考的框架所提倡的概念,而且还可以学会高效、灵活、能够在团队中工作并完成工作(同时获得相当好的结果)。
    • 我想您不可能真的认为自己比 PHP 开源项目的每个团队都更好,否则您会问。克服年轻开发人员重新发明轮子的顽固本能需求,并成长为解决尚未解决过的问题。
  4. 了解组件库和框架之间的区别。既然您认为可以用“您自己的函数库”替换框架,那么您可能还没有理解框架的意义是什么。看看依赖倒置控制反转依赖注入< /a>.
  5. 了解软件设计。查看 OO 原则,例如 SOLIDGRASP
  6. 尝试不同的范式。 AOP,函数式编程。使用具有更强面向对象的语言(例如 Ruby、Objective-C 或 Smalltalk)来增强您的 OO 技能。
  7. 看看 PHP 框架,例如 Flow3、Symfony、PHP igniter 和 CakePHP。我已经指出了为什么我认为你应该这样做。
  8. 正如我在另一条评论中指出的,您应该考虑 RDBM 之外的其他存储。 SQL 和 OOP 确实不能很好地结合在一起。看看 OODBMS、不同的数据库抽象层、键值存储、文档存储(例如 CouchDB 和 MongoDB)、将缓存服务器分发为 memcache 等。
  1. Look into hidden features of PHP and PHP's predefined interfaces
  2. Learn different languages. Learn languages that have a steeper learning curve than PHP. Any time I point out advantages of other languages over PHP, I am accused of PHP bashing, mostly be people who quite obviously never really mastered another high level language. But I'm gonna take the risk. I suggest Ruby, Python, Pearl and haXe (as a strictly typed counterpart). Once you did it, try applying your new knowledge to PHP. Or just move away from PHP, in case you don't wanna go back (which I think isn't unlikely to happen).
  3. Learn to deal with critisizm. Your reaction to Nathan's post showed quite clearly you can't deal with it yet. He is absolutely right.
    • Looking at my first PHP framework now, I have to say it was quite shitty. At the time I thought it was great (and it still is better than a lot of production code that I've already seen deployed). Still, it had many flaws. Unless you're a total genius, your first frameworks will just look awfully if you look back at them a few years later (assuming you evolve).
    • Actually, any framework you will create will look worse as time progresses (assuming you don't stop evolving). For this reason you might just as well use available frameworks and focus more on application development. If the framework you use has limitations, consider contributing rather than writing yet another PHP framework.
    • The point in time to choose writing your own frameworks (not just for fun/learning, but for production deployment) is when your requirements surpass what other frameworks out there offer and not when you just don't like the idea of working with one. It's a common mistake, which I have done myself. But now I can say, I've learnt from it. But if you ask for advice (which I unfortunately didn't do at the time) you will get answers like these.
    • You learn a lot from working with code you did not write yourself. Not only do you pick up concepts promoted by frameworks others put a lot of thought into, but you also learn to be productive, flexible, able to work in a team and to get the job done (while obtaining reasonably good results).
    • I suppose you can't really think you're better than every team of a PHP open source project out there, otherwise you would ask. Get over the stubborn instinctive need to reinvent the wheel any young developer has and grow up to tackle problems noone has tackled yet.
  4. Learn, what the difference is, between a component library and a framework. Since you think you can replace a framework with "your own library of functions", you probably haven't understood, what the point of frameworks is. Have a look at dependency inversion, inversion of control and dependency injection.
  5. Learn about software design. Look at OO principles like SOLID and GRASP.
  6. Try different paradigms. AOP, functional programming. Enhance your OO skills using languages with stronger object orientation, such as Ruby, Objective-C or Smalltalk.
  7. Look at PHP frameworks such as Flow3, Symfony, PHP igniter and CakePHP. I've already pointed out why I think you should do so.
  8. As pointed out in another comment of mine, you should consider other storages than RDBMs. SQL and OOP really don't go well together. Have a look at OODBMS, different database abstraction layers, key-value-stores, document stores such as CouchDB and MongoDB, distributes caching servers as memcache etc.
生生不灭 2024-09-10 20:50:55

以下是一些想法:

  • 尝试不同的事情。学习一门新语言。有时,在学习另一种语言的过程中,实际上会让你在这两方面都变得更好。

  • 为开源项目做出贡献。

  • 高可扩展性和 PHP/MySQL 不是朋友。今天有一些技术就是为此而构建的。例如,node.js 和 Redis。

  • 回答 SO 中的问题。别人的问题可以让你跳出框框思考,你可以改进尝试提供帮助的过程,而且你还可以为别人做一些好事。

  • [如果我想到我刚醒来喝咖啡的其他事情,我会尝试在此处添加:D]

Here are a few thoughts:

  • Try different things. Learn a new language. Some times in the process of learning that other language, actually makes you better on both.

  • Contribute to an open-source project.

  • High scalability and PHP/MySQL are not friends . There are technologies today that are build just for that. node.js and Redis to name a couple.

  • Answer questions in SO. Other people's problems can make you think outside the box and you improve on the process of trying to help, and you also do something nice to someone.

  • [ will try to add here if I think of anything else I just woke up drinking coffee :D ]

夏有森光若流苏 2024-09-10 20:50:55

学习以不同的方式做你已经知道的事情。示例:

  • 以不同语言
  • 通过框架在不同平台上
  • 并行/分布式
  • (是的,您认为它们“不适合您” - 也许尝试不同的语言,它们有时彼此非常不同)

Learn to do what you already know ... in a different way. Examples:

  • in a different language
  • on a different platform
  • in parallel/distributed
  • through a framework (yes, you decided that they "aren't for you" - maybe try a different one, they are sometimes very different from each other)
将军与妓 2024-09-10 20:50:55

也许您应该再次研究框架,我建议您看看 Zend Framework,因为它更像是一个组件库,您可以根据需要使用它,并且不会真正强加您必须遵循的严格结构(例如其他一些框架确实如此),尽管它确实建议了一个(相当理智的恕我直言)项目布局。一个好的起点是在深渊中生存

您还没有提到的事情,知道这些可能会很有用(特别是在较大的项目中):

Maybe you should look into frameworks again, I would suggest having a look at the Zend Framework, because it's more like a library of components you can use as you see fit, and doesn't really impose a rigid structure you have to follow (like some other frameworks do), though it does suggest a (quite sane imho) project layout. A good starting point would be Surviving the deep end.

Things you haven't mentioned yet, and that could prove useful to know (especially in larger projects) :

信愁 2024-09-10 20:50:55

很简单:去做。需求会让你学习。找到一种方法来参与日益先进的项目,无论是商业项目还是开源项目。没有其他方法可以让你真正学到东西。

Simple: do it. Needs will make you learn. Find a way to get involved in increasingly advanced projects, be it commercial or open source. There is no other way you can really learn something.

迷鸟归林 2024-09-10 20:50:55

我会加入讨论区并尝试解决其他人的问题。有时会有相当具有挑战性的问题迫使您进行一些研究。如果你无法回答,你可以等待可以回答的人,然后学习一些东西。

至于框架,向他们学习。我也推出了自己的框架,因为大多数框架都可能相当慢。尽管对于大多数网站来说已经足够快了。

我还建议查看 Facebook 的 PHP 库。他们在那里做了一些有趣的事情。

I would join discussion boards and try to solve other peoples problems. Sometimes there are quite challenging questions that force you to do some research. If you can't answer it, you can wait for someone who can and learn something then.

As for frameworks, learn from them. I roll my own too, since most of the frameworks out there can be rather slow. Although fast enough for most of the websites out there.

I would also recommend looking at Facebook's PHP library. They do some interesting stuff in there.

不忘初心 2024-09-10 20:50:55

你能做的最好的事情就是买一本关于高效算法的书。在每个计算机科学专业的学生的生活中,他/她都有必须学习这些的时候。讨论/解决的问题几乎是您可能遇到的任何现实世界问题的抽象。

除此之外,阅读有关其他人如何做到这一点的博客也非常好,因为它可以帮助您了解如何实际使用(甚至可能实现)高效算法的原理。

问候。

The best you can do is to buy a book on efficient algorithms. In every computer science student's life there comes a time he/she has to study those. The problems that are discussed/solved there are abstractions of almost any real world problem you may ever face.

Besides that reading blogs about how others did it is perfectly fine as it helps you to understand how to practically use (and maybe even implement) the principles of efficient algorithms.

Regards.

花心好男孩 2024-09-10 20:50:55

关于与其他开发人员的合作还不够。我特别认识 3 位开发人员,其中 2 位是我日常工作的开发人员,他们的知识让我惊叹不已。我对我做的每一件事都征求他们的意见,不是因为我重新猜测自己的想法,而是更多的是我想听到其他想法,尤其是来自我作为开发人员尊敬的人的想法。我从这些人身上学到的东西比任何其他方式都多。如果您无法接触其他高级开发人员,那么一定要在 SO 或其他开发论坛上发帖并询问人们的意见,询问人们他们将如何处理特定的项目/问题。通常,您不会学习新技术/方法/功能,除非您看到它们被使用(如果您不知道它存在,您如何知道要寻找什么?)

另外,如前所述,参与操作系统应用程序。去 sourceforge 找到一个需要开发人员的项目。或者下载一个应用程序并尝试为其编写一个插件(我正在为 Invision 3.0 atm 编写一个插件并学习一些东西。)

希望有所帮助。

Not enough can be said about working with other developers. I know 3 developers especially, 2 that I work with on a day to day basis, who blow me away with their knowledge. I ask their opinions on everything I do, not because I second guess my own ideas, but more that I want to hear other ideas, especially from people who I respect as developers. I learn more from these people than any other means. If you have no access to other senior developers, then definitely post on SO or other dev forums and ask peoples opinions, ask people how they would approach a specific project/issue. You wont learn new techniques / methods / functions generally unless you see them being used (how do you know what to look for if you don't know it exists?)

Also, as already stated, take part in an OS app. Go to sourceforge and find a project needing a developer. Or download an app and try to write a plugin for it (I am writing a plugin for Invision 3.0 atm and learning a few things.)

Hope that helps.

没︽人懂的悲伤 2024-09-10 20:50:55

阅读别人的代码。您现在已经有了自己的库,但在阅读其他应用程序的源代码时您可能会得到一些启发。然后问自己‘为什么’。成为博客作者,而不是读者。此外,更多地强调程序员而不是语言。而是查看已经解决问题的解决方案,并尝试用您自己的知识来复制它们。祝你好运,玩得开心!

Read other people's code. You have your own library now, yet you might get some enlightenment when reading the source of other applications. Then ask yourself the 'why's. Be the blog writer, instead of the reader. Also, emphasize more on the programmer than the language. Rather look at solutions that already solve a problem and try to replicate them with your own knowledge. Good luck and have a lot of fun!

稚然 2024-09-10 20:50:55

查看其他程序员代码的方法绝对是学习“好”或“坏”实践的好方法。阅读其他代码后,您会对好代码产生一种“感觉”。

我绝对推荐像 Zend Framework、symfony、CakePHP 或 Agavi 这样的框架,因为很多贡献者都会查看这些代码并不断开发它们以实现“理想”解决方案(当然永远不会达到......);)您仍然可以决定开发自己的类而不是框架提供的类...

拥有如此长的 PHP 背景,您可以考虑为开源框架做出贡献。与其他开发人员的讨论可以让您更快地前进。

向其他人展示您的代码并寻求建设性反馈具有相同的效果。在与他人比较你的技能之前,你永远不知道自己有多优秀。始终以建设性的方式。当为开源框架做出贡献时,这将是一个自然的过程。 ;)

The approach to look at at other programmers code is definitely a good way to learn "good" or "bad" practices. After reading other code you develop a "feeling" for good code.

I definitely recommend Frameworks like Zend Framework, symfony, CakePHP or Agavi because a lot of contributors look at that code and develop them constantly towards the "ideal" solution (which of course will never be reached...) ;) You still can make the decision developing your own classes instead the ones the framework offers...

With such a long PHP background you could consider contributing to an open source framework. Discussions with other developers bring you forward in a faster way.

Showing your code to others and ask for constructive feedback has the same effect. You never know how good you are until you benchmark your skills with others. Always in a constructive manner. This would be a natural process when contributing to an open source framework. ;)

偏爱你一生 2024-09-10 20:50:55

您应该使用示例,在扩展示例时使用它们,这样您将学习如何通过使示例更实用并提供更多功能来扩展示例。

尽管如此,创建您迄今为止在 PHP 中学到的东西还是很好的。要进行更多练习,您应该创建一些诸如预订系统之类的东西。当您学习更多 PHP 时,迟早您将能够通过学习更多内容来扩展更多内容,这将导致您的开发更好。

You should work with examples, work with them when you expand them so you will learn how to expand examples by making them more functional and give out more features.

Although, it is good to create something that you've learned so far in PHP. To practise more, you should create something like, a booking system, etc. Sooner or later you will be able to expand more by learning more when you study more in PHP which will lead your development to be much more better.

随遇而安 2024-09-10 20:50:55

您可以询问您的公司是否可以向您支付 Zend PHP 认证考试费用。学习该考试需要您充分了解 PHP,并通过阅读大量文档、Zend 学习指南以及模拟考试进行培训。这是一种非常有效的改进方式,而且在简历上看起来也很不错。

You could ask your company if they could pay you a Zend PHP certification exam. Studying for this exam would oblige you to know PHP well and to train by reading a lot of the documentation, the Zend study guide, and also by training with mock exams. It's a very efficient way of improving, and it looks quite good on a résumé.

梦萦几度 2024-09-10 20:50:55

“我自己的函数库”==“一个[特殊且可能很糟糕的]框架”。

我建议学习 Symfony 因为开发人员似乎始终努力按照“最佳”实践做所有事情......但是您可能可以从任何流行的框架中学到很多东西。

不要编写自己的框架。请。

"my own library of functions" == "a [idiosyncratic and probably sucky] framework".

I recommend learning Symfony because the developers seem to consistently strive to do everything according to "best" practices ... but you could probably learn a lot from any of the popular frameworks.

Don't write your own framework. Please.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文