Ssd Unit 9

5 minute read

Published:

Unit 9

Learning Outcomes Achieved

  1. Design, develop and adapt programs and to produce a solution that meets the design brief and critically evaluate solutions that are produced

Formative Activity

Question 1

I first had to install flask and flask-restful by using this command: pip3 install flask flask-restful. pip3 is the package manager for Python 3, and handles the management of third-party dependencies (Python Software Foundation, 2021). To start the web application after the required dependencies were installed, I ran the command python3 api.py.

Question 2

I first had to install w3m first by using the command sudo apt install w3m. apt is the package manager for the operating system itself (Canonical, 2019).

Running w3m http://127.0.0.1:5000/user/Ann displays a screen that shows “404 Not Found”. w3m is a text-based web browser, and the 404 appears due to a bug in the code. The expected result is that the details of the user Ann should appear as output, because a user Ann exists in the users list. However, the application reports that this user was not found. In order to get the details of the user Ann, the following line:

api.add_resource(User, "/user/")

Must be changed to

api.add_resource(User, "/user/<name>")

If this change isn’t made, the Flask application won’t know how to resolve an URL in the form “/user/name” because the only resource registered to it (“/user”), takes no parameters and therefore it cannot determine what to do with an URL that contains a parameter (i.e. “/user/name”, where name is the parameter). This is why “Ann” is not found even though there is a matching name in the python source file.

Once the change is made, however, running w3m http://127.0.0.1:5000/user/Ann will prompt the user to download a file (and set its name). By displaying the contents of the file using the cat command, the following will appear as output, which is the expected result:

{
    "name": "Ann", 
    "age": 32, 
    "occupation": "Doctor"
}

Question 3

Running w3m http://127.0.0.1:5000/user/Adam will produce a 404 even if the code is fixed, and the reason for this is that the users object in api.py does not contain a user (i.e. dict object) with a name of Adam.

Question 4

The flask library makes it possible to create web applications (Pallets, 2010). Web applications created by Flask typically support behaviors that conform to the Python Web Server Gateway Interface standard discussed in PEP 3333 (Python Software Foundation, 2021). Having previously built REST APIs using Flask only, one disadvantage I have discovered is that it requires a fair amount of boilerplate code, which is arguably less readable.

Architecture Evolution

Although the microservice architecture provides more benefits than other architectures, its growth is hindered by its infancy- various challenges exist with the approach, which newer technologies have attempted to resolve. Bogner et al. (2019) found that a common challenge encountered with microservices is a lack of a system-centric view, along with “service cutting”- that is, decomposing a complex service into smaller microservices. Jamshidi et al. (2018) agreed with this finding, however, Ghofrani & Lubke (2018) found that security and performance were more pressing issues for the microservice architecture.

Jamshidi et al. (2018) argue that a critical issue in microservice research is the scarcity of production-ready systems that researchers can experiment with. Microservices are used to power large-scale, industrial applications with vast amounts of technical infrastructure, from libraries to tools, and systems of this caliber must be made available for researchers, in order to better understand their limitations. Research would therefore be slower without assistance from industry.

Despite this, new approaches to these problems are in development. Hanousse & Yahiouche (2021) propose an ontology for understanding microservice security, which identifies the following areas as crucial for security: infrastructure, data, software, and users. Bauer et al. (2018), suggest the use of serverless design (a rapidly growing technology) to address performance concerns. Lastly, Fritzsch et al. (2018) proposed a strategy for cutting services based on performance, while using additional service data to further aid in the decomposition process.

Peer Responses

This week, students were requested to provide feedback on peer posts regarding the safety of TrueCrypt.

Link to Feedback Given Link to Feedback Given

References

Bauer, David & Penz, Benjamin & Mäkiö, Juho & Assaad, Manal. (2018). Improvement of an Existing Microservices Architecture for an E-learning Platform in STEM Education.

Bogner, J., Fritzsch, J., Wagner, S. & Zimmermann, A. (2019) ‘Assuring the Evolvability of Microservices: Insights into Industry Practices and Challenges’, 2019 IEEE International Conference on Software Maintenance and Evolution (ICSME). Cleveland, Ohio, 30 September - 4 October. New Jersey: IEEE. 546-556.

Canonical. (2019) Ubuntu Manpage: apt - command-line interface. Available from https://manpages.ubuntu.com/manpages/xenial/man8/apt.8.html [Accessed 24 August 2021].

Ghofrani, J. & Lübke, D. (2018) Challenges of Microservices Architecture: A Survey on the State of the Practice. Available from: https://www.researchgate.net/publication/328216639_Challenges_of_Microservices_Architecture_A_Survey_on_the_State_of_the_Practice [Accessed 1 November 2021].

Hannousse, A. & Yahiouche, S. (2021) Securing microservices and microservice architectures: A systematic mapping study. Computer Science Review 41. DOI: https://doi.org/10.1016/j.cosrev.2021.100415

Fritzsch J., Bogner J., Zimmermann A. & Wagner S. (2019) From Monolith to Microservices: A Classification of Refactoring Approaches. Available from: https://arxiv.org/abs/1807.10059 [Accessed 1 November 2021].

Jamshidi, P., Pahl, C., Mendonça, N., Lewis, J. & Tilkov, S. (2018) Microservices: The Journey So Far and Challenges Ahead. IEEE Software 35(3): 24-35. DOI: https://doi.org/10.1109/MS.2018.2141039

Pallets. (2010) Welcome to Flask - Flask Documentation (2.0.x). Available from: https://flask.palletsprojects.com/en/2.0.x/ [Accessed 24 August 2021].

Python Software Foundation. (2021) PEP 3333 – Python Web Server Gateway Interface v1.0.1. Available from: https://www.python.org/dev/peps/pep-3333/ [Accessed 24 August 2021].

Python Software Foundation. (2021) pip - PyPI. Available from: https://pypi.org/project/pip/#description [Accessed 24 August 2021].