Unit tests should never duplicate code or test inputs prior to the code running. The code should validate the input. The unit test should only test a known input vs. a known result, generally to highlight a corner case like the end of the alphabet in the Cesar Shift
Hi Jacob, thank you so much for your comment! 😀 Could you please share why it's the case that we should "never test inputs prior to the code running"? I've been looking into all the TDD materials I have from my university and I couldn't find anything that suggested it is forbidden. Is it based on your personal experience or can you share the resource that suggested it? If I'm demonstrating something that is indeed wrong, I need to know why it's wrong and whether it's opinion-based or factual before I issue a correction 🙃 Our industry has lots of conflicting views on different practices, even within the unit testing crowd there's huge disagreements between leaving in the tests in the production version or restricting them to the debug version only. In many cases both sides have compelling arguments so I try to avoid getting into grey territory. It would be awesome if you can elaborate on your comment a bit more! 😊 In terms of duplication, I thought I was avoiding it by utilizing the setUp() method. Did you mean duplicating the input I've passed from test to test? I might be wrong, but how I see it is: if my first 10 tests are dealing with a "banana" input - wouldn't it be considered duplication if I now copy all those tests just so I can apply them on "banana bread"? Please let me know! 😊 In terms of "only testing known input vs. a known result" it's sounds a bit like a black box approach, while UoL refers to unit testing as a glass box approach. I realize the real-life experience is different from theory, but shouldn't unit tests deal with the innerworkings within the production code too? My apologies about the long reply! I thought I understood TDD well, but your comment really confused me hahahaha 😅😅😅
@@PythonSimplified The unit case is a special tool for regression testing. It's used to determine if new changes have affected a program, and you're right, you need to practice what I've come to know as "positive failure" (writing the failure messages in your code first). By testing your input inside your use case, you've robbed the application of sanitizing input and given yourself the false assumption that the program will not crash when fed invalid input. Your unit test should also feed invalid input to any code where you don't have complete control. For instance, if a user (or the program feeding the data to the encryption routine) feeds a blank string to the application, you would exit cleanly, but then the application has the opportunity to set something like "self.emptyStringFlag" For duplication of code: By using the same code in the unit test as in the actual application, you have no way of knowing if the bug is in one or the other. What was the original intent after refactoring? Is the calculation in the application correct, or is the calculation in the unit test correct? In the case presented in your video, I recommend using a known good input and a hand calculated result to compare... "ABCXYZ" and "BCDYZA" as hard coded in the unit test, that way there's no question as to what the expected result should be. Your setup method might populate a handful or more known values so your unit test can hit every "corner case" you know of, and be expanded on later (like adding the space character). Later, you might change the hard coded values into a file filled with many cases to detect known bugs you discover over time. Now keep in mind that if the program requirements change in the future (like adding a shift parameter), you would then have to update the unit test to reflect the changes These are not hard and fast rules, but rather great learning opportunities. I find that I have to step back and look at my own programs to see where I've pushed through a problem only to cause myself grief later. That's why we often refactor small portions of a program over and over until it's not only readable, but has a way to be maintained later. This is where unit testing comes in... it's easy to break a working program, but how would you know without a unit test? I do like that you have a passion for making these videos. I try to spend at least a half a day each week expanding my skill set, even when I'm busy working. Making tutorials is a great way to hone programming skills.
Jacob, your comment is absolutely incredible! You are reasoning about concepts that none of my lecturers bothered explaining or even discussing! I never even thought about flagging invalid input or about adding potential issues by duplicating parameters. In fact, I don't think I've ever had a conversation with someone who has so much hands-on experience with unit testing. I've always discussed it on a theoretical level, rather than focusing on how it translates into an appliable routine that developers use regularly. It's not enough to just utilize the unittest module, it's about having confidence in the reliability and accuracy of not just the production code - but the tests themselves and the inputs and outputs we use when conducting them. Thank you so much for taking your time explaining this, it makes perfect sense! I wish I spoke to you about this before filming my tutorial, I would have definitely changed a bunch of the content hahahaha 😅😅😅 I'm currently working on an article version of this video for my blog, which I'll definitely revise given you feedback, but I'm wondering if there's a chance I can quote parts of your comment in it? I'll create a bunch of quote section within the article and if you'd like I can include a link to you Github/Linkedin/etc. I think your experience with unit testing can help lots of aspiring programmers and I don't want to paraphrase you because I think you were spot on! Thank you so much one again, and please let me know if you are interested! 😀
@@PythonSimplified You are very welcome. I'm happy to help. Feel free to quote or adjust the feedback to fit your style and content. Before lawyers got involved, there was a huge benefit from working cross-company with other developers. We would "borrow" ideas from one another and it wasn't an issue. I'll send you a PM with my info.
Yey! Thank you so much Jacob!!! The world was definitely much more simple before copyrights ruined it! 😉 You can find me at mariyasha888@gmail.com, I'll ping you when the article is ready (will probably take me some time to finalize it... I don't want to mess up again so I'll be extra picky 😅 hahaha)
I genuinely enjoyed your video on TDD and appreciate the depth you went into explaining each step. Your presentation style is quite engaging! That being said I couldn't help to notice several mistakes, so I hope I can provide you with some useful feedback: 1. Some of the initial tests went green/passed but there wasn't ANY production code written, you just added some code on the test itself to make it pass, which violates the TDD laws, the code to make the test pass HAS to be production code. Also you want to make sure that your tests are against the module/unit you are trying to validate/design, in this case it doesn't make much sense to test the "input", you want to focus your test against the encrypt function. 2. The last test you wrote was very tightly coupled to the implementation details of the solution, it basically validated that "1 + 1" equals "1 + 1", sort of a tautology. As a matter of fact, in order to make the test pass you had to fix the production code AND then replicate the fix on the test, a bit of a red flag. Tests should be more like "validate the expected output is equal 2", so that you are free to implement it as "1 + 1" or "1.2 + 0.8" and then in the future change it to "0.5 + 0.5 + 1" (you get the idea), so the test is resistant to refactoring and not prescribing a specific implementation. 3. You had the right mindset from the outset, i.e. divide and conquer and proceed incrementally to build a solution, but then you sort of dropped the whole logic into the last test with no increments whatsoever, you should have split that test in many many cases: e.g. "shift letters by one", "deal with numbers also", "deal with spaces/other-chars" etc. 4. The 3 steps of the TDD cycle include a refactoring phase after the green phase (Red-Green-Refactor), and is a very important one, because that's were we can make the code more readable, clean, well-designed and what not, for instance the logic for the encryption function felt like a good candidate for refactoring. Just to be clear, refactoring can be applied to both production and test code. 5. You kept changing the single message "manually", but what you actually should have done is to codify those manual steps into test for those boundary conditions, so that they can catch regressions in case somebody (you included) modify the code in the future. I'd recommend watching this talk by Ian Cooper, probably one of the best talks out there which goes over the common TDD misconceptions: th-cam.com/video/EZ05e7EMOLM/w-d-xo.html All in all, I really appreciated the effort, don't worry too much about the mistakes, we've all made the same mistakes throughout our own TDD learning journey, so keep practicing!
22:19 If you keep copying your function code to the unittest section and back, isn't it to be expected that the output will be the same? I mean, you're basically testing if 2+2 equals 2+2 instead of 2+2=4. Wouldn't assertIsEqual(encrypt('banana'), 'cbobob') make more sense?
Couple of decades as a deveoper under my belt and i have NEVER seen TDD actually applied in production. I meet lots of people who think it is a god idea, but nobody seems to actually use it, its hilarious.
hahahaha I think it's mostly an academia thing... if my university didn't cover it - I wouldn't know anything about it! 😅 I don't think I'll be using it for my personal projects as it's very time consuming, but I can see how it results in a more-reliable piece of software. You basically have more confidence in your code and its boundaries - but it comes at the expense of your time 😉
I have been learning the principles of software engineering for last 5 months, now with this new concept that was recently introduced , I was having a hard time grasping it. your video shed a light on a lot of concepts. Thanks for taking the time to explain to newbies like me.
Please more QA tutorials, this is what I am missing from my toolbox I've already mastered automation, now I need to learn things like TDD and BDD and son
Absolutely! Will do, CrazyFanaticMan! 😉 Please checkout the pinned comment by Jacob, you'll learn so much from it! I'm a computer science student so my perspective is very theoretical, but if you'd like to learn the hands-on approach - please checkout the more critical comments, as they point out a few problems within my code that students may not notice but professionals see right away! 🙃
in last test, you could also add % 94, to prevent out of index error. So, when you are on the last character of abc, it will take you to abc[0] as len(abc) is 95
It's the Aura ROG Wallpaper, I install it via an application called Armoury Crate (it's an Asus ROG control panel) 😀 Monitor is Samsung Odyssey G9 (they came up with a newer version since, once that can be turned vertically) Hope it helps! :)
Thanks Mariya. Great video, as always! I appreciate the step by step approach. Not only is it good for learning unit testing, but development as well! :)
good stuff, thanks Python Lady. I had a practice Python test earlier for a job, and another tomorrow. It has been so long that I could barely remember the syntax 😀
Thank you so much Tobs! Good luck with the Python recap! 😀 I always have a similar problem with remembering JavaScript, I keep using "for 0 < i < 4:" instead of "for (0 < i < 4){}" for the first few hours of getting back to it 😂😂😂
@@PythonSimplified just finished the test but I failed, I had to sort a dictionary but I wanted to sort by the values and then return the keys. Python refused to sort by the values. I was thinking of another way when it said I had 9 seconds left 😥
@@Tobs_ oh no Tobs! I'm sorry to hear that! 😭😭😭 sounds like something that dictionary comprehension could have helped with, or maybe even converting the ductionary into a Pandas Dataframe to make it more convenient to sort. That's why I don't like this timed test-based approach to hiring! When the clock is ticking and so much is on the line - they miss out on many talented candidates! 😡 fastest approach is not always the best approach, it's not a way to evaluate skill. "It works" rather than "it works well"... I would imagine that ones portfolio on Github is a mich better indication of talent than a one-time test 🙃
@@PythonSimplified thanks mate, no worries, I still have a job so not as bad as when I was unemployed. I was just hoping to get a different experience, but sometimes the code goes your way, and sometimes it doesn't. I think the solution was sorting the dictionary on values somehow, setting a lambda key on the sorted() method probably. I just needed another 3 or 4 minutes, but when your time is up, your time is up.
One of the uses of testing is that we can get clarity of why things go wrong. To get clarity we want to watch out for tests that test too much at once. Too much (strictly speaking) is more than one real case at a time. If we test too much in the same case it becomes unclear why the test failed. In this example if we only tested a string that is made of all characters including characters not in the abc then we could fail because of a number of reasons. Maybe it was one of the characters not included in the abc variable (no clue which one), maybe it was because we hit an index out of bounds for the last character, maybe the characters do not map correctly, maybe it was because we're using a combination of abc included and non included characters (or maybe my pc just refuses to compute anything untill it gets some coffee). The point is that we don't get much of an idea why our test failed. Sure we can open a debugger and go though it but it is much nicer (as in quicker and less mindnumbing) if we can isolate the issue with a testcase since we can then quickly and clearly see what makes the issue occur.
Sometimes the coffee part is what actually went wrong with the PC hahahaha 🤪🤪🤪 I definitely agree with you Poly Liker! 😊 I've created this tutorial based on theoretical knowledge rather than hands-on experience. You can checkout the pinned comment where Jacob explained some of the points you've mentioned very thoroughly, I believe you guys are on the same page! 😉 I think it's very important to reason about these concepts, as folks who are just beginning their Unit Testing journey (such as myself) are rarely exposed to these type of conversations. We see a coding example by our teacher/lecturer, we think we understand everything, but when it comes to implementing unit testing on our own - we just repeat what we saw, which was a very specific and narrow example, without thinking deeply about the process and how it manifests in different situations. I'll just keep practicing and when I'm confident enough - I'll make another attempt at covering this concept on the channel... this time properly! 🙃
Hi teacher, I developed a small system in tkinter and it is fine without any error, my question is: How can i let it play a music when executing and closing? Thank you
I think the easiest way to play music (.mp3 files in particular) with Python is via Pygame! 😊 I have a repository on Github that might help you with that: github.com/MariyaSha/PythonMusicPlayer If you're more into .wav files, checkout: ⭐ simpleaudio: simpleaudio.readthedocs.io/en/latest/ ⭐ or the Tkinter based tkSnack (I don't think it's officially by Tkinter, but it should be compatible): www.speech.kth.se/snack/man/snack2.2/python-man.html Best of luck with your app! 😁
I haven't had a chance to look into TOML files yet so I don't really know much about it at this point of time 🙃 If I see more requests I'll definitely check it out! Thank you so much for your suggestion, Carlos! 😀
great tutorial. anyway about 21:41, I just want to share a little cool trick. Instead of writing if else, you can just write it like this (it's applicable on any programming languange): abc[(abc.find(char) + 1) % len(abc)] for idx, char ... pretty cool right :)
Thank you so much for the great tip, Jacky! I'm huge fan of modulo! definitely a better alternative! 😀😀😀 It's just a bit more complex to explain to folks who are not very experienced with programming or math (and the video was long enough already hahahaha 🤪). Conditional statements are not nearly as cool, but since they were covered in my List Comprehension tutorial - I went for one instead :)
It's the Aura ROG Wallpaper, I install it via an application called Armoury Crate (it's an Asus ROG control panel). I'm pretty sure you can use it even if you don't have any ROG parts 😀
Hello, I love your videos about kivy)) I have a question: I will develop a mobile app and upload it to the Google Play. What do you think, can I use kivy or it is better to use java? Thank you)
I believe you can do that with Kivy, just make sure your .apk file is fully operational before you apply 😊 On the other hand, Java/Kotlin is a bit more conventional when it comes to proper Android apps. Kivy is great for creating quick and simple mobile apps, but if you're building something a bit more comprehensive - I would definitely go the Java way instead 😉 Best of luck with your app! 😀
One of my favourite computer science topics is cryptography! I would LOVE to start covering it on the channel 😀 I'm hoping to see lots of comments saying "Mariya please cover more encryption algorithms" as I think I can simplify RSA and hashing really well! 😉 I'll probably start with more symmetric stuff (probably the cipher from Edgar Allan Poe's Golden Bug) but the goal is definitely the highly complex asymmetric algorithms we use nowadays (everything else is interesting, but quite useless hahaha 😅😅😅)
I haven't had a chance to work with Pytest yet, but I did get a bunch of recommendations on it! 😉 Will check it out shortly, thanks for suggesting! (I must admit thought - I'm a huge fan of OOP hahaha)
It looks like wayscript has shut down. Do you happen to know of any similar platforms? I'm only now hearing about it and it seems like a really cool idea.
Hi Yo! :) I rarely read books as I mostly learn by example, but my university (UoL) works with: ⭐ Python for Data Analysis by Wes McKinney In terms of Machine Learning, checkout: ⭐ Deep Learning with Python by Francois Chollet I've read a bunch of it, and it's highly recommended by a long time subscriber of this channel (S M Ali) 😀
Like your content , you always make it interesting! I didn't get to see your last vid till today, & so I don't know if you'll see this- or if ur into gaming or not, but I thought I'd mention a few programming type games u might like. (newest 2 oldest) {All are available on steam} Robo Co. (it's a robot building/coding game that lets you use actual python script in game to program / enhance your creations ;) Autonauts vs Piratebots Autonauts (Use Obj & code-block style programming to automate tasks for your robots to ultimately create an autmated metropolis for the human colonists) Nimbatus (design & build your own ships & ultimately create & program dromes to mine asteroids & planetoids autonamously) Factorio (More of a factory building/manufacturing game @ the outset but later you can program drones, train loading/unloading/delivery & tons of other stuff. I have seen some one program the equivelent of an A.I. to decide where to & how to, deconstruct their current base & rebuild it section by section in a new location while fending of enemy attacks without any human intervention.) Space Engineers (the oldest of these- it came out in 2013 has low system specs but still looks nice- & still has new content releases every few months. It could be considered as a cross between Lego Designer & No man's Sky, Eve Online & the X- Series ) It lets you build & program ships, space stations, make ammunition, weapon, mech, or cruiser class+ ship factories that u make fully automated right down to what info from what components, sensors etc get diverted to what in-game display screens, lights doors etc.& then ship them to stations or the frontline for other factions/players to buy) This one is currently on sale for 50% off all versions & DLC I picked up the Space Engineers Ultimate Edition ($34.44 w/tax) It includes: Space Engineers, Space Engineers - Deluxe, Space Engineers - Decorative Pack #1 & #2, Space Engineers - Style Pack, Space Engineers - Economy Deluxe, Space Engineers - Frostbite, Space Engineers - Sparks of the Future, Space Engineers - Wasteland, Space Engineers - Warfare 1, Space Engineers - Heavy Industry
I'm definitely into gaming! You've seen my PC hahahaha 😉 Thank you so much for recommending! I'm more into shooters like The Division 2 or open world games like GTA and Red Dead Redemption 2 - but will definitely checkout Space Engineers, looks very promising! 😀
@@PythonSimplified Honestly didn't think u'd read my post- two others you might like are From the Depths & TerraTech they are much more open world then the prior ones I mentioned. Hope you have a blast! 🤖
Wow!!! What a fantastic solution, Krish! absolutely brilliant!! thank you so much for sharing! 😀😀😀 This skips fetching the alphabet altogether!!! I wish I thought of that!!! 😉 Please check it out folks: message = "banana" encrypted_message = "".join([chr(ord(char) + 1) for char in message]) print(encrypted_message)
Nice approach, but you do know you shouldn't write list comprehensions that are very complicated. You should respect PEP8 also.Beautiful is better than ugly.Explicit is better than implicit.Simple is better than complex.Complex is better than complicated. Flat is better than nested. Sparse is better than dense. And most important ....readability counts.
I'm working on a brand new AI Simplified series (while on vacation) 😃 a bunch of absolutely incredible tutorials are coming soon, so please stay tuned! 😉
Sorry to say but that List Comprehension breaks my heart. It is way to long and has to much complexity. When you add too much complexity to a list comprehension the readability goes down significantly, so next time just use a normal for loop. Try to follow the PEP-8 or the Black standard. If you follow one of these standard the maximum line length is 79 for PEP-8 and 88 for Black.
On no! I didn't mean to break your heart GredField!! 😊 The thing is... List Comprehension has a HUGE benefit over for loops in terms of speed! Checkout the beginning of my zip vs. range live stream where we compare the benchmarks, I think you'll be very surprised to see how much difference it makes: ⭐ th-cam.com/video/Otr6BW-uKFs/w-d-xo.html In the end - it's all a matter of personal preference. If readability is more important to you than execution speed - you should definitely go for a for loop! If functionality/time resources is more important to you - than List Comprehensions is a better way to go! I don't think there's ever a one-size-fits-all solutions when it comes to programming 😀 Since it's such a dynamic field that changes and develops overtime - I don't know if restricting yourself to a pre-defined set of rules that somebody else wrote for you is the best way to explore Python to the fullest extent. I think it's more than OK to experiment with "unconventional" routes. I mean - how would we ever invent or discover something new if we keep repeating somebody else's practices? 😉 That's just how I see it... it might not work for everyone, but that my take 😁
How often in real life do you have to deal with a problem that is as trivial as this one? Those are overused school cases and are completely agnostic to reality.
When you learn something new you need a simple starting point, you can't just jump on to a super useful startup idea right away! 😉 Once you understand the general concept - you can then implement it on more complex real-life projects and take this skill to the next level. I try to focus on helping people, in particular beginners, understand ang gain confidence + motivation on their programming journey. I've called my channel Python Simplified for a reason (otherwise it would be called Python Professional or something along these lines hahaha 😅)
I hate TDD with a passion! I recognize how important it sounds, and blackbox testing is great, but in my opinion TDD leads to far more complicated sphagetti code cause your sole aim is to satisfy a test. Just take a look at the final code in this video. It takes a nice clean algorithm and makes it almost unreadable. Also, as others have pointed out, the implementation in this video has some issues. I would even go as far as to say that you never tested for the existence of the encrypt function, went straight to it's output, this breaking a TDD law (OK, this is a bit of an exaggeration, but so is my annoyance with TDD). Anyways, still a great video!
The first test you wrote is NOT a unit test. It does not test anything, there is nothing under test, it's 100% totally and utterly pointless. You would have been better off obeying Rule.2 by putting pass() in the unit test.
I can sum up why I hate unittesting and tdd in one example. Guy comes to me with his code. He can't figure out why it keeps failing the test. So I check his code and there isn't an issue with the stuff we needed. So I look at the unit test. It was the test that was bugged he wrote. See the stupid part about unittesting is they forget the test itself is just more code that may need debugging. So what are you going to do write another test to make sure the unittests aren't bugged. Well maybe that code is bugged so you should write more stupid test to check it. TDD results in programs that can in some cases perform a function well but it doesn't work well when you are trying to develop software to do what someone wants or needs. It also just bloats adds way more work. 35 years I have never gotten a single thing useful out of it. So I never used it myself. I won't work for an employer that demands me to use it so never had to myself. But I've held other people over that time with their code like the example above and it has only been problematic never once useful. If you want to do testing do it at a system or functional level. Even I do that. Lets say I am writing a compiler. I won't test at minor levels of code like you are showing. I have base code I have used for decades I know works so unless there is a compiler or hardware issue there is no point testing it till the end. I'll write something on the level of the interpreter or assembler and test it. Or I've been working with game engines a lot in the last decade as well. You can break those into parts like graphics engine, physics engine, sound, resource manager and so on. I test at those levels. Just to be clear I hate bloated code I'm a minimalist and performance junkie. I like small code the less there is the better. Two reasons it will usually perform better secondly there is less to debug if there is an issue. I can get it done faster if you need a 3rd reason. Kent Beck tells why TDD worked for him. He says in a video he had trouble focusing on larger problems at once. He has anxiety issues and wanted a way to be confident in his code working. To bad he didn't realize his unit tests are also code and what if he wrote those wrong? I think while someone is in college just learning to program it could be helpful to some. I don't belief it should ever be used in a business or production environment. Most my programming has been in the industrial fields power plants nuclear, chemical plants, fabs, ... Not once in that time has my code been linked to a failure or incident. If it had it would have cost lives. So I wasn't worried at the end of the day like Kent Beck if my code worked I cared if I got someone killed or not.
Wow!! Thank you for the incredible input that none of my university lecturers dared to share! 😀 We write all those fancy tests, we pass them and we think our code is flawless as a result - but what if our tests are flawed?? 🤯🤯🤯 I absolutely agree! I don't have nearly as much experience in the field - but it makes perfect sense! Testing comes in many shapes and forms, unit testing is just one of them and while it is presented as a common practice by universities and collages - it seems to have very little real-life applications. It might work well for a certain type of developers, but it is very time consuming and just as prone to errors as the traditional coding approach. You're not gonna hear that from my lecturers that's for sure! Otherwise we'd just pass the exam and forget all about it 😉 Thanks again, Diconica Bastion! I really appreciate you took the time to share your experience with us!
Enter your secret message: banana Enter your secret code: -100 output: 76i6i6 is this answer correct I don't know but this video help me solve so many problems
drive.google.com/file/d/1ocd9KNNO7QCPt2HjIpBO-5ULfI5-8oNj/view?usp=share_link I had to see if ChatGPT could solve this relatively simple algorithm. It went the ord() route, but it fails on negative shifts and shifts outside the length of Unicode (doesn't wrap). Its explanation is also wrong as it says non alphanumeric characters will not be shifted, but they are by the program. I've found something like "encrypted_message += abc[(abc.find(char) + shift) % len(abc)]" is concise and works nicely for positive shifts, negative shifts, and shifts larger than the set of characters you use (ie it wraps).
Unit tests should never duplicate code or test inputs prior to the code running. The code should validate the input. The unit test should only test a known input vs. a known result, generally to highlight a corner case like the end of the alphabet in the Cesar Shift
Hi Jacob, thank you so much for your comment! 😀
Could you please share why it's the case that we should "never test inputs prior to the code running"?
I've been looking into all the TDD materials I have from my university and I couldn't find anything that suggested it is forbidden. Is it based on your personal experience or can you share the resource that suggested it?
If I'm demonstrating something that is indeed wrong, I need to know why it's wrong and whether it's opinion-based or factual before I issue a correction 🙃
Our industry has lots of conflicting views on different practices, even within the unit testing crowd there's huge disagreements between leaving in the tests in the production version or restricting them to the debug version only. In many cases both sides have compelling arguments so I try to avoid getting into grey territory. It would be awesome if you can elaborate on your comment a bit more! 😊
In terms of duplication, I thought I was avoiding it by utilizing the setUp() method. Did you mean duplicating the input I've passed from test to test?
I might be wrong, but how I see it is: if my first 10 tests are dealing with a "banana" input - wouldn't it be considered duplication if I now copy all those tests just so I can apply them on "banana bread"?
Please let me know! 😊
In terms of "only testing known input vs. a known result" it's sounds a bit like a black box approach, while UoL refers to unit testing as a glass box approach. I realize the real-life experience is different from theory, but shouldn't unit tests deal with the innerworkings within the production code too?
My apologies about the long reply! I thought I understood TDD well, but your comment really confused me hahahaha 😅😅😅
@@PythonSimplified The unit case is a special tool for regression testing. It's used to determine if new changes have affected a program, and you're right, you need to practice what I've come to know as "positive failure" (writing the failure messages in your code first).
By testing your input inside your use case, you've robbed the application of sanitizing input and given yourself the false assumption that the program will not crash when fed invalid input.
Your unit test should also feed invalid input to any code where you don't have complete control. For instance, if a user (or the program feeding the data to the encryption routine) feeds a blank string to the application, you would exit cleanly, but then the application has the opportunity to set something like "self.emptyStringFlag"
For duplication of code: By using the same code in the unit test as in the actual application, you have no way of knowing if the bug is in one or the other. What was the original intent after refactoring? Is the calculation in the application correct, or is the calculation in the unit test correct? In the case presented in your video, I recommend using a known good input and a hand calculated result to compare... "ABCXYZ" and "BCDYZA" as hard coded in the unit test, that way there's no question as to what the expected result should be. Your setup method might populate a handful or more known values so your unit test can hit every "corner case" you know of, and be expanded on later (like adding the space character). Later, you might change the hard coded values into a file filled with many cases to detect known bugs you discover over time.
Now keep in mind that if the program requirements change in the future (like adding a shift parameter), you would then have to update the unit test to reflect the changes
These are not hard and fast rules, but rather great learning opportunities.
I find that I have to step back and look at my own programs to see where I've pushed through a problem only to cause myself grief later. That's why we often refactor small portions of a program over and over until it's not only readable, but has a way to be maintained later. This is where unit testing comes in... it's easy to break a working program, but how would you know without a unit test?
I do like that you have a passion for making these videos. I try to spend at least a half a day each week expanding my skill set, even when I'm busy working. Making tutorials is a great way to hone programming skills.
Jacob, your comment is absolutely incredible! You are reasoning about concepts that none of my lecturers bothered explaining or even discussing!
I never even thought about flagging invalid input or about adding potential issues by duplicating parameters.
In fact, I don't think I've ever had a conversation with someone who has so much hands-on experience with unit testing.
I've always discussed it on a theoretical level, rather than focusing on how it translates into an appliable routine that developers use regularly.
It's not enough to just utilize the unittest module, it's about having confidence in the reliability and accuracy of not just the production code - but the tests themselves and the inputs and outputs we use when conducting them.
Thank you so much for taking your time explaining this, it makes perfect sense! I wish I spoke to you about this before filming my tutorial, I would have definitely changed a bunch of the content hahahaha 😅😅😅
I'm currently working on an article version of this video for my blog, which I'll definitely revise given you feedback, but I'm wondering if there's a chance I can quote parts of your comment in it?
I'll create a bunch of quote section within the article and if you'd like I can include a link to you Github/Linkedin/etc.
I think your experience with unit testing can help lots of aspiring programmers and I don't want to paraphrase you because I think you were spot on!
Thank you so much one again, and please let me know if you are interested! 😀
@@PythonSimplified You are very welcome. I'm happy to help. Feel free to quote or adjust the feedback to fit your style and content. Before lawyers got involved, there was a huge benefit from working cross-company with other developers. We would "borrow" ideas from one another and it wasn't an issue. I'll send you a PM with my info.
Yey! Thank you so much Jacob!!! The world was definitely much more simple before copyrights ruined it! 😉
You can find me at mariyasha888@gmail.com, I'll ping you when the article is ready (will probably take me some time to finalize it... I don't want to mess up again so I'll be extra picky 😅 hahaha)
I genuinely enjoyed your video on TDD and appreciate the depth you went into explaining each step. Your presentation style is quite engaging!
That being said I couldn't help to notice several mistakes, so I hope I can provide you with some useful feedback:
1. Some of the initial tests went green/passed but there wasn't ANY production code written, you just added some code on the test itself to make it pass, which violates the TDD laws, the code to make the test pass HAS to be production code. Also you want to make sure that your tests are against the module/unit you are trying to validate/design, in this case it doesn't make much sense to test the "input", you want to focus your test against the encrypt function.
2. The last test you wrote was very tightly coupled to the implementation details of the solution, it basically validated that "1 + 1" equals "1 + 1", sort of a tautology. As a matter of fact, in order to make the test pass you had to fix the production code AND then replicate the fix on the test, a bit of a red flag. Tests should be more like "validate the expected output is equal 2", so that you are free to implement it as "1 + 1" or "1.2 + 0.8" and then in the future change it to "0.5 + 0.5 + 1" (you get the idea), so the test is resistant to refactoring and not prescribing a specific implementation.
3. You had the right mindset from the outset, i.e. divide and conquer and proceed incrementally to build a solution, but then you sort of dropped the whole logic into the last test with no increments whatsoever, you should have split that test in many many cases: e.g. "shift letters by one", "deal with numbers also", "deal with spaces/other-chars" etc.
4. The 3 steps of the TDD cycle include a refactoring phase after the green phase (Red-Green-Refactor), and is a very important one, because that's were we can make the code more readable, clean, well-designed and what not, for instance the logic for the encryption function felt like a good candidate for refactoring. Just to be clear, refactoring can be applied to both production and test code.
5. You kept changing the single message "manually", but what you actually should have done is to codify those manual steps into test for those boundary conditions, so that they can catch regressions in case somebody (you included) modify the code in the future.
I'd recommend watching this talk by Ian Cooper, probably one of the best talks out there which goes over the common TDD misconceptions: th-cam.com/video/EZ05e7EMOLM/w-d-xo.html
All in all, I really appreciated the effort, don't worry too much about the mistakes, we've all made the same mistakes throughout our own TDD learning journey, so keep practicing!
22:19 If you keep copying your function code to the unittest section and back, isn't it to be expected that the output will be the same? I mean, you're basically testing if 2+2 equals 2+2 instead of 2+2=4. Wouldn't assertIsEqual(encrypt('banana'), 'cbobob') make more sense?
Couple of decades as a deveoper under my belt and i have NEVER seen TDD actually applied in production. I meet lots of people who think it is a god idea, but nobody seems to actually use it, its hilarious.
hahahaha I think it's mostly an academia thing... if my university didn't cover it - I wouldn't know anything about it! 😅
I don't think I'll be using it for my personal projects as it's very time consuming, but I can see how it results in a more-reliable piece of software.
You basically have more confidence in your code and its boundaries - but it comes at the expense of your time 😉
I use TDD for production development. In fact there are even companies which primarily develop software using TDD.
@@PythonSimplified It might seem like only an academia technique, but it is a very wise way of developing code from scratch.
I have been learning the principles of software engineering for last 5 months, now with this new concept that was recently introduced , I was having a hard time grasping it. your video shed a light on a lot of concepts. Thanks for taking the time to explain to newbies like me.
Best video on unittest ever, so beautifully explained. Thank you
I'm so happy you did this video, helped a lottttttt ,just needed a unit test for my project
Thanks again for your lovely content 😊
Yeeeeey! super happy I was able to help! 😀😀😀
Thank you so much the incredible comment, Or! 😊
The first sentence of your video is a great analogy, well said.
Thank you so much Tiam! :)
Please more QA tutorials, this is what I am missing from my toolbox
I've already mastered automation, now I need to learn things like TDD and BDD and son
Absolutely! Will do, CrazyFanaticMan! 😉
Please checkout the pinned comment by Jacob, you'll learn so much from it!
I'm a computer science student so my perspective is very theoretical, but if you'd like to learn the hands-on approach - please checkout the more critical comments, as they point out a few problems within my code that students may not notice but professionals see right away! 🙃
in last test, you could also add % 94, to prevent out of index error. So, when you are on the last character of abc, it will take you to abc[0] as len(abc) is 95
what wallpaper you using at 1:06 if its any sort of wallpaper eninge please send me link and also what monitor do you use
It's the Aura ROG Wallpaper, I install it via an application called Armoury Crate (it's an Asus ROG control panel) 😀
Monitor is Samsung Odyssey G9 (they came up with a newer version since, once that can be turned vertically)
Hope it helps! :)
@@PythonSimplified thank you 💗
Thank you for this lesson on unit testing for beginners. It was very clear and comprehensive!
Thanks Mariya. Great video, as always! I appreciate the step by step approach. Not only is it good for learning unit testing, but development as well! :)
good stuff, thanks Python Lady. I had a practice Python test earlier for a job, and another tomorrow. It has been so long that I could barely remember the syntax 😀
Thank you so much Tobs! Good luck with the Python recap! 😀
I always have a similar problem with remembering JavaScript, I keep using "for 0 < i < 4:" instead of "for (0 < i < 4){}" for the first few hours of getting back to it 😂😂😂
@@PythonSimplified just finished the test but I failed, I had to sort a dictionary but I wanted to sort by the values and then return the keys. Python refused to sort by the values. I was thinking of another way when it said I had 9 seconds left 😥
@@Tobs_ oh no Tobs! I'm sorry to hear that! 😭😭😭 sounds like something that dictionary comprehension could have helped with, or maybe even converting the ductionary into a Pandas Dataframe to make it more convenient to sort. That's why I don't like this timed test-based approach to hiring! When the clock is ticking and so much is on the line - they miss out on many talented candidates! 😡 fastest approach is not always the best approach, it's not a way to evaluate skill. "It works" rather than "it works well"... I would imagine that ones portfolio on Github is a mich better indication of talent than a one-time test 🙃
@@PythonSimplified thanks mate, no worries, I still have a job so not as bad as when I was unemployed. I was just hoping to get a different experience, but sometimes the code goes your way, and sometimes it doesn't. I think the solution was sorting the dictionary on values somehow, setting a lambda key on the sorted() method probably. I just needed another 3 or 4 minutes, but when your time is up, your time is up.
sortedWeights=sorted(weights.items(),key=lambda tup: tup[1], reverse=True)
list=[]
for v1,v2 in sortedWeights :
list.append(v1)
Love it! Excellent Tutorial. We now have snow in Ontario. I hope all is well. Play safe. :D
I love your personality! You defo make learning python alot fun!
One of the uses of testing is that we can get clarity of why things go wrong.
To get clarity we want to watch out for tests that test too much at once. Too much (strictly speaking) is more than one real case at a time. If we test too much in the same case it becomes unclear why the test failed.
In this example if we only tested a string that is made of all characters including characters not in the abc then we could fail because of a number of reasons. Maybe it was one of the characters not included in the abc variable (no clue which one), maybe it was because we hit an index out of bounds for the last character, maybe the characters do not map correctly, maybe it was because we're using a combination of abc included and non included characters (or maybe my pc just refuses to compute anything untill it gets some coffee).
The point is that we don't get much of an idea why our test failed. Sure we can open a debugger and go though it but it is much nicer (as in quicker and less mindnumbing) if we can isolate the issue with a testcase since we can then quickly and clearly see what makes the issue occur.
Sometimes the coffee part is what actually went wrong with the PC hahahaha 🤪🤪🤪
I definitely agree with you Poly Liker! 😊
I've created this tutorial based on theoretical knowledge rather than hands-on experience.
You can checkout the pinned comment where Jacob explained some of the points you've mentioned very thoroughly, I believe you guys are on the same page! 😉
I think it's very important to reason about these concepts, as folks who are just beginning their Unit Testing journey (such as myself) are rarely exposed to these type of conversations.
We see a coding example by our teacher/lecturer, we think we understand everything, but when it comes to implementing unit testing on our own - we just repeat what we saw, which was a very specific and narrow example, without thinking deeply about the process and how it manifests in different situations.
I'll just keep practicing and when I'm confident enough - I'll make another attempt at covering this concept on the channel... this time properly! 🙃
Every video you make and I watch (they are amazing btw) it proves exactly how dumb I am
The wayscript link to the code no longer works. Is the code available somewhere else?
Thanks for a video! It was handy for my project.:)
Could we spare the "if-else" and make it branchless with modulo?
Hi teacher, I developed a small system in tkinter and it is fine without any error, my question is:
How can i let it play a music when executing and closing?
Thank you
I think the easiest way to play music (.mp3 files in particular) with Python is via Pygame! 😊
I have a repository on Github that might help you with that:
github.com/MariyaSha/PythonMusicPlayer
If you're more into .wav files, checkout:
⭐ simpleaudio:
simpleaudio.readthedocs.io/en/latest/
⭐ or the Tkinter based tkSnack (I don't think it's officially by Tkinter, but it should be compatible):
www.speech.kth.se/snack/man/snack2.2/python-man.html
Best of luck with your app! 😁
Great introduction to unit testing. I really enjoy your content. Thanks.
Thank you so much Paul! 😊
As always best video 😉❤️
Glad you liked it! (despite not having any JavaScript involved hahaha) 😀😀😀
pls can u conver the now built-in "tombllib" module? looks far prettier, simpler and more readable format than csv or json.
I haven't had a chance to look into TOML files yet so I don't really know much about it at this point of time 🙃
If I see more requests I'll definitely check it out! Thank you so much for your suggestion, Carlos! 😀
Hey Mariya, what are those cool projections and lasers you have on you set-up?
great tutorial. anyway about 21:41, I just want to share a little cool trick. Instead of writing if else, you can just write it like this (it's applicable on any programming languange): abc[(abc.find(char) + 1) % len(abc)] for idx, char ...
pretty cool right :)
this trick is also good when you have to check if a list is just another list rotation.
Thank you so much for the great tip, Jacky! I'm huge fan of modulo! definitely a better alternative! 😀😀😀
It's just a bit more complex to explain to folks who are not very experienced with programming or math (and the video was long enough already hahahaha 🤪).
Conditional statements are not nearly as cool, but since they were covered in my List Comprehension tutorial - I went for one instead :)
Hi, Where to get that live bachkgrounds?
It's the Aura ROG Wallpaper, I install it via an application called Armoury Crate (it's an Asus ROG control panel).
I'm pretty sure you can use it even if you don't have any ROG parts 😀
i found another youtuber that you would make a perfect couple with !!
Too late, Manuel! I'm already engaged to the man of my dreams! 🤩🤩🤩
(he's far from being a TH-camr hahaha)
Hello, I love your videos about kivy)) I have a question: I will develop a mobile app and upload it to the Google Play. What do you think, can I use kivy or it is better to use java?
Thank you)
I believe you can do that with Kivy, just make sure your .apk file is fully operational before you apply 😊
On the other hand, Java/Kotlin is a bit more conventional when it comes to proper Android apps.
Kivy is great for creating quick and simple mobile apps, but if you're building something a bit more comprehensive - I would definitely go the Java way instead 😉
Best of luck with your app! 😀
Very nice tutorials, channel and a charming teacher . I recommend subscribing
Yet another great video👍
Yeeeey! Thank you so much David, glad you liked it! 😊😊😊
you are great teacher mariya
Today I enjoyed your videos on cryptography. But for security encryption techniques divide into symmetric and asymmetric encryption etc.
One of my favourite computer science topics is cryptography! I would LOVE to start covering it on the channel 😀
I'm hoping to see lots of comments saying "Mariya please cover more encryption algorithms" as I think I can simplify RSA and hashing really well! 😉
I'll probably start with more symmetric stuff (probably the cipher from Edgar Allan Poe's Golden Bug) but the goal is definitely the highly complex asymmetric algorithms we use nowadays (everything else is interesting, but quite useless hahaha 😅😅😅)
@@PythonSimplified Mariya please cover more encryption algorithms 😀
Thanks a lot 👍
Absolutely! enjoy! 😊
Amazing! Thank you~~~ ✨
Excellent ❤
Thank you Julius! 😀
Wonderful!!!
Great 👍👍
Thank you Abhijit! 😀
Very useful !!! Thank you so much !!! 🙂
I prefer pytest due to its non-oop nature. It's much easier to understand without prior oop knowledge.
I haven't had a chance to work with Pytest yet, but I did get a bunch of recommendations on it! 😉
Will check it out shortly, thanks for suggesting! (I must admit thought - I'm a huge fan of OOP hahaha)
It looks like wayscript has shut down. Do you happen to know of any similar platforms? I'm only now hearing about it and it seems like a really cool idea.
15:15 hahaha love it!
@PythonSimplified take a look to that spam!
watch out, some spam is trying to impersonate you.
why my first law return ok ?
Amazing 🤩
I enjoy it when I apply cryptography in real life for example internet of things IoTs security cybersecurity and block chain etc.
Ali, why do I have a feeling you're using Kali Linux as your operating system? 😉
(me too!! but on my laptop though hahaha)
@@PythonSimplified i am using Linux for cryptography
How can I work for a company by learning from your videos?
Hello 👋👋👋
Please make a video on how to connect kivy with emulator to check how our apps look on mobile device
Thank you for your request, Morgan Freeman! hahaha
I'll get back to covering Kivy soon, will definitely keep the emulator in mind! 😉
Hi iam a sub. How do you do these
Thing is there any suggestion for book for python,ml,dl
And data scince
Hi Yo! :)
I rarely read books as I mostly learn by example, but my university (UoL) works with:
⭐ Python for Data Analysis by Wes McKinney
In terms of Machine Learning, checkout:
⭐ Deep Learning with Python by Francois Chollet
I've read a bunch of it, and it's highly recommended by a long time subscriber of this channel (S M Ali) 😀
I've been watching you for a few seconds and already fell in love ❤❤❤
Like your content , you always make it interesting!
I didn't get to see your last vid till today, & so I don't know if you'll see this- or if ur into gaming or not, but I thought I'd mention a few programming type games u might like. (newest 2 oldest) {All are available on steam}
Robo Co. (it's a robot building/coding game that lets you use actual python script in game to program / enhance your creations ;)
Autonauts vs Piratebots
Autonauts
(Use Obj & code-block style programming to automate tasks for your robots to ultimately create an autmated metropolis for the human colonists)
Nimbatus (design & build your own ships & ultimately create & program dromes to mine asteroids & planetoids autonamously)
Factorio (More of a factory building/manufacturing game @ the outset but later you can program drones, train loading/unloading/delivery & tons of other stuff. I have seen some one program the equivelent of an A.I. to decide where to & how to, deconstruct their current base & rebuild it section by section in a new location while fending of enemy attacks without any human intervention.)
Space Engineers (the oldest of these- it came out in 2013 has low system specs but still looks nice- & still has new content releases every few months. It could be considered as a cross between Lego Designer & No man's Sky, Eve Online & the X- Series )
It lets you build & program ships, space stations, make ammunition, weapon, mech, or cruiser class+ ship factories that u make fully automated right down to what info from what components, sensors etc get diverted to what in-game display screens, lights doors etc.& then ship them to stations or the frontline for other factions/players to buy)
This one is currently on sale for 50% off all versions & DLC I picked up the Space Engineers Ultimate Edition
($34.44 w/tax)
It includes:
Space Engineers,
Space Engineers - Deluxe,
Space Engineers - Decorative Pack #1 & #2,
Space Engineers - Style Pack,
Space Engineers - Economy Deluxe,
Space Engineers - Frostbite,
Space Engineers - Sparks of the Future,
Space Engineers - Wasteland,
Space Engineers - Warfare 1,
Space Engineers - Heavy Industry
I'm definitely into gaming! You've seen my PC hahahaha 😉
Thank you so much for recommending!
I'm more into shooters like The Division 2 or open world games like GTA and Red Dead Redemption 2 - but will definitely checkout Space Engineers, looks very promising! 😀
@@PythonSimplified Honestly didn't think u'd read my post- two others you might like are From the Depths & TerraTech they are much more open world then the prior ones I mentioned. Hope you have a blast! 🤖
chr(ord(char) + 1) would be much better ig
Wow!!! What a fantastic solution, Krish! absolutely brilliant!! thank you so much for sharing! 😀😀😀
This skips fetching the alphabet altogether!!! I wish I thought of that!!! 😉
Please check it out folks:
message = "banana"
encrypted_message = "".join([chr(ord(char) + 1) for char in message])
print(encrypted_message)
@@PythonSimplified lol yea...
I think you mean: chr(ord("A")+((ord(char)+1)-ord("A"))%26) which would work for all uppercase letters, not just "A" through "Y", as "Z" fails.
This is fantastic! Though 'z' becomes '{' (not 'a') and 'Z' becomes '[' (not 'A'), everything else works. Fantastically succinct idea. :)
Flashbang warning at 4:14
I landed a segfault! woohoo!
Beauty with brains ;)
She is so awesome
👏👏👏
Nice approach, but you do know you shouldn't write list comprehensions that are very complicated. You should respect PEP8 also.Beautiful is better than ugly.Explicit is better than implicit.Simple is better than complex.Complex is better than complicated. Flat is better than nested. Sparse is better than dense. And most important ....readability counts.
TDD is more than unit testing
Looking forward to more AI stuff....
I'm working on a brand new AI Simplified series (while on vacation) 😃
a bunch of absolutely incredible tutorials are coming soon, so please stay tuned! 😉
Sorry to say but that List Comprehension breaks my heart. It is way to long and has to much complexity.
When you add too much complexity to a list comprehension the readability goes down significantly, so next time just use a normal for loop.
Try to follow the PEP-8 or the Black standard. If you follow one of these standard the maximum line length is 79 for PEP-8 and 88 for Black.
On no! I didn't mean to break your heart GredField!! 😊
The thing is... List Comprehension has a HUGE benefit over for loops in terms of speed!
Checkout the beginning of my zip vs. range live stream where we compare the benchmarks, I think you'll be very surprised to see how much difference it makes:
⭐ th-cam.com/video/Otr6BW-uKFs/w-d-xo.html
In the end - it's all a matter of personal preference.
If readability is more important to you than execution speed - you should definitely go for a for loop!
If functionality/time resources is more important to you - than List Comprehensions is a better way to go!
I don't think there's ever a one-size-fits-all solutions when it comes to programming 😀
Since it's such a dynamic field that changes and develops overtime - I don't know if restricting yourself to a pre-defined set of rules that somebody else wrote for you is the best way to explore Python to the fullest extent.
I think it's more than OK to experiment with "unconventional" routes. I mean - how would we ever invent or discover something new if we keep repeating somebody else's practices? 😉
That's just how I see it... it might not work for everyone, but that my take 😁
How often in real life do you have to deal with a problem that is as trivial as this one? Those are overused school cases and are completely agnostic to reality.
When you learn something new you need a simple starting point, you can't just jump on to a super useful startup idea right away! 😉
Once you understand the general concept - you can then implement it on more complex real-life projects and take this skill to the next level.
I try to focus on helping people, in particular beginners, understand ang gain confidence + motivation on their programming journey.
I've called my channel Python Simplified for a reason (otherwise it would be called Python Professional or something along these lines hahaha 😅)
@@PythonSimplified I thought the example was sufficient, but a little too trivial which led you down a few misleading paths :)
I hate TDD with a passion! I recognize how important it sounds, and blackbox testing is great, but in my opinion TDD leads to far more complicated sphagetti code cause your sole aim is to satisfy a test. Just take a look at the final code in this video. It takes a nice clean algorithm and makes it almost unreadable. Also, as others have pointed out, the implementation in this video has some issues. I would even go as far as to say that you never tested for the existence of the encrypt function, went straight to it's output, this breaking a TDD law (OK, this is a bit of an exaggeration, but so is my annoyance with TDD). Anyways, still a great video!
The first test you wrote is NOT a unit test. It does not test anything, there is nothing under test, it's 100% totally and utterly pointless. You would have been better off obeying Rule.2 by putting pass() in the unit test.
Checkout the pinned comment Paul, we've already discussed it with Jacob 😀
I can sum up why I hate unittesting and tdd in one example.
Guy comes to me with his code. He can't figure out why it keeps failing the test. So I check his code and there isn't an issue with the stuff we needed. So I look at the unit test. It was the test that was bugged he wrote.
See the stupid part about unittesting is they forget the test itself is just more code that may need debugging. So what are you going to do write another test to make sure the unittests aren't bugged. Well maybe that code is bugged so you should write more stupid test to check it.
TDD results in programs that can in some cases perform a function well but it doesn't work well when you are trying to develop software to do what someone wants or needs. It also just bloats adds way more work.
35 years I have never gotten a single thing useful out of it. So I never used it myself. I won't work for an employer that demands me to use it so never had to myself. But I've held other people over that time with their code like the example above and it has only been problematic never once useful.
If you want to do testing do it at a system or functional level. Even I do that. Lets say I am writing a compiler. I won't test at minor levels of code like you are showing. I have base code I have used for decades I know works so unless there is a compiler or hardware issue there is no point testing it till the end. I'll write something on the level of the interpreter or assembler and test it.
Or I've been working with game engines a lot in the last decade as well. You can break those into parts like graphics engine, physics engine, sound, resource manager and so on. I test at those levels.
Just to be clear I hate bloated code I'm a minimalist and performance junkie. I like small code the less there is the better. Two reasons it will usually perform better secondly there is less to debug if there is an issue. I can get it done faster if you need a 3rd reason.
Kent Beck tells why TDD worked for him. He says in a video he had trouble focusing on larger problems at once. He has anxiety issues and wanted a way to be confident in his code working.
To bad he didn't realize his unit tests are also code and what if he wrote those wrong?
I think while someone is in college just learning to program it could be helpful to some. I don't belief it should ever be used in a business or production environment. Most my programming has been in the industrial fields power plants nuclear, chemical plants, fabs, ... Not once in that time has my code been linked to a failure or incident. If it had it would have cost lives. So I wasn't worried at the end of the day like Kent Beck if my code worked I cared if I got someone killed or not.
Wow!! Thank you for the incredible input that none of my university lecturers dared to share! 😀
We write all those fancy tests, we pass them and we think our code is flawless as a result - but what if our tests are flawed?? 🤯🤯🤯
I absolutely agree! I don't have nearly as much experience in the field - but it makes perfect sense!
Testing comes in many shapes and forms, unit testing is just one of them and while it is presented as a common practice by universities and collages - it seems to have very little real-life applications.
It might work well for a certain type of developers, but it is very time consuming and just as prone to errors as the traditional coding approach.
You're not gonna hear that from my lecturers that's for sure! Otherwise we'd just pass the exam and forget all about it 😉
Thanks again, Diconica Bastion! I really appreciate you took the time to share your experience with us!
Definitely this does not apply to C++, your test app won't compile. The workflow requires much more work. At work we do not apply it.
when a beautiful women tech you something it becomes v easy to understand thank you please mor videos
You are so pretty
Thank you dear! 😊
Im sick and tired of windows.
Boycot windows. Its all BS.
красотка)
Спасибо большое! 😊
Enter your secret message: banana
Enter your secret code: -100
output: 76i6i6
is this answer correct
I don't know but this video help me solve so many problems
Prof You know I was having a hard time installing QT 5 on the iMac the other day 🥲
drive.google.com/file/d/1ocd9KNNO7QCPt2HjIpBO-5ULfI5-8oNj/view?usp=share_link I had to see if ChatGPT could solve this relatively simple algorithm. It went the ord() route, but it fails on negative shifts and shifts outside the length of Unicode (doesn't wrap). Its explanation is also wrong as it says non alphanumeric characters will not be shifted, but they are by the program. I've found something like "encrypted_message += abc[(abc.find(char) + shift) % len(abc)]" is concise and works nicely for positive shifts, negative shifts, and shifts larger than the set of characters you use (ie it wraps).