Answering Your Most Frequently Asked Python Questions // Q&A 07-2021

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey everyone today i'm doing a q a video where i'm gonna answer your questions you posted quite a few really interesting ones so let's dive straight in if you're new here you want to become a better software developer gain a deeper understanding of programming in general start now with subscribing and hitting the bell so you don't miss anything so i've made a selection of the questions you sent me as a reply to the community post a couple of weeks ago now i will only choose to answer the easy questions obviously just kidding actually it's kind of true uh because the more complicated questions actually require me to develop a real example and i'll probably do a complete video about that instead i think that makes more sense so let's dive straight in with first question by gabriel how do you plan on creating a new application and what tools and methodologies help you in the process so if you look at the development process in general of course in the last decades there's been a lot of progress in how we do those things we went from a really rigid waterfall process to more agile processes like scrum so in my case my main experience comes from the start of the world and that means that you start really small we don't have large teams of developers that you can just spend a lot of money on to develop a product and you have to basically start with zero resources and just make things happen and that's an extra challenge but it also means that you have to really really simplify things and make sure that everything that you're building you're doing for a reason so in short you need to get the job done with the minimum expense possible personally what i like to do is to delay the actual development process as long as possible and the reason is that at least this is my experience that as soon as you start developing that's the thing that you're focusing on you're not focusing any more on is what i'm building actually useful to the customer is this actually what people want to have and those questions are really important to find an answer to so you might have an idea for a new application but before you start coding away you should just ask people whether that's actually a good idea and another thing is that when you create a new application you need to really fully understand the domain and the context that the application is going to be used in what is the problem that you're trying to solve it means you really need input from your potential users as soon as possible and you can get that before even starting to code for example if you want to create a tool that helps software developers let's say a plugin for vs code or something like that talk to those users first ask them is this a problem that you have and will blogging like this solve that problem for you what i try to do in the beginning is to kind of organize those ideas for myself and really write a document about it and in particular on the conceptual level write down what those things mean how they interact with each other part of this is the domain modeling so you're trying to understand the domain where your application is going to be used but you also want to think about the kind of technology that you're going to need so is this a web-based application is it an executable that has to be cross-platform is it does it run on a raspberry pi or whatever so there's lots of possibilities and that is going to limit the kind of technology that you'll be able to use and knowing those things beforehand is going to help you zoom in much quicker onto let's say a minimal version of your products that you're going to use to test some hypothesis and then this is the next step that you need to identify that okay let's say i want to create this huge new big thing that can do these hundreds of things and that's going to be awesome but you won't be able to build that all in one go because every time you build something you're going to change things you're going to learn new things from the people that are going to use your software and you want to make sure that you get that information as soon as possible and that means you need to focus on a minimum viable product and minimum viable product is a term that comes from the lean startup that basically means you want to do the minimum amount of work possible to test hypothesis look at it as a research project you're trying to find out information you're trying to discover if there is a market for your software if there are users that are interested in using your software assuming that you want people to actually use your software which most people do but users are also really annoying so maybe you don't anyway assuming you want users then this is what you gotta do next question victor what's the easiest way to share python scripts to co-workers and particularly how can you set up an environment fast and easy so there's a couple of ways to do it one way is to just tell them to install python i mean that's not hard you can download it from the python website install it and you're done that's particularly useful if you just want them to run a simple script to i don't know convert some data from json to another format or whatever that's i'd say the the most low-key way of doing it but it's also the way that breaks most easily if you need dependencies there's another thing you can do you can actually take a look at pi installer which is a package for bundling python and dependencies and then being able to distribute that it's actually cross-platform so this runs on mac and linux and windows a third way that i thought of that you could use is sandboxes so if you don't really need the script to run locally on your machine you could actually use something like replit or python sandbox or something like that these are web-based solutions so just write your code and web interface and then you get a link and you can share with other people and then they can run that code all right next question by minutio how do you test code that creates really complex output in you're mentioning specifically you're generating pretty elaborate html and how do you test that so writing testable code really links directly with applying design principles correctly the fact that the output is complex doesn't mean that the code has to be complex you can have your complex code or a complex output generating system be split into several logical parts for example you give as an example that you are you're creating pretty formatted tables so i imagine you will have some kind of formatting engine that takes an input and that generates formatted output and that maybe even does it on a table cell level so i think that's a part you can split out and create basically functions that do this with high cohesion and those things you can test you can test them really easily so part of the job is just splitting out things keeping things simple small separate high cohesion low coupling now there's a couple of things you can do to improve the testing because you probably also want to test the whole system in some way so there's end-to-end testing which is really testing the whole thing from beginning to the end so this is what your input is and then this is what your expected output is and then you check whether that's the same this can get pretty complicated especially if you're generating html with lots of child nodes and attributes and things like that that you want to check another thing you could do is add snapshot testing and a lot of the front-end frameworks actually have this built in into the their testing framework as well like if you're building a react application for example there's jest which is a really commonly used testing framework for react and that has snapshot testing so basically what that does is that you run the code once you generate your html that's going to create a snapshot with that particular piece of html and then it saves that and the next time you run the test it's going to verify that the output html is the same as the snapshot that you saved earlier and if there's any change it's going to report that change so it's not really testing it's more detecting that some things have changed and that can be quite useful this doesn't work all the time for example if you have a website that displays a random quote of the day obviously this this is gonna completely break your snapshot testing because they're just gonna fail all the time and another problem with snapshot testing is that it can get huge because you may have hundreds or thousands of these snapshots that just take up a lot of space and you need to take that into account and that might also drastically increase the time you need to actually automatically test your code a final issue with snapshot testing is that if there is a minor change in code then immediately all those tests are going to fail so let's say you're using something like material ui for the user interface and they decide to update the style a little bit and change the radius of the buttons with one pixel or something and then any page you have generated a snapshot of that has a button on it the test is going to fail and probably you don't really care about the radius of the button you just want to have a working application so snapshot testing is useful but it can also lead to a lot of complications so use it with care all right next question by thomas what's a useful idiomatic python design pattern that you use that we probably don't know about i have lots of secret design patterns that nobody knows about design patterns they're very strongly tied to object oriented principles the ones from the game gang of four book at least the problem is that if you look at languages nowadays like python or other language as well they have many more features they're not purely object oriented anymore they've included lots of functional aspects there are things like asynchronous code that behaves differently those things are not included at all in the original design patterns book and of course there have been other design patterns that have been proposed in the last decade but most of the people they still rely pretty much on this very traditional view of what design patterns are and these are still valid i mean i did video about observer strategy and things like that but you know some of these patterns they might need modernization to include some of those more modern features others have become more really anti patterns like the singleton so you shouldn't use that anymore but it does mean that when myself i i implement these design patterns i tend to modify them a little bit and modernize them for example in my strategy video if you watch that i first introduced the classic strategy pattern which is a class with a method that you pass but you can actually apply more functional approach to that same pattern and not pass an object around but pass a function around and then you call that function and you can do that for many of those design patterns actually like the let's say the observer pattern it expects an object that's an observer but there's no reason for that to be an object you could do that with functions and then it basically means that whenever something happens in the system you just call a bunch of functions that do things so thinking of patterns in this way perhaps already helps you a bit and applying them in a more modernized way now a more python specific pattern is actually coming up in a video in a couple of weeks i had a kind of crazy idea this one's definitely not in the gang of four book so um watch out for that and i will post that in a couple of weeks i think you're gonna like it okay next question by jamie actually these are two questions the first one is how much time you spend thinking about the design of your program before writing any code if i design a new feature or if i design a new application i spend a lot of time on the conceptual level because actually that's where you have the most impact on what the application is going to look like in the end and the reason i spent so much time there is that i think it's important at that level to not think in terms of code you don't want to be thinking about classes and methods and optimizing algorithms for things and things like that because it's not important the important thing is how the concepts are related is that meaningful and is that helping your user in some way who is your user what problem do you solve it kind of goes back to domain modeling as well and i i said it's about half of my time i spent on that level maybe even more bonus question how much how much does the design change while writing it hopefully conceptually not much changes but unfortunately that's not always the case what i notice is that changes in how concepts are related are rare it it happens and that sucks because basically that means you have to go back to the drawing board but normally if you get the concepts right and how they're related then the changes mainly happen in the user interface and the kind of patterns you apply which you'll apply lots of refactoring to improve the code and things like that the reason that i find the ui changes a lot is because a lot of that comes down to experience in fact my lack of experience probably i'm not the ux designer so i'm making lots of mistakes but it's also a question of when you build the user interface and you start to interact with it you notice some things are just not practical you want to click a button that's not there or some action just takes a lot of effort and you need to rethink it to make it functional to make it easier i think this is actually really important aspect of design that a lot of companies don't spend enough time on what i do notice is that it actually never happened to me that there was a 100 mapping from my original design to the final thing things always change and that means that whatever you're writing it's important that you realize that okay this is probably gonna change you're gonna probably throw away at least half of the code that you're writing now next question by romsunt how to audit a package for usage there have been instances where malicious code has been included in pip packages what's the best way to ensure that it's safe to use yeah it's a pity that pip doesn't really have these kind of security audits in place that would have been useful there's in the javascript world you have the pip equivalent which is called npm and they actually have something like this so if you include a package using npm they normally have these security checks where they can identify critical issues or serious issues that you need to be aware of when i use a package i generally look at a few different things so one thing that i look at in the package to decrease the possibility of these security issues is to look at how well established the package is how many stars does it have on github look at the issues page are issues handled regularly is there a code review in place are there many different contributors are there regular releases all these things help in making sure that a package has a community behind it and if there is a community behind it that's active and that's working in a structured way then that also reduces the chances of there being any security issues of course securities can also come from dependencies so if that package depends on something else that's maybe not as well maintained then that's also something to be aware of and i think pip has the possibility to print out the dependencies that package relies on so you could also go through those dependencies to make sure you don't see anything fishy otherwise i don't think there's any option apart from looking at the code and reviewing the code and make make sure that there is no weird things that are happening okay last question by joshua which is how high can i earn as a python developer working remotely worldwide i can't give you a number for this and the reason is that there's lots of factors that are at play for example depends on the country you're in some countries have higher living costs than other countries so the salaries are different it depends on your skill level are you a junior developer you just got out of college and you're starting a side job are you a senior developer with lots of skills and experience are you working in the education industry which will probably pay less than if you're working let's say in finance or at an investment firm or something doing data analysis on investments so all those things play a role in determining the kind of salary that you can come out now in particular fields like data science and ai are really booming at the moment it's it's why python has become so popular over the last few years so there's definitely a lot of demand for good developers but you need the skill i think the right question to ask is not how high can i earn but it's what do i need what do i need to live a nice life and you can for yourself come up with a number that gets that for you right and if you notice that at your current skill level you're not reaching the number that you would like to have to live a happy and fulfilling life you can improve your skills follow my videos become subscriber to my channel learn about these things and become better i hope you enjoyed this q a session today i had a lot of fun doing this actually i'm sure you're going to do this again in the future so thanks for watching take care and see you next time
Info
Channel: ArjanCodes
Views: 9,147
Rating: 4.9728508 out of 5
Keywords: most frequently asked python questions, python interview questions, python job interview, python tutorial, learn python, python programming, python for beginners, python training, python careers, python career options, python developer career, python career path 2020, learn python programming for beginners, learn python programming, most frequently asked python coding questions, python course playlist, Python programming for beginners
Id: LQdZNjhzE9o
Channel Id: undefined
Length: 17min 45sec (1065 seconds)
Published: Fri Jul 02 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.