#純靠北工程師569
----------
https://www.ptt.cc/bbs/Gossiping/M.1627464133.A.533.html
有道理欸
我上班都是在爬stackoverflow 還有各種教學文章
很少真的在寫code
484薪水小偷
----------
💖 純靠北官方 Discord 歡迎在這找到你的同溫層!
👉 https://discord.gg/tPhnrs2
----------
💖 全平台留言、文章詳細內容
👉 https://init.engineer/cards/show/6705
同時也有1部Youtube影片,追蹤數超過2萬的網紅Untyped 對啊我是工程師,也在其Youtube影片中提到,10個工程師的愛恨情仇-2020全球資訊工程調查看一看 Stack Overflow ft. Wei Chen | 10 Preferences of Software Engineers - 誰說工程師沒有情感?這次就來揭露工程師們的各種愛恨情仇。 同樣是工程師,但是人人各有所好。這次邀請到工程...
stackoverflow教學 在 Taipei Ethereum Meetup Facebook 的最讚貼文
📜 [專欄新文章] Solidity Weekly #12
✍️ mingderwang
📥 歡迎投稿: https://medium.com/taipei-ethereum-meetup #徵技術分享文 #使用心得 #教學文 #medium
functions 什麼時候用 external、private、或 internal
function 跟 (storage) state 全區域合約變數預設不同,變數宣告只有在 public 才會對外開放,讓別人看得到值;而 function 剛好相反,預設是 public。也就是說你沒刻意去宣告,它是可以被外面的程式或合約呼叫。
但如果你刻意用 external、private、或 internal 來宣告 function 的被 call 的屬性,能對最佳化得到一些好處。而 public 與 external 都會讓 function 公開;相反的 internal 與 private 的 functions 只能被合約內部叫用。
限制多寡的順序是︰ public < external < internal < private。
公開 use cases︰
比如說,如果你確定不對內公開,最好宣告為 external。external 有個好處是 call 的參數是從 CALLDATA 獲得,不需要 copy 到 memory 才能執行該 function call。所以比較省 gas,尤其是處理參數是 array 時更凸顯其效果。
但用 external,自己合約如果要調用,反而要寫 this.f() 編譯器才能接受,通常是多此一舉。而且會呼叫 CALL 指令,跟 JUMP 指令比,花更多 gas。
不公開 use cases︰
當合約自己內部的 functions 不想被外部合約或程式調用,最好是用 internal 或甚至用 private 來做限制。internal 還可以被繼承的合約來調用,而 private 就只能自己合約內使用。
它們會被用 JUMP 指令來呼叫,比較省 gas。
我們用 StackOverflow 的範例來做測試,改寫成 Test.sol 如下;
// Test.sol pragma solidity^0.4.12;
contract Test {
// spend 662 gasfunction test(uint[20] a) public pure returns (uint) { return a[10] * 2; }
// spend 317 gasfunction test2(uint[20] a) external pure returns (uint) { return a[10] * 2; }
function test3(uint[20] a) internal pure returns (uint) { return a[10] * 2; } function test4(uint[20] a) private pure returns (uint) { return a[10] * 2; }}
測試程式 (DoTest.sol) 如下︰
// DoTest.solpragma solidity ^0.4.18;
import "./Test.sol";
contract DoTest is Test {uint[20] a;uint public xx;
constructor() public { a[10]=3; } function test_1() external returns(uint) { xx = test(a); return xx; } function test_2() external returns(uint) { xx = this.test2(a); // <-- use this. return xx; } function test_3() external returns(uint) { xx = test3(a); return xx; } function test_4() external returns(uint) { xx = test4(a); // <-- compile error return xx; }}
如果你用 remix 測試,會發現 DoTest 測試繼承 Test 來的不同宣告方式的 functions,會有不同的效果。且 test3() 跟 test4() 對外是看不到的。
links 分享;
Learn X in Y minutes, where X = Solidity Ming> 雖然所用的 solidity 版本 ^0.4.19 還有點舊,但註解做得很好,值得初學者參考。
Ethernaut Lvl 12 Privacy Walkthrough: How Ethereum optimizes storage to save space and be less gassy — (Nicole Zhu) Ming > Coinmonks 的 Medium 裡還有其他很多非常精彩的文章,請自己來尋寶。
The Ethernaut by Zeppelin Ming> 一個 web3/solidity 闖關遊戲平台。
Solidity Weekly #12 was originally published in Taipei Ethereum Meetup on Medium, where people are continuing the conversation by highlighting and responding to this story.
👏 歡迎轉載分享鼓掌
stackoverflow教學 在 Untyped 對啊我是工程師 Youtube 的最佳貼文
10個工程師的愛恨情仇-2020全球資訊工程調查看一看 Stack Overflow ft. Wei Chen | 10 Preferences of Software Engineers
-
誰說工程師沒有情感?這次就來揭露工程師們的各種愛恨情仇。
同樣是工程師,但是人人各有所好。這次邀請到工程師Wei Chen 一起回答10個survey中的問題,並根據 Stack Overflow 在2020年對於2019年的資訊工程調查結果,做討論與分享我們的看法。
1. 最受歡迎/熱門/常用的程式語言 The Most Popular Programming Language 0:35
2. 最喜歡的程式語言 The Most Loved Programming Language 1:48
3. 最討厭的程式語言 The Most Dreaded Programming Language 3:30
4. 最想學/嘗試的程式語言 The Most Wanted Programming Language 4:51
5. 最有錢途的程式語言 The Highest Paid Programming Language 5:51
6. 最有錢途的資訊工程相關職位 The Highest Paid Developer Type 6:50
7. 女性工程師參與度 The Percentage of Female Survey Respondents 8:28
8. 最看重的工作條件或要素 The Most Important Job Factor 9:37
9. 面對面 或 線上交談?IRL or Online Chat? 10:55
10. 鳳梨披薩?Pineapple on Pizza? 12:07
好奇「Untyped 對啊我是工程師」是如何誕生的嗎?
來聽聽學吧少女的訪談 👉https://youtu.be/bZXGuZoYDWA
#工程師都愛StackOverflow #今年女工程師會更多 #鳳梨披薩萬歲
一定要看到影片最後面並且在「YouTube影片下方」按讚留言訂閱分享唷!
-
歡迎留言告訴我你的想法,或是你想認識的程式語言唷!
每(隔週)週六晚上9點更新,請記得開啟YouTube🔔通知!
-
【相關連結】
2019 資訊工程調查 Stack Overflow Developer Survey: [https://insights.stackoverflow.com/survey/2019]
【What I used to make this video】
個人電腦:Apple MacBook Pro [https://amzn.to/2HKgI2T]
拍攝錄音錄影: iPhone X [https://amzn.to/3c0s6Fu]
相機: Canon 80D [https://amzn.to/2VVmiYz]
錄音: Rode [https://amzn.to/3aqnzL2]
鍵盤: Logitech MX Keys Wireless Keyboard [https://amzn.to/3awqi5L]
【愛屋及烏】
Facebook 臉書粉專 👉 [https://www.facebook.com/untyped/]
Instagram 👉 [[https://www.instagram.com/untypedcoding/]
合作邀約 👉 untypedcoding@gmail.com
-
Untyped 對啊我是工程師 - There are so many data types in the world of computer science, so are the people who write the code. We aim to UNTYPE the stereotype of engineers and of how coding is only for a certain type of people.
凱心琳: 一個喜歡電腦科學邏輯推理,在科技圈努力為性別平等奮鬥的女工程師。
-
This video contains affiliate links, which means that if you click on one of the product links, I'll receive a small commission.
圖片影片音效:[giphy.com] [pngwave.com][freesound.org]
Walk Around by Roa https://soundcloud.com/roa_music1031
Creative Commons — Attribution 3.0 Unported — CC BY 3.0
stackoverflow教學 在 [問卦] 有沒有stackoverflow的八卦? - 看板Gossiping - 批踢踢 ... 的美食出口停車場