Inheriting a Sloppy Codebase: A Practical Guide to Wrangling Chaotic Code

Video in TIB AV-Portal: Inheriting a Sloppy Codebase: A Practical Guide to Wrangling Chaotic Code

Formal Metadata

Inheriting a Sloppy Codebase: A Practical Guide to Wrangling Chaotic Code
Title of Series
Part Number
Number of Parts
CC Attribution - ShareAlike 4.0 International:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this license.
Release Date

Content Metadata

Subject Area
In an industry where “lean” has become the mantra and rapidly iterated products imply tight budgets and tighter deadlines, how do you effectively take ownership of someone’s hastily written Django code? In this talk, we’ll dive into a step-by-step process for dicing up legacy projects, short-sighted prototypes, and plain ol’ spaghetti code to turn them into codebases you’ll show off with pride.
Point (geometry) Rapid Prototyping Slide rule Link (knot theory) Divisor State of matter Multiplication sign Drop (liquid) Client (computing) Mereology Information technology consulting Number Product (business) Revision control Prototype Internetworking Term (mathematics) Computer configuration Damping Software framework Lie group Endliche Modelltheorie Software engineering Scaling (geometry) Software developer Projective plane Moment (mathematics) Sampling (statistics) Bit Machine code Symbol table Type theory Proof theory Word Process (computing) Film editing Computer animation Software Integrated development environment Predicate (grammar) Web-Designer Website Right angle Text editor Whiteboard Quicksort
Axiom of choice Suite (music) State of matter Multiplication sign Combinational logic Set (mathematics) Parameter (computer programming) Mereology Mathematics Envelope (mathematics) Error message Social class Exception handling Curve Feedback Electronic mailing list Maxima and minima Complete metric space Electronic signature Type theory Process (computing) Configuration space Text editor Right angle Quicksort Writing Point (geometry) Ocean current Computer file Electronic program guide Branch (computer science) Rule of inference Theory Product (business) Number Revision control Operator (mathematics) Touch typing Code refactoring Software testing Traffic reporting Task (computing) Dependent and independent variables Standard deviation Key (cryptography) Projective plane Counting Machine code Directory service Line (geometry) Human migration Computer animation Personal digital assistant Statement (computer science) Game theory Freezing
Complex (psychology) Suite (music) Cross section (physics) INTEGRAL Multiplication sign View (database) Equaliser (mathematics) Source code Execution unit Set (mathematics) Function (mathematics) Test-driven development Information technology consulting Fluid statics Core dump Endliche Modelltheorie Extension (kinesiology) Stability theory Physical system Covering space Email Software developer Keyboard shortcut Electronic mailing list Maxima and minima Bit Unit testing Type theory Data mining Category of being Data management Arithmetic mean Message passing Process (computing) Repository (publishing) Telecommunication Order (biology) Website Configuration space Self-organization Right angle Pattern language Quicksort Figurate number Virtual reality Point (geometry) Web page Mobile app Functional (mathematics) Divisor Computer file Connectivity (graph theory) Real number Control flow Branch (computer science) Online help Rule of inference Automatic differentiation Portable communications device Template (C++) Goodness of fit Natural number Computer programming Software design pattern Energy level Software testing Code refactoring Data structure Absolute value Traffic reporting Plug-in (computing) Metropolitan area network Task (computing) Form (programming) Module (mathematics) Home page Dependent and independent variables Focus (optics) Weight Projective plane Content (media) Database Line (geometry) Machine code Cartesian coordinate system System call Symbol table Quilt Human migration Word Computer animation Personal digital assistant Logic Video game Abstraction
Context awareness State of matter View (database) Multiplication sign 1 (number) Mereology User profile Mathematics Single-precision floating-point format Convex set Endliche Modelltheorie Physical system Social class Exception handling Email File format Software developer Electronic mailing list Sound effect Maxima and minima Database transaction Instance (computer science) Variable (mathematics) Type theory Category of being Arithmetic mean Process (computing) Right angle Pattern language Figurate number Quicksort Cycle (graph theory) Middleware Data integrity Writing Reading (process) Point (geometry) Trail Slide rule Functional (mathematics) Implementation Perfect group Observational study Virtual machine Online help Rule of inference Product (business) Template (C++) Element (mathematics) Goodness of fit String (computer science) Gastropod shell Energy level Module (mathematics) Dependent and independent variables Key (cryptography) Projective plane Database Machine code Line (geometry) Cartesian coordinate system Subject indexing Word Uniform resource locator Loop (music) Personal digital assistant Logic Abstraction
Point (geometry) Web page Complex (psychology) Game controller Context awareness Sequel Multiplication sign View (database) Execution unit Virtual machine Set (mathematics) Branch (computer science) Online help Client (computing) Disk read-and-write head Revision control Mathematics Goodness of fit Prototype Term (mathematics) Software testing Endliche Modelltheorie Error message Mathematical optimization Task (computing) Exception handling Area Block (periodic table) Software developer Projective plane Electronic mailing list Data storage device Database Machine code Symbol table Type theory Message passing Process (computing) Order (biology) Configuration space Video game Self-organization Right angle Quicksort Middleware
Computer animation
and it and this and that and so on very low quality it today and my name is Stacy
can think there are a bunch of links there where you can stop me on the Internet I and I a developer consultant from Fayetteville Arkansas by day I'm the president and chief factor of my currently 1 one-man consultant shot of labs and by nite I am the cofounder of the project called heapsort but which is a career websites and job board for full-stack web developers the status or sorry slides are available online at lofty laughs website so you can go there right now the built in HTML JavaScript so you can use in the fall on building some code samples and they can be of assuming here little contingent upon my 5 dollars Digital ocean droplet not crashing you all the people that I so before we get started talking about tax intersecting the code I wanna spend a moment talking about where sloppy code comes from I think the obvious place is an experience that's the 1st thing you'd say make sense we were all beginners at some point but but that's not what we want to talk about today I'm not concerned about that if if you're new to Jang on pipe on development and then in year here in the crowd today than you've done the best thing you can do which is to come here and you're gonna learn a lot over the next couple of days no I'm more concerned about the sort of sloppiness and that comes from things like an emphasis on development speed which encode out the door quickly strict deadlines so incentive to cut corners and there's also something I've noticed in my time working as a consultant as a contractor and and it's a problem that comes from it's it's a psychological dispositions the lack of long-term ownership of a project and what that does to the code that gets the liver and if you don't have long-term ownership you use incentive to make sure that the project is stable for the next person that has to hear this is a little bit off topic but but I I wanted to point out something as I was looking at this stage the short of a sweet spot between these 2 points number 2 number 3 lack of long-term ownership an emphasis on development speed that occurs within a concept but that's somewhat fashionable in our industry right now it stems from this idea of rapid prototyping the which is really popular but with modern frameworks because 1 of the benefits of modern frameworks is that on the long-term we can spilled something that's very complex and and sophisticated but in the short term we can build something is relatively complex and sophisticated without a whole lot of time he spent but this is something controversial because I think rapid prototyping is alive they don't mean that the concept itself is wrong and it's something that was my doubts about I think it's something that we ourselves but it's a lie that we tell ourselves it has everything to do with this word prototype what we call prototype because in the rest of the engineering world a prototype is strictly a proof of concept and those prototypes never she production this is a prototype Tesla Model S it now obviously this car is not driving on the highway them and and it never showed up on the showroom floor looking like that it's an inherent part of the engineering process when you build something physical that at a certain point of apartheid gets thrown away and you take what you've learned and you build on what you use in production when engineers build a new type of suspension bridge it's built on a very small scale obviously new car every drives across a model the size of the state but they take the 1 any the further out because you can't bend the Medellin create something new from it it's in here in the process and that's not something that happens in software engineering and I would be wrong to say that it's not a benefit to us a software engineers that we don't have to throw things out to go production we can the metal take what we have make it better and we don't have to start from scratch every time and while a benefit it also can be used very much to our disadvantage because it's not in here and in the process that a prototype stops being a prototype because in software engineering prototypes going to pretend production all the time because we use the word prototype always to our advantage it's not fast with some very efficient predicates apartheid the but then 1 day the client comes in if a leadership right now that deadline comes up and suddenly it's on a prototype anymore reflect word data next to it which beta just another word for a prototype that went into production right so I want this to be on the back your mind as we talk about the rest of the the topic today but you think about it because it's important to this is the only way that sloppy the software gets produced but is 1 of the big ways that I've seen in my career and so understanding where sloppy code comes from helps us to fix it because we understand the mind-set of the person who built it also helps us not to be the next person that bonds the version number and pushes the prototype out of production OK to work on a sliding based you gonna need some tools and you need to be familiar with those tools the 1st of which is a good editor were integrated development environment and there are tons of options here so but what we're really looking for something that offers code navigation tools so being able to quickly move around a project so that's really important when you get a new project you never seen before being able to highlight a symbol neatly go to where it's defined and I'll help you learn where everything lives and then beyond that we have code introspection and this is where
your editor has a Pythonic understanding of the code you're working on and you get things like code completion were being able to work with a model and call 1 of its methods and and see the signature looks like no all the keyword arguments that that that method except that's a huge class working with unfamiliar code and lastly refactoring tools which is anything stronger than just a brute-force find replace across a bunch of files being able to find methods that you would change in introduce a variable to them and tools that let you find everywhere that it's used across the project you not just blindly changing everything or manually doing 1 by 1 OK so there's a pretty broad and at that there are a lot of the a lot of tools that they give you all that more I personally my job and I think it's great there's also pi which is built on eclipse of Emacs who uses the max so regret that people you enthusiastic about you max error I and I understand I don't personally that but like it can literally do anything you can you file your taxes with the next so if you can stomach the learning curve the is another everyone 1 you're going to need to be familiar with the the black and know that the but to doesn't count that's not the type of the bi-gram talking about talking about a full debugger but if you're not familiar with 1 then you need to find 1 and and just get familiar with the basic operation that I'm not an aficionado of the borders I use the 1 that ships integrated with my ID and there's PDB IPTV could we much any combination of letters P B B optionally 4th character is a legitimate I think about and improvise points like is that have that integrated with your IT rather than just running it being of a set of breakpoints as you editing and that's going to be really crucial the you're going to know how to use coverage that pi and which is a tool for checking test you run your test we and it tells you how much of your codebase was exercise the it's so brazenly you just run a testament of coverage this is sort of my go to starting point for a coverage configuration encourages the file that that tells coverage to check everything in the current directory envelope and omit things like migrations was the files settings files things that are normally some exercise by a test suite to that would arbitrarily bring down your coverage report any generator bought it does your files the statements right how many more minutes if your % theories and then companies this pilot and Pepe and these are both tools to help you the actual writing for writing code so pilot helps you clean up poorly structured code it's really useful during refactors of at if you're not familiar with that they that's the Python Enhancement Proposal number 8 which sets the de-facto standard for Python style guide stylistically how Python code is written and then at a lower case is the Python package that looks at your code and tell you when you break those rules that they will keep the code legible it has 1 major caveat that is it'll make you irreversibly about Python code and you will become intolerant of not that they could and and and it's it's worth it because you in the writing good-looking coding and that when you have that stand in place of you know that the next guy of will will be other read what you've written and then again having these integrated with your and your your IT but it really helps it's better than just running against a code base you get the response the feedback from these tools immediately as you're writing which is very helpful OK you've just gotten your hands on a sloppy code that you've been given the keys to version control and you start looking for it and your immediate reaction is going to be a start hearing part right you're start digging through the code seeing what you've got yourself and business the things you hate anyone changes don't touch anything at this point everything in the project is a lot of and you attended they'll come last year so I gave a talk about how a lot of well collimator appears in that when I was a kid I play a game for some other the touched it you will not so don't add anything yet 1st you have to do some prep work of 1st thing make a copy of the code use your choice check out a copy of the ranch as it stands when you get it moving to sever branch this makes it really easy to use tools like death and as you're making edits the code you have we the we delete something that you need batteries see where Italy work and you can do that quickly on even better when it's all said and done you can get a list of how many lines of code you change and use it at your badge of honor so and they wouldn't get the project started at the beginning we're not touching anything Our goal is to get it running in its last known working configuration according so you create a virtual market don't attached at their disposal if the project ship to the dependency list use it Belisarius sometime otherwise you don't have to manually figure out everything they need and if the project shipped with testimony blessing and try to get them running but keeping in mind that if the product really is in a state of disarray there's no guarantee that the test suite that you were delivered was actually passing in the last known working configuration so if it shows you configuration problems that would be helpful but we start seeing logical issues obviously but failing task the better caused by the code itself failing then don't spend too much time with year you had this is tested through the mount later and then be sure to freeze any changes you make you can remove any dependencies at this point but if you add some work there was an original defenseless at this point freeze that also the added to it the they're gonna need
test coverage before you get started but we're not going to go to crazy here we were looking for integration test coverage for high-level general concepts and we're looking for integration war unit test coverage whichever is most appropriate for low level and business-critical processes program and when I say integration test for our purposes and talking about it into end test the Python in general Our goal is coverage here we wanted to we wanna cover as many lines of code in the project as possible because we're looking for land mines were looking for things that blow up unexpected we wanna see that we make every factor in this component it didn't break something in that component over there were essentially automating the process of putting on every page on the site and making treated and given him as automated smoke test and this is the type of test that I'm talking about an example of how the and this is from heapsort and in this case we're testing the home pages anonymous user were just In the page checking the status code 200 and I like to use this assertion for this kind of task but to make sure that the appropriate template was loaded sometimes use can construct their own responses sometimes they can return the output of another view so I make sure that the user is kind of seeing what he's supposed to see and notice that were not checking any data on this page without checking to make sure that the appropriate things were rendered their was sure ended up in the right place and there wasn't throw and this is for anonymous users so when you write these types of tests they're very quick and easy right you have to be much but you do have to catch every user pass so if a user is logged then you would want a separate test for that and he saw we have 2 types of users we have our candidates and we how employers so this pretest and heat source for everything like that if that have the view implements a form you want test at and post to all of the user paths for every view but very simple test therefore unit tests are goal is not full unit test coverage that's not something that you necessarily have to strive for at the space because as you go through rewriting on the sloppy code you can indicate the work that you do writing unit tests that you can take testing is far you want you and if you believe in test-driven development then then go for it and then you will want you this but it in my opinion is that I'm not a test-driven developer but I know that I'm gonna write unit tests and then have to throw them away as a rewrite the code instead we wanna focus unit testing efforts on core components were accuracy is critical this goes back to the business critical processes as an example of that type of unit tests but we're looking at I never tested heapsort we sell job ads on the site and after 30 days those ads expire that's business-critical tasks that's what I'm forces the value that so we want this type of test to make sure that it that and had no longer shows up on the website after 30 days and that's enforced with a manager never manager here the active job in nature but this isn't the purest but example of unit test they were still invoking database machinery and all that but that's OK we're not using the test point we're not doing this for the page level down were specifically testing a real figure 30 days and making sure react properly that's the type of unit test you should strive for when you 1st get your hands on a project like so how much is enough integration test coverage for all j of using user pair management commands a really easy to test you just import called man and call but potentially third-party API is if you can do that with the test time we unit test coverage for business-critical processes and other logic it says non you really non testable with making test so that's billing process you tried people money to make sure that not only getting a charge with the charge the correct amount and only once transactional communication in here of projects and e-mails or otherwise notifies users that's business-critical asynchronous task again asynchronous test defined more than likely that's business-critical it's that something you can catch without writing intense and were issued for 95 % coverage I think that's the ideal scenario means more is better but but that's the point that I would really feel comfortable about moving on from current of 90 % is actually pretty easy in most projects especially right really brought integration test like the examples that I gave up even medium-size project 1 into developers can get 90 % hesperidin a couple days at most I'm writing that kind of test so issue for 95 % and no individual files and have to have 1 file out there that strategic coverage that's not good enough we want that level of coverage for all the files it's not as hard as it sounds and then and only then is it time to start hacking on the project and you're going be really happy that you could plot the time to put this test there's no telling what you're gonna find you 1st your hands on this type of project and so this is not an all-inclusive list obviously but what follows a sort of my greatest hits if you well of design patterns are any patterns that I've encountered that working as a consultant the 1st type is by calling the patchwork quilt of dependencies pattern this is a real death for a project I was working on just a couple weeks ago I removed up 133 external dependencies before I even got started and everything like the problem with the third-party dependencies is that all of them introduce complexity whether or not it's good to use 1 is just a matter of determining at the ends justify the means of each dependency is going to be a potential obstacle to upgrade but imagine if I decided I wanted upgrade from day 1 5 2 1 6 on the project and the test 133 unfurled abilities make sure they were all doing 1 6 compatible and we have a project like this the project ends up being a lot of configuration it just makes all these different things work together like a system of plug-ins in that set of any sort of low-level general extensions often conflict with each other they make debugging a nightmare I you go to look at some process something simple seems we're going wrong it turns out there's 4 5 layers of abstraction between we thought it was coming from where you want to be and that's a pain and lastly but third-party modules installed from BCS get have things like that that make no stability were availability guarantees so you're just going somewhere especially if you just pulling the master branch of some repository out there who can go in any day
and it can disappear to mark thank you as party so you went from the back I in time you get project you ordered dependency remember that virtual environment that we created in that wretched elect you start up you install the absolute bare minimum requirements that you know you need South you know obviously GenGO and core API the you go through the requirements list you either of data created and you get all I each 1 1 by 1 researching in exactly what they do why the use how words and then that's gonna put into 1 of 3 categories due totally unnecessary or not use so 133 dependencies are removed 80 per cent were installed on even integrated so there's really easy to get rid of weight off my shoulders so there they can be potentially unnecessary you feel like that's something you could get rid of it but you know you have to rewrite some of the code in order to achieve that you make a judgment call at that point if it's low enough effort he made do right then or maybe it's a part of and some larger refactoring task later you you wanna get rid of that dependency you're going to rewrite the model that uses anyway so you come back to it but make a note of it and lastly you'll find everything that turned out to be necessary we those invites hearing test so the task help you to make sure you've got all the dependencies that you absolutely need involved and anything you removed wasn't actually necessary if you miss something that has that you know you go back to the previous step and you wanted that dependency same rules In this and tell all of you test passing and now is the best time to actually of packages so 1 of the things I said that was a complexity introduced by the disease they block upgradability at this point your project as at its all-time low of third-party dependencies the least amount of compatibility issues to the time traveling Django pretty packages for human go upgrade test repeat this pattern the monolithic of death monoliths or an organization like we were talking about 1 giant Django application that contains all the functionality in your project the problem with that is you can't succinctly evaluate the functionality of any 1 component because you have to dig through the functionality of every other component that since there alongside and for the same reason nothing's portable can't pulling these things out into their own model you can use them in the project if you want open-source them it's full of the import star that I heard someone someone printed out there and don't blame you because the I have no idea what I just important and when you have everything in 1 giant application what kind of makes sense that you do it because every view is in 1 file and every form that gets used by the needs to be important that file to do it but it's really hard to take this apart but I'm a good old spaghetti code I have no idea what depends on what so to fix this you create the same have structure obviously and 1 of the other really big benefits to building the test suite up front is that at this point you have a really good cross section of how everything the project work you force yourself to do it as you probably if you have a model unions have already determined you've already been thinking about how you would restructure the just implement you get rid of those import starch pilots really helpful here features removed them pilot reports back to you every symbol that's being called in the file that hasn't been imported and then you turn those in static list of imports so now you know where everything's being important you migrate models to the new applications I found that the best way to do is to move the model and everything else sort of follows you move the model every form that depend on the model now can't find it or you know you change the import you remove the import of the model pilot tells you which forms were using a model you moved the forms every year that depend on the form is now reporting that it can bind form you reviews and enabling this process if you think you've lost something where you wanna make sure you don't miss something that you need to move here in the test no my very models across apps happens a lot in these were of patterns but it's kind of a pain if you're pre-production you don't have any data in real life out there in the world and that has the migrate to squash the migrations start over it's worth it otherwise he to migrate data across if you using South go here yeah StackOverflow usually something I find reactive I go there after I have a problems like 1 thing that I keep bookmarked at all times because the great answers here in Austin discussions techniques for using South to move models across easily preserving your relationships preserving things like content types to the things we don't think about that have to change in order to move from 1 at the next the labels object it really is self the genome migrations I have had a lot of opportunities to upgrade projects to latest receiving of using new migrations but it seems like it's a little bit of a challenge for my research it looks like you can start doing things the old-fashioned way creating copies of the models and manually writing migrations move unless you are comfortable writing Ross equal new migration so far the pain but has done now we have the every model is that which is like the exact opposite of the model with it causes the same problems so and it's another organization alignment it again you can't succinctly evaluate the functionality of any 1 component because all this functionality is distributed across the entire day again nothing is portable you have a different type of important well this cyclical import women never had to deal with that cyclical imports it's like 1 of the worst problems I think to have to solve but a make sense because if every model is a walled garden and at some point you have to interact with each other at some point this app is important and have and the other way around inevitably this happen if you do the same things here that you would you with a model so same challenges you gotta rebuild an organized structure and move move the models across everything else turns the fall good is less work probably because some of your apps will host the others units so as to move every model I guess my point there is that between these 2 design patterns this is the 1 you'd rather get and then you
have removed 1 receivers everywhere the Django signal dispatch system is so powerful and useful but because signals allow us to decouple models which initiates side effects on other models especially in 3rd party code the easy example here but is user profiles right for a lot of us that have come from Dalian before J O 1 5 I would say I'm probably the 1st signal we ever wrote was 1 that created a user profile when controlof user was pretty and signals are great for maintaining data integrity when the changes here i need data to change over here otherwise I was data integrity there's a reason why most of the signals that ship with Django are built into the or em model machine preset process but they're not always useful i'm because receivers can hide important functionality from developers by especially you in hearing this project there's probably stuff lurking around and signals you won't necessarily see and they become unnecessary types of abstraction between 2 models in the same application if 2 models are in the same application models that file what need is there to couple them the signals and they can implement overzealous business logic logic that belongs to the views but occurs at the database level when when things change in your she will be on the lookout for signal receivers there i between 2 database related models talking about a database relationship foreign key minimum joint for signal receivers in which the instance simply operates on itself and because in both of these cases the logic really this mean here preseason process those those are your receivers but you can do this in the model definition itself because it's a matter of data integrity it belongs here there's a reason why the model can change a property of itself has access to all of its relationship so you can do that here and there's no reason of there's no way for it to actually be hidden from when I look at this model I know what happens when it gets sick and then what you really wanna watch out for is that the business logic and ultimate database transactions my user transaction user clicks a button some side effect happens that doesn't belong and signals I've seen this happen in 5 or 6 different projects OK this this is a signal receiver that sends an e-mail and there's a special type of terror that only happens when you're playing around in a Python shell and realize that you just send out e-mails to every customer in your database so don't do that I don't right here this is then this logic right we we don't want but the we want to build a system where like you can't you know around in the or without fear of some side effect happening this is like a unless you are in the business of building a product and your value added is we will send you an e-mail every time did a job that that then don't do this so look for that when you get a study project the point is to go track down all the receivers yeah they don't need to be rewritten you wanna find them all because logic can be moved away from the model that initiates by these receivers can be registered anywhere so go find them all and make sure you're aware of everything that happens everything is like this kill a fire I can't think of a better name for this
pattern of because they are cool their so powerful there's so much you can do and there's something kind of special that it's a feeling you get when you like I I designed a system so that has it is sophisticated enough 2 1 using middleware to implement something that's kind a cool feeling it reminds me of when I discovered list comprehensions in Python the bank and for like 3 months I just resolved to never right for loop the traditional there yet 1 line so cool because it was they are a list of renewable power point just 1 usable time and I think that's part of the mentality of white contacts processes and middleware gets so widely abused so context processes can impair performance quickly here Running logic often database queries at every time delegates rendered and it's another place were where business logic heights so you're looking around this template you don't know where this context is coming from it's not view it's hiding a context processes you should evaluate your contacts processes when you get a slightly projects and see if the logic is better suited as a template tag this is common when you have but common template elements things like data that gets presented in the header and footer maybe gets included on the base template seated on every template they gets rendered it seems like so it gets the context of now you can't build it and what that doesn't have access to the state of New get 10 contigs processes they can conflict with each other this is a great time to use Simon tags perfectly states change into assignment and use on the template in the same way but now you can build other templates that don't so we have this logic and there's less there's less stuff piled up in your context processes of there's also a context processor logic should just be refactored interviews so this is much more efficient use of a convex processes me maybe it gets used in 5 different views and for whatever reason those 5 users live in different applications but but this is a perfect use case for class-based view created based plaster makes sense on an even if you're not using class-based the real I can move it into a sort of a neutral location important you so what modern context processes middlewares potentially the more dangerous because it can run on request and response cycle and you can really modify things that make bizarre changes is already you when you don't expect them right you you can mess with the requests and responses I don't have examples Protestant it because is so powerful and so much you with a whatever middleware you have will be esoteric to your project but the question ask yourself with do I need this logic to execute on every single request and or response it's important or maybe even better doing this logic to execute when Google bought it comes to the project thank you if you don't need it when the light comes there's a good chance you should engineering where this is the pattern this is this is the absence of any sort of pattern good old undocumented code I'm not talking about it in the ship with read me I mean there's is not a comment in the whole thing OK like what is that you know if you can see it the following with the the slides you should be about you will only have like is ambiguous variables we have classification classifications level class level and string were accessing the intervals like directly by explicit index I have no idea where this stars and there's not 1 line of commandeer year did kind of help me out OK the only thing worse than cold like this with no common is called like this with just enough comments to pursue that thank Richard addiction I thank you for that and this is a systemic competition within a drawback with her in the this really easy way out of 1 document those and you can try brute-force your way through and say like Gilligan gonna assigned to 1 developer i he's obligated to write documentation for little whole project and we were rich try knock out once I had some practical you're going to be reading through all of this coding way to document as you go and they get policy understand document minutes ago the rule if you had at the code the document if you have to dissect some code like those example we showed and to to understand how works you're going to do that we write has probably been you have to write comments about letting letting others know if find so for every module function method class you write adoption no exception you never really stupid ones sometimes I have but if you get a habit of always writing 1 of them that covers like most of your documentation afferent these are the workhorses so at the very least when I look at a class when I look at a method or a function I know what comes in and what I can expect to come out like the previous example long multi-step logical Frege's where data is being transformed in 1 way to get 1 format transformed to another inevitable you'll have to read through that figure out why it's doing and we need you leave a comment letting the next guy no letting yourself the when you come back you'll forget how words break apart of comments if it's difficult to read where there's ambiguity the the common the and then of a
list of other things to be on the lookout for not patterns in of themselves but cepheid to find everywhere the Hi good yours on you and I wanna try and remove those before you do any writing 1 of the of the movie views around the project without all of test breaking broad Chinese at what's OK try pass this is not PHP we don't have a silence all areas symbol for a reason the and even just try all exceptions unit doesn't pass if you catch every type of exception service-specific 1 at some point you're going to silence a more helpful error in order to raise a less helpful so be very specific With traits blocks we talked about the CS requirements earlier fought those whoever owns the project should have a fork of that so if you're in the long term owner 14 you get repository if the client is long-term wanna make them create get have organization OK they can have their own it'll never go away they're in control of it if the original branch of the original project gets updating pull those upstream changes and but now the sort of the the masters in controlled watch out for misnamed concepts encode and this goes from everything to from typographical errors like misspellings of 2 concepts that totally had the name change bite the bullet and renamed them and don't keep using them with the wrong name because it just gets harder and harder as you go of the what i have big regret I worked on a project for like 6 months and then we have this concept called boost and at some point 4 of business reason that concept was named to the end user easy book and then shortly thereafter a pass the project on someone else I never had the chance to go through electrode and I know that poor guy was like she's tasks assignments like we need a big easy but pages and he went a code and it didn't exist and what the hell is all this boost so we those things it it makes life a lot easier when you get sloppy code you realize that stuff like this is what made it really sloppy in the 1st place all the time someone just didn't do the due diligence that to rename that the printer configuration i we talk about premature optimization a lot in this is sort of a type of it and I've gotten code that never never laughter developers machine of and never had a real work done it wasn't anywhere close to finish but with preconfigured use like like 5 different key-value store back ends and no sequel databases and celery we had no requirement for asynchronous task but was all there and if you need that in place it always ends up getting in the way it gets no way we tried you deployments sometimes the developers will override I really obscure settings that you don't expect to have been configured but and and so weird things like that come up the point is don't be afraid to throw all that out and start afresh configuration really sloppy project and you have a copy of the original code you can get it back to the point don't being head against the wall I if you have to so just to recap right
test version all dependencies introduce complexity to review them organization is important my list every models and there's a sweet spot in village it's it's a broad area but you would be somewhere in there check all of the signals and receiver in the project make sure you know what they do same thing for context processes and middleware bad stuff usually hides the and document the code you go the lastly don't do any of these things they handed off to someone else because it's just a prototype they get
it and it is