lee501 / go-patterns Goto Github PK
View Code? Open in Web Editor NEWGolang 设计模式
Golang 设计模式
你好,我在观察者模式代码里面发现这样一行代码
share.oblist = append(share.oblist[:i], share.oblist[i+1:]...)
当然不止一处是这种写法
这样删除元素,它引用的底层数组还是同一个,如果删除多个的话,len远小于cap,有些浪费空间,不如每次删除的时候重新创建一个slice存放剩下的元素,我看很多项目删除元素都是这样做的
桥接模式是解决由于滥用面向对象语言的继承导致要加入新类型时出现的问题
参考: https://blog.csdn.net/qq_31156277/article/details/80659537
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.