Download presentation
Presentation is loading. Please wait.
Published byDarrell Webster Modified over 9 years ago
1
Software Sustainability Institute www.software.ac.uk What makes “good code” good for science? 26 th September 2013, MozFest 2013, London Neil Chue Hong (@npch), Software Sustainability Institute ORCID: 0000-0002-8876-7606 | N.ChueHong@software.ac.uk doi:10.6084/m9.figshare.832498 Where indicated slides licensed under Supported by Project funding bit.ly/whatmakesgoodcodegood
2
Software Sustainability Institute www.software.ac.uk Software is pervasive in science today
3
Software Sustainability Institute www.software.ac.uk How this works: - group - brainstorm, prioritise - share, compare Let’s get warmed up! - Arrange yourself in the space based on where you’re based bit.ly/whatmakesgoodcodegood
4
Software Sustainability Institute www.software.ac.uk What makes “good code” good? - What do you look for? - What’s good for science? - Code can include scripts bit.ly/whatmakesgoodcodegood
5
Software Sustainability Institute www.software.ac.uk What makes “good code” good? - Top hit - Software Engineers - Researchers - Research SW Engineers
6
Software Sustainability Institute www.software.ac.uk Opinion: Paul DiLascia Simple – concise but not cryptic Readable – commented, sensible names, follows conventions Modular – reusable building blocks Layered – application/OS, model/view/controller, … Designed – “thoughts are cheaper than debugging”, if you can’t explain it easily it’s designed poorly Efficient – fast, compact, takes only what’s needed + frees it when done Elegant – simple + efficient + brilliant Clear – all of the above are an antidote to complexity Clever hacks – because the world is not perfect What makes good code good, Paul DiLascia, MSDN Magazine, 07/2004, p144 http://msdn.microsoft.com/en-us/magazine/cc163962.aspx
7
Software Sustainability Institute www.software.ac.uk Opinion: Christopher Diggins Reflects the problem it solves Can be easily understood by programmers without experience in your language Generally short Doesn’t require much thinking to understand Very little coupling Cohesive - definitions of functions + types required are not scattered throughout the software Documents any requirements for proper usage Makes just as much sense to you one year from now, as it does now Christopher Diggins, The Properties of Good Code, 27/09/2005, http://www.oreillynet.com/onlamp/blog/2005/09/the_properties_of_good_code.html
8
Software Sustainability Institute www.software.ac.uk Opinion: Bittermanandy Correct – does what it’s intended to do Readable – remember WORM (Write Once Read Many) Testable – “if it’s not tested it’s broken” Documented – not what/how but why/because Robust and reliable Maintainable – by you and others six months from now Extensible, flexible + reusable Efficient, performant + scalable Secure Discoverable – others can understand quickly + easily Simple – modular Bittermanandy, What is good code?, 10/09/2010 http://bittermanandy.wordpress.com/2010/09/10/what-is-good-code/
9
Software Sustainability Institute www.software.ac.uk Opinion: Researchers from the North-East Fit for purpose Readable, well-commented and documented, with design rationale Elegant, concise but not needlessly cryptic Well-designed and modular Tests for correctness and ships tests with code Optimised but not at expense of understandibility Scalable Usable Portable 31 “scientists who do some programming”, Effective scientific programming workshop, 20/06/2011 http://www.software.ac.uk/blog/2011-06-22-what-makes-good-code-good
10
Software Sustainability Institute www.software.ac.uk Opinion: Researchers from ecology Readable Well-designed Correct Robust Efficient Flexible Documented Use open technologies, languages, dependencies Referenceable Under revision control Available Usable Benchmarked 100 ecologists at INTECOL13, 21/08/2013 http://www.software.ac.uk/blog/2013-08-23-what-makes-good-code-good-intecol13
11
Software Sustainability Institute www.software.ac.uk Opinion: Researchers in digital social research Correct Well-designed Readable Appropriate Robust Efficient Available Usable Copyrighted and licenced Under revision control Research programmers and software developers, Digital Social Research workshop, 12/12/2011 http://www.software.ac.uk/blog/2011-12-16-what-makes-good-code-good-digital-social-research-view
12
Software Sustainability Institute www.software.ac.uk Opinion: Researcher-developers at Dev8D Documented and well-commented – also clear how to run and use Readable – meaningful naming and consistent style Optimised Clear, well-designed, concise and modular – no “code smells” Tested – and testable via a test suite Reuses and recycles Clear copyright and licence No commented-out code Peer reviewed Usable and doesn’t silently or cryptically fail Works 10 researcher-developers and software developers, Dev8D, 15/02/2012 http://www.software.ac.uk/blog/2011-12-16-what-makes-good-code-good-digital-social-research-view
13
Software Sustainability Institute www.software.ac.uk What are the blockers to “good code”? - What stops you? bit.ly/whatmakesgoodcodegood
14
Software Sustainability Institute www.software.ac.uk Researchers: Blockers Writing code for me Lack of time Lack of reward Lack of training No local experts How to couple models, papers, code and documentation Lack of awareness of what already exists Tools that almost do the job
15
Software Sustainability Institute www.software.ac.uk Opinion: Blockers Quick code Laziness or lack of interest Inherited code Time and money Different priorities across collaborators Lack of expertise Medium-sized projects – too much code, not enough resources
16
Software Sustainability Institute www.software.ac.uk What are the solutions to these blockers? - Does everyone know what X is? - Are there dependencies between blockers? bit.ly/whatmakesgoodcodegood
17
Software Sustainability Institute www.software.ac.uk Opinion: Solutions Change practices – value code and data as research outputs in the REF Funding for developing high-quality, maintainable code Incentives to retain staff with experience of good coding Publicise good software development practices Infrastructure+ Discipline and punish – coffee and chocolate
18
Software Sustainability Institute www.software.ac.uk One thing you’ve learned that you’d share with others - That’s not been mentioned by someone else! bit.ly/whatmakesgoodcodegood
19
Software Sustainability Institute www.software.ac.uk What next? - tweet new ideas @SoftwareSaved - run your own session and blog it! - get these slides: bit.ly/whatmakesgoodcodegood doi:10.6084/m9.figshare.832498 Thank you! XKCD, 844 http://xkcd.com/844/ Licensed under CC-BY-NC
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.