Implementation of Website for Cognitive Behavioural Therapy Using the Development Framework Symfony
Total Page:16
File Type:pdf, Size:1020Kb
Institutionen för datavetenskap Department of Computer and Information Science Final thesis Implementation of website for cognitive behavioural therapy using the development framework Symfony by Peter Andersson LIU-IDA/LITH-EX-G--10/008--SE 2010-03-22 Linköpings universitet Linköpings universitet SE-581 83 Linköping, Sweden 581 83 Linköping Linköping University Department of Computer and Information Science Final Thesis Implementation of website for cognitive behavioural therapy using the development framework Symfony by Peter Andersson LIU-IDA/LITH-EX-G--10/008--SE 2010-03-22 Supervisor: Anders Fröberg Examiner: Erik Berglund På svenska Detta dokument hålls tillgängligt på Internet – eller dess framtida ersättare – under en längre tid från publiceringsdatum under förutsättning att inga extra-ordinära omständigheter uppstår. Tillgång till dokumentet innebär tillstånd för var och en att läsa, ladda ner, skriva ut enstaka kopior för enskilt bruk och att använda det oförändrat för ickekommersiell forskning och för undervisning. Överföring av upphovsrätten vid en senare tidpunkt kan inte upphäva detta tillstånd. All annan användning av dokumentet kräver upphovsmannens medgivande. För att garantera äktheten, säkerheten och tillgängligheten finns det lösningar av teknisk och administrativ art. Upphovsmannens ideella rätt innefattar rätt att bli nämnd som upphovsman i den omfattning som god sed kräver vid användning av dokumentet på ovan beskrivna sätt samt skydd mot att dokumentet ändras eller presenteras i sådan form eller i sådant sammanhang som är kränkande för upphovsmannens litterära eller konstnärliga anseende eller egenart. För ytterligare information om Linköping University Electronic Press se förlagets hemsida http://www.ep.liu.se/ In English The publishers will keep this document online on the Internet - or its possible replacement - for a considerable time from the date of publication barring exceptional circumstances. The online availability of the document implies a permanent permission for anyone to read, to download, to print out single copies for your own use and to use it unchanged for any non- commercial research and educational purpose. Subsequent transfers of copyright cannot revoke this permission. All other uses of the document are conditional on the consent of the copyright owner. The publisher has taken technical and administrative measures to assure authenticity, security and accessibility. According to intellectual property law the author has the right to be mentioned when his/her work is accessed as described above and to be protected against infringement. For additional information about the Linköping University Electronic Press and its procedures for publication and for assurance of document integrity, please refer to its WWW home page: http://www.ep.liu.se/ © Peter Andersson Abstract This report follows the process of developing a website for cognitive behavioural therapy using the web development framework Symfony. The purpose was to find out if it is appropriate to use Symfony to ease development and maintenance of a website for therapy. For this to be true the framework had to be able to help create a website that was secure, user-friendly and easy to maintain. The website was developed using several features of the framework including database abstraction, automatic code generation and URL-rewriting. A plugin was used to enhance the security by adding a complete solution for user authentication. The website was tested by using built-in test functionality of the framework that could run test on functions or emulating a browser visiting the website. During the development the framework was tested and evaluated. The worst drawback turned out to be Symfonys steep learning curve, its security solution that only worked if the website was installed correctly and its slow loading time. Except those faults the framework performed well and was easy to use ones the initial learning time was over. Contents 1 Introduction ....................................................................................................................................1 1.1 Thesis question ........................................................................................................................1 1.2 Limitations ...............................................................................................................................2 1.3 Methods and Sources ...............................................................................................................2 1.4 Audience ..................................................................................................................................2 1.5 Report structure .......................................................................................................................3 2 Analysis ...........................................................................................................................................5 2.1 Design goals .............................................................................................................................5 2.2 Treatment programs ................................................................................................................6 2.3 Forum ......................................................................................................................................6 2.4 Additional parts ........................................................................................................................7 3 Implementing with Symfony............................................................................................................9 3.1 Architecture .............................................................................................................................9 3.2 Object Relational Mapping ..................................................................................................... 11 3.3 Database generation .............................................................................................................. 13 3.4 Forms and input validation ..................................................................................................... 14 3.5 URL Routing............................................................................................................................ 15 3.6 Pagination .............................................................................................................................. 17 3.7 Administration interface ......................................................................................................... 18 3.8 Internationalization ................................................................................................................ 18 3.9 Security .................................................................................................................................. 19 4 Result: Implementation and testing............................................................................................... 21 4.1 Evolutionary prototyping ........................................................................................................ 21 4.2 Database design ..................................................................................................................... 21 4.2.1 User authentication ......................................................................................................... 21 4.2.2 Treatment programs ........................................................................................................ 22 4.2.3 Forum .............................................................................................................................. 23 4.3 Database implementation ...................................................................................................... 24 4.4 Treatment programs .............................................................................................................. 25 4.5 Forum and articles .................................................................................................................. 26 4.6 Administration interface ......................................................................................................... 28 4.7 Security .................................................................................................................................. 29 4.8 Testing ................................................................................................................................... 30 4.8.1 Compatibility ................................................................................................................... 30 4.8.2 Unit test .......................................................................................................................... 31 4.8.3 Functional test ................................................................................................................. 32 4.9 Final thoughts on Symfony ..................................................................................................... 33 5 Discussion ..................................................................................................................................... 35 5.1 Using frameworks for web development ................................................................................ 35 5.2 Choice of platform .................................................................................................................