php 桌面应用程序

tech2022-09-07  105

php 桌面应用程序

Chances are you’ve come across some horrible legacy code once or twice in your lifetime as a PHP developer. Heck, if you’ve worked with WordPress to any degree, I’m sure you have. I myself have had the satisfying task of modernizing a monolithic ZF1 application, and it was the most mentally exhaustive (but, admittedly, the most educational) year of my career.

作为PHP开发人员,您一生中可能遇到过一两次可怕的旧代码。 哎呀,如果您曾经与WordPress合作过,我相信您一定有。 我本人已经完成了使整体ZF1应用程序现代化的令人满意的任务,并且这是我职业生涯中精神上最累赘(但最好是教育程度最高)的一年。

If only I had had Paul M. Jones’ “Modernizing Legacy Applications In PHP” book back then, I would have been done in half the time, and the work I did would have been twice as good.

如果那时我只有Paul M. Jones的“用PHP改进遗留应用程序”一书,那我将完成一半的时间,而我所做的工作将是以前的两倍。

这本书 (The Book)

Many thanks to Paul for providing me with a review copy after having read my review of Design Patterns in PHP. The book is a Leanpub publication – meaning it’s self-published – but that’s where similarities with other Leanpub content I’ve consumed so far end.

非常感谢Paul在阅读了我对PHP中的Design Patterns的评论后为我提供了评论副本。 这本书是Leanpub的出版物,这意味着它是自出版的,但是那是我到目前为止所消费的其他Leanpub内容的相似之处。

Modernizing Legacy Applications in PHP is a detailed step by step guide in turning a spaghetti mess of old PHP code you’ve probably inherited from a team that left two generations ago, into a sort of fully fledged MVC application with the front controller, router, dependency injection, and even unit tests.

将PHP中的旧版应用程序现代化是一步一步的详细指南,它可以将您可能已经继承了两代人的团队继承下来的一小堆旧PHP代码变成具有前端控制器,路由器,依赖注入,甚至单元测试。

Rather than regurgitating common examples found online and various Wikipedia definitions in shortened form, the book takes a hands on approach with sample code eerily similar to things I’ve seen over and over again in legacy projects. This not only verifies a senior developer’s suspicions about the similar state of decrepitude in most legacy apps, but also inspires one to delve deeper as it seems most of us share the same problems at some time and, thus, can use the same solutions.

本书并没有反省网上找到的常见示例和简短形式的各种Wikipedia定义,而是亲身实践了示例代码,该示例代码与我在遗留项目中一遍又一遍地看到的内容非常相似。 这不仅验证了高级开发人员对大多数旧版应用程序中类似的衰落状态的怀疑,而且还激发了人们进行更深入的研究,因为我们大多数人似乎有时都遇到相同的问题,因此可以使用相同的解决方案。

可接近 (Approachability)

This book is not for beginners. I mean, if you’re a beginner, I recommend getting it right away and just keeping it in your Leanpub dashboard for when you’ll be able to implicitly recognize the terms discussed within; but if you don’t have a horrible large-scale legacy project or two under your belt before you start reading it, you won’t understand much and ploughing through the content on auto-pilot without knowing what it does is counterproductive at best. Besides, you’ll probably do it wrong because every legacy app is different, despite most of them being similar.

这本书不适合初学者。 我的意思是,如果您是初学者,建议立即使用它,并将其保存在Leanpub仪表板中,以便您可以隐含地识别其中讨论的术语。 但是,如果您在开始阅读之前没有可怕的大规模旧项目,或者不了解,那么您将不会了解很多内容,并且在不了解自动驾驶内容充其量的情况下浏览自动驾驶内容。 此外,您可能会做错事,因为每个旧版应用程序都是不同的,尽管其中大多数都是相似的。

This book is aimed at intermediate and higher level PHP users, with an emphasis on seniors. Intermediate devs won’t get 100% out of it. They’ll understand more of the content, and they’ll be able to use some of it as a prevention against future horrors while working on their apps right now (which, again, is reason enough to recommend a purchase), but intermediate devs are generally still getting familiar with best practices and haven’t been out of the procedural marshes for very long, the mud and sludge still dripping from their “I finally know PHP” shirts.

本书面向中级和高级PHP用户,重点是老年人。 中级开发人员将无法获得100%的收益。 他们会了解更多的内容,他们将能够使用它的一些作为对未来的恐怖预防对他们的应用程序的工作,现在 (再次,是有足够的理由推荐购买)一段时间,但中间的开发者通常,他们仍然对最佳实践很熟悉,并且没有离开程序沼泽很久了,泥泞和淤泥仍然从他们的“我终于知道PHP”衬衫中滴下来。

The book, however, really shines as a guidebook for professional and higher devs. As someone intimately familiar with all the aspects discussed within, I could approach each chapter as a challenge. Every chapter is named after what we’ll be doing in it – a single phrase summary – which allowed me to imagine the approach I would take in doing it, and then compare it with the solution presented within. Every chapter makes use of modern practices and terms only people with decent amounts of PHP experience are intimately familiar with (unfortunately – let’s work on that!) like IoC, DI, custom FrontController, Routing, URL Rewrites and the still too neglected Unit Testing, and only a seasoned developer will be able to implicitly understand why an approach is needed in a given scenario without questioning the “why”, instead focusing immediately on “how best to”.

但是,这本书确实可以作为专业人士和高级开发者的指南。 作为一个非常熟悉其中讨论的所有方面的人,我可以将每一章当作挑战。 每章均以我们将要进行的工作命名-一个短语摘要-使我能够想象自己将采用的方法,然后将其与其中提供的解决方案进行比较。 每章都利用现代实践和术语,只有具有相当丰富PHP经验的人才与IoC,DI,自定义FrontController,路由,URL重写以及仍然被忽视的单元测试非常熟悉(不幸的是, 让我们继续努力 !)。并且只有经验丰富的开发人员才能隐含地理解为什么在给定场景中需要一种方法而无需质疑“为什么”,而是立即关注“如何做到最好”。

技术方面 (Technical Aspect)

On a technical level, the book is sound – amazingly so. Each chapter follows a specific step in the modernization process and presents “before” and “after” code. What’s more, the code looks real – it’s not just another “Acme” controller, just another Foo/Bar you’ve seen everywhere.

从技术上讲,这本书听起来不错–令人惊讶。 每章都遵循现代化过程中的特定步骤,并介绍了“之前”和“之后”代码。 更重要的是,这些代码看起来很真实–它不仅是另一个“ Acme”控制器,还是到处可见的另一个Foo / Bar。

This looks like it was taken out of a real project which makes it instantly relatable to developers who find themselves in the problems this book solves.

看起来它是从一个真实的项目中提取出来的,这使它立即与发现本书所解决的问题的开发人员相关。

The book is also accompanied by online materials in form of open source classes that get plugged into the modernization process at one time or another and help with bootstrapping some solutions.

本书还附带了开源类形式的在线资料,这些资料一次或一次被插入到现代化过程中,并有助于引导一些解决方案。

优点 (The Pros)

Apart from what I’ve already listed in previous paragraphs, the author paid much attention to detail, at various places including relevant links to terminology and concepts that might be unfamiliar to the reader. The book is well written, with sentences concise and clear and is a fluent read (except in some cases – see below).

除了我在前面的段落中已经列出的内容以外,作者还非常关注细节,在各个地方,包括与读者可能不熟悉的术语和概念相关的链接。 这本书写得很好,句子简洁明了,阅读流畅(在某些情况下除外,请参见下文)。

The typos were minimal, and it’s here that I must stress the importance of editing. Leanpub authors, you are not your own worst critic and you are not fit to be your own editor. On that note, neither are your friends, relatives, and so on. If you’re writing a book, you need someone who is either objective or professional enough (preferably both) to give you good, proper feedback (positive or negative), and one who can follow your progress from chapter to chapter. Finding out the book sucks when you’ve already written it helps no one – you can’t rewrite it easily, you can’t change its flow, and generally, you wasted a good opportunity.

打字错误很少,在这里我必须强调编辑的重要性。 Leanpub作者, 您不是您自己最糟糕的批评家 , 也不适合成为您自己的编辑 。 因此,您的朋友,亲戚等都不是。 如果您正在写书,则需要一个既客观又专业的人(最好同时兼顾两者)为您提供良好,适当的反馈(积极或消极),并能逐章跟踪您的进度。 当您已经写完这本书时发现它很烂,这对任何人都没有帮助–您无法轻易地重写它,无法改变它的流程,并且通常来说,您浪费了一个很好的机会。

Paul’s book has been well edited by various parties on various aspects, and it shows. Next to no errors, perfect formatting, best practices, good explanations and excellent examples are what set this book above the typical Leanpub product. Additionally, despite being the lead on the AuraPHP project, Paul made absolutely no effort to get the reader to convert to it, or to use its components in the modernization process. This, along with the other upsides, shows that the book is meant to be a long term quality resource rather than self-promotion.

保罗的书在各个方面都得到了各方面的很好的编辑,它表明了这一点。 几乎没有错误,完美的格式,最佳实践,良好的解释和出色的例子使本书超越了典型的Leanpub产品。 另外,尽管是AuraPHP项目的负责人,Paul绝对没有做出任何努力让读者转换为它,或在现代化过程中使用它的组件。 这以及其他优点表明,这本书是长期的优质资源,而不是自我宣传。

缺点 (The Cons)

The only downside I could find was that some chapters referenced appendices with code instead of discussing and improving the code inline, which sometimes broke the reading fluency, causing awkward back-and-forth jumps between content – something e-readers and PDF readers have yet to nail down perfectly. If I were to improve anything in a second release, it would be to make sure all chapters follow the approach of the first and last few – embedded code, and no Appendix jumps (though Appendices should still be kept as is, for future reference). This would lengthen the book somewhat, but would allow for a smoother reading experience.

我能发现的唯一缺点是,有些章节使用代码引用了附录,而不是讨论和改进内联代码,这有时会破坏阅读的流畅度,导致内容之间来回的尴尬跳跃-电子阅读器和PDF阅读器尚未使用完美地钉住。 如果我要在第二个发行版中进行任何改进,那就是要确保所有章节都遵循前几节和最后几节的方法(嵌入式代码),并且没有附录跳转(尽管附录仍应保持原样,以备将来参考) 。 这样可以使书更长一些,但可以使阅读体验更流畅。

结论 (Conclusion)

In conclusion – go buy this book now.

结论– 现在就去买这本书 。

Really, on a scale of 5 elephpants I can easily give it a 4.5 (the half an elephpant off just for the “con” I listed above). It’s the perfect guidebook to legacy modernization and I can see myself coming back to it in the future as I meet the coming horrors of old apps.

的确,在5种elephpant的范围内,我可以轻松地给它4.5(只为上面列出的“ con”提供一半的elephpant)。 这是遗产现代化的完美指南,当我遇到即将到来的旧应用程序带来的恐惧时,我可以看到自己会在将来重回旧版本。

The book is available on Leanpub, and Paul was kind enough to offer a 10% discount coupon for SitePoint readers. To use it, just hit this link.

该书可在Leanpub上找到,Paul十分友善地为SitePoint读者提供了10%的折扣券。 要使用它,只需点击此链接 。

翻译自: https://www.sitepoint.com/modernizing-legacy-applications-php-review/

php 桌面应用程序

相关资源:jdk-8u281-windows-x64.exe
最新回复(0)