我们一直再做什么?请听我说,让一切回归原来应该的样子!
前言:
来到中梦的2个月时间内,从事了好几个项目的开发工作。php开发工作繁重,我也从一个盲从的初学者到现在可以抽空思考。
正文:
我在学习完php基本的语法以后学习了symfony框架,这个框架很好用,特别是强大的框架工具,路由,以及各种封装好的php方法,使得开发php程序变得相对容易了很多。在我开发第一个程序的时候,作为一个菜鸟我被安排写手机APP的接口。后来随着能力提升,我为一个项目实现APP,WEB,微信的后台。起初我没有发现,但写的过程中却渐渐觉得十分的麻烦,作为一个开发人员都明白这三个后台其实核心的功能都是一样的,区别只是在于如何与前端交互。这就等于你的大多数开发工作是在修改你的代码,重复你之前的工作。这不仅仅对于程序开发人员本身是种折磨,对于整个软件自身也是一件很傻冒的事。
有了问题就要想着去解决,而不是随大流盲从。我仔细的观察我的后台代码结构。一个项目一个包,整个项目有一个底层包,包里面是用于生成数据库的实体类以及其余的工具类。其次就是开发的方式,其实一直以来我们从来都是嘴上在说面向对对象开发,但实际上我们的程序都是直接写SQL语句的面向过程面向功能的开发,何时使用过实体类这东西,更别谈继承,多态以及封装这些高级技巧了。
解决方法是什么呢。想要解决一个问题,需要知道问题的根在什么地方,以上我说的都是表面的现象,实际上的问题,是因为我们自身对于软件本身思考的不够透彻,将底层复用的资源拿到的表面,使得代码的可用域变的很小,从而造成了一系列的麻烦。
既然问题找到了,解决的方法也就简单了,就是让这些给小看的方法回到该回去的位置,将他们封装到底层里面,然后在不同的包里面调用就好了。
本文永久地址:http://blog.it985.com/15440.html
本文出自IT985博客 ,转载时请注明出处及相应链接。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

The Storage::download method of the Laravel framework provides a concise API for safely handling file downloads while managing abstractions of file storage. Here is an example of using Storage::download() in the example controller:

Laravel simplifies HTTP verb handling in incoming requests, streamlining diverse operation management within your applications. The method() and isMethod() methods efficiently identify and validate request types. This feature is crucial for building
