Add to Watchlist

Jython in practice

48 views

Citation of segment
Embed Code
Purchasing a DVD Cite video

Automated Media Analysis

Beta
Recognized Entities
Speech transcript
and
and so on and Frederick will be on giving the next talk about using Johnson in practice so these looking for group B few thank you yes so I will be talking about objects and practices and go through some examples that I could be quite quite simple for compliance what company but I'll start just obligatory
a bit about me uh I mean the use of the contractor do do not apply can work of done lots of job work if you count the years now incentive Dunmore more job over work from and that during the years have also used uh joint from in the corporate environments for different reasons and considerations uh and it seems that in the pipe the world we I don't do this in not that I know something trying to market it more or less as a way of making your job was to more enjoyable and but software developers and all the on and nobody will remember any of of the adult men had the hoped-for for remember me is that I live on a boat
I am not necessarily appearance of of lives about and if you think that would be hard you should also consider this is the view
from my office so the
archetypical ji from interest you download the job you can run it or if you are around the story just to drive on and you get a python ripple the main difference being that you also get the JVM information when you start up and you can do in world uh a little bit more interesting is that you can also import stuff directly from Java and then you can printer lower again or as an and 1 thing that's really interesting if you haven't seen it before is that in this rebel you have full introspection capabilities from part into Europe
Java code uh and this means that you can actually actually used Oracle to uh to explore job code to me this is a huge thing because I spend lots of time in the apple while doing an exploratory program in the beginning of products and so on uh basically would spend so much more time if I didn't have introspection for or of course draw has introspection is just nowhere near as convenient so my 1st
example will be the 1st time ever I go against the general wisdom and alive general stage because doing so let's this sometimes useful because you can and can't shortcut away the entire edit compile test deployed loop that you get when you do so let's and it's also really really convenient so show you how much work
needs to be done by have downloaded the latest version of Tomcats also downloaded the latest version of dry and put the jar into uh lives folder of Tomcats and start server and I created a new sort of common and used still have created get out that's quite a few actually that's the only thing I've done is to create a folder with a web in which is the configuration process lots of components that make it a very small and that some this is basically a written right of out of the drive from documentation because just come sit with this servlet which basically is the only thing you need uh to job about compliant servants and a set of mappings that says it all apply files pass them to the side and then to implement actions have looked at this as easy as creating a class with the what we have to get the so as opposed to delete so on as which gets request-response objects and you write about what you said headers just like you would be an enjoyable and what you 5 then so this is all that needs to be done those 2 files are working in Python code in uh OK so doesn't
change so let's face it this park if we rely on the page this
is part of this is a bit faster than going to enterprise John obligations normally especially if you go beyond and Tomcat then and the other thing is that worth noting here I won't go into more detail here because this is so simple that something that is that if we do something in yet yeah 0 sorry i and sort of course 4 so that don't have questioned the other actually I think I just broke should I used to have some of issues that the note that and this account for some reason but but what I wanted to show was and there is no error function on the on like I can't hear what you're saying so we call this long I I don't which you have the time sort that but I
introduced a syntax error into the code and we wanted to show you
is that even if it's in the Python code syntax errors we get perfectly understandable stack traces dried and it's actually really good you do get the Johnston trace which is this part but on top of it you have the same as
uh part of the error messages when you do when have service so any other runtime errors uh and this is really convenient because not all of the calls this you this much information so I
will not talking about solids
because they're so easy however embedding diphone is a more general case that you want to do something complicated in jobs which is simple in my for me this has been mainly operating system integration because to do the same things you cannot the box the and library will all funds have you download lots and lots of files on third-party libraries to do community uh you can also embedded uh John food to build the rapid prototyping which is 1 of the 1st things I have did was done on uh and it a bit more complicated than doing it the other way around calling job from dry from this that's naturalists writing Python but calling taken from John if you do read the tutorial so they show you some really simple ways of doing it which you will that will then have to replace so this would be your typical in society and bright code where you need to actually take care of getting the types right uh from job so what you can see here is that we create a model to run the program code codebook when we instantiated or a class rather uh when we instantiate we create a new Python interpreter we execute the imports it's to hold the python code into that interpreter and then we get 2 . 0 uh to the Pi function and so that we can call it and as you can see that when we do call it uh we use the donor because any point object can be called we could have used in the boat suppose instead here uh but this would be the general case and we need to telling what types we found we need to tell them what types who want to return of course because this is this job well and and of course we need overloading and so on uh want to have different types and if we compile this file and then it gives you the square 2 and 2 . 0 there has to be applied on the part of this has no job Pacific and actually so it and but everybody does this example moralists when they do if I justify the pirate uh see types for example has this time thing but that easy it gets complicated when you're trying to do some stuff with arrays and custom data types and so on and it's also the case with dry so the 1st thing I ever did in job was this the more complicated part of optimizations prototyping and then calling throwing their race into I can't really simple getting the results are out in the coming it trickier as you can see here uh I don't get an array that get iterator over high objects which are then needs to individual cost a lot maybe Bracken there's something else to make it easily accessible from a proper job of perspective so normally you would want to you could use some kind of a pullback so that you can push data from triphone into job instead of trying to return complex values actually 1 way of doing this a scripting uh a discreet integer job this possibly easier than straight up and that and it's really convenient way to add scripting because drug-control to integrate so if you want to allow a user or administrator or whoever was not doing our job of holding the ability to make a choice in this case and we can element to supply parts this could as easily just be a source file is sent over the wire or whatever give me scripts for and again we important of course we if we had a soft find another way we could just tell to execute all of this this entire string which could be all of Python code the and we can call it and this is 1 way of doing the them shown here is that instead of trying to get a return value from the judgment of the diphone called judge will always return applying object which can be anything and a the ways of costing that into the proper time a C very complex for or expensive so what we do instead is that we let the pipe inside know about where to put the answer so actually do it a to get the answer and then we retire uh with description decision was just a static in this case to make the example even simpler and python code imports description costs it makes the choice and what's the what's the answer them so using a call-back pattern not to achieve uh acing asynchronous behavior but to use the fact that the easier to call into job off from majority on than the other way around so from this it works you too can add anything in there uh and it will work the envy last way out of using Japanese using diagnostic test that and this is the way we use just today a lot some code is really hard to test well and some things our are becomes really verbose and bright and Java so for a specific perspective we have the job on my prediction code running on several different versions of hardware and we need to test this code or other we need to test the application for resilience and fault tolerance and joy we have unit tests but they tell us the obvious things uh this function doesn't work that way we it doesn't tell us what will happen if the GSM networks so starts to report out-of-bounds values uh and 1st we were trying to kind of extend our unit test into some kind of functional testing seem jobs but we ended up with so much so that we got this suppose anyone has been in the industry long enough to have seen when you have the test cases are actually freezing the assignment because of so many tests and so much mocking that's the few changes in the test even knows nothing really broke and so we decided to do it in another way we have in Java land this device license the which basically lies right on top of the metal and let us ignore that
different former emotions is slightly different hardware and so on so we create the a impact we create a cost factor which create classes derived from uh this device handlers and was supplied with some saying default uh and that was applied with some default implementations of course to the hardware layer surgical it'll print it to the consul instead for example and this this way we have a hardware not which lets the application run and not do anything useful it stores data like the records I haven't shown in here but some costs of are recorded so we can introspect this device other objects in the and and we also added uh as the small snippets so that we can for every test we can get a new a new class specified for that test or replace some of the methods that we were interested in for the test so the way we use this space that this is a real tests that we have we suggest that the order of this is 1 of the simplest as we have uh that is the order updates that succeeds and it gets a person number that's higher than the current version number it should trigger an octet so what we do is is this get to the edge to the connection is where to get the string from the string contents of your which is used throughout the application so for the specific and uh version we just said returns crack if we we don't recognize the URL because of that you should keep on running in a way but if anyone's asking for the required version uh from the estate uh then always return 999 1 them so we create user factory to create a new device have with this the newly created replacements function or method really uh very set the update rates to twice the 2nd just to make it fast and we around the the entire application which means that boots from self tests and runs for 3 seconds and then stone and then we use the the no just checked the device and other that that method had been called that we were expecting and what this is a very simple example we do the same with and instead OK what happens if we run the application and then the connection to the server hands and when trying to run in the years to come rebuilt the GSM modem it returns the balance values because that Americans who have had and trying to test that without actually being able to run the entire code and to introspection on it is really hard uh and on the matter of finding weird behaviorism bugs this the MOT data handlers predatory devices with great uh together with the rental allows us to explore the behaviors of our application acid is running because we can basically just start application this an application object is a Java Micro Edition MIDlets that's was running in and so it's a multi-threaded application checks and several that has actually so many simple behaviors that is really complex applications and we can have stopped at an actor command line stock loudly given that a mass a break this um replace that and see what happens so that when we have a really weird logs of things that shouldn't be able to happen then we can start by trying to explore the behavior of of our application runtime and see how can we trigger these behaviors and is extremely valuable when you have a domain where you don't really control I mean we control everything right down until the network starts and then we control nothing and today to any application of the j 2 ME uh runtime starbucks energies and specification is sent as good as you think so different user networks behave differently and this gives us the ability to see uh which as we can't control that we have to be able to make sure that our application can handle basically anything gracefully and just dying or something uh so this is the missiles go off course also gives with them and since we do this in part upon his release it at at some cost thing just upsets and random data as response to query the 1 just to see what happens to to our application when things don't behave the way it should and lastly which short unseen good and bad examples using and the thing is that adding a new language is not free and when people want to and from different types of solids and type and you have this huge job of uh enterprise that it's really easy to just slip in job because that space is already 200 Jocelyn there so that works fine the problem is that when you do that as soon as anything breaks it will be pipelines fault and everybody will have paid Python and you forever and so the thing is that can I want to try to use this as an argument it's more fun than writing on this things in Jung said then that in the world and there was the factory was integration and was amazed to win we need to download like 15 packages origin and the giant and Jordan have it's just 1 extra dependency the problem is the job our architects are really used to having lots and lots of dependencies of those data there beyond carry I just download made central everything make it work so this is actually only 1 single argument that has been working for me in corporate environments I can do this and half a day reckoning give it to you in a month or so so this is the golden thing that but it also means that you need to actually forest to integrates strike because otherwise you spend 5 days doing the integration but as I have shown I hope it's really easy to the start um and once you have the right thing you can really really supercharged sure job stacked development and of course sometimes you have to perform which is to issues uh or some other aspects of but for general prototyping and testing especially I think it's there are very many games to that this and I am also times so we don't know if we have time
for questions mean and municipal minutes questions of
few and thanks for the talk so and relief fan of the JVM and I'm a fan of applied uh then that's a little bit said that the joint likes behind in many places so my 1st question would be what the usual many things for example self loads and so on so this is stuff let's for example yet which are dynamic uh what's the benefit of using Piper all words of the JVM languages like Ruby Scala closure there are also the I would say that I would use apart instead of scholar because in all part of the I would say that it's inherently better uh than any of the other alternative the languages on the JVM uh and some kind cases like object Europe especially I'd say that for some cases it's definitely worse on the other hand it's easier to get hold of Java program this program basically but I I would have used to some of their land them as well and I would almost say that that's a choice depending on the competence of the team so the organization working in more than the technical merits of the language machine but the so the 2nd 1 um this you run the purely planning program with giant anywhere like sorry did did you run pure py program was jointly anywhere like production or for test willing or something so what I mean is like having the power of 2 helium but for just having the power for bad I have used it to around and uh to run the threaded concurrency because it's faster on the JVM that if this and see which 1 so that when you do CPU intensive monitoring uh JVM lot faster because uh you can sidestep the dual issues entirely but that's the only case I've actually done pure Python programming in Jonathan otherwise has always been the issue of integration with there's something in existing on the JVM already know try for example to do exactly the so I had a small job Jerry part cherry pie in the world have just benchmark that was stridency pattern that performed worse than giant given so it has was concurrency of course uh so that was that I was that was a little bit disappointing to see tried perform so bad that I mean it's a very there's performance impact of course and uh so I think that the only times that you actually can say that it will be faster is that if if the deal is actually your problem which is most not then and this is 1 solution to that uh but I haven't I don't think you should expect a better performance of don't want is a lot of time and so you have a different understanding of 7 and thanks again confronted with a few
Lecture/Conference
Object (grammar)
Local Group
Process (computing)
Computer animation
Integrated development environment
Software developer
Software developer
View (database)
Software
Bit
Subtraction
Information
Twin prime
Java applet
Interior (topology)
Bit
Mereology
Process (computing)
Malware
Computer animation
Uniform resource name
Office suite
Simulation
Subtraction
Computer programming
Link (knot theory)
Product (category theory)
User interface
Code
Java applet
Multiplication sign
Keyboard shortcut
Interior (topology)
Process (computing)
Loop (music)
Computer animation
Uniform resource name
Lie group
Convex hull
Software testing
output
Units of measurement
Physical system
Group action
Server (computing)
Email
Process (computing)
Mapping
Computer file
Code
Connectivity (graph theory)
Set (mathematics)
Web 2.0
Revision control
Process (computing)
Computer animation
Configuration space
Object (grammar)
Social class
Web page
Enterprise architecture
Mathematics
Computer animation
Multiplication sign
Bit
Quicksort
Gauß-Fehlerintegral
Mereology
Run time (program lifecycle phase)
Metropolitan area network
Service (economics)
Computer animation
Information
Code
Gamma function
Mereology
Error message
Tracing (software)
System call
Rapid Prototyping
Axiom of choice
Program code
Code
Java applet
Scientific modelling
Decision theory
Multiplication sign
System administrator
Strut
Source code
Solid geometry
Mereology
Fault-tolerant system
Proper map
Perspective (visual)
Array data structure
Mathematics
Square number
Cuboid
Descriptive statistics
Social class
Decision theory
Interior (topology)
Bit
Prediction
Unit testing
Functional (mathematics)
Flow separation
Process (computing)
Systems integrator
IRIS-T
Software testing
Right angle
Pattern language
Glass float
Mathematical optimization
Data type
Resultant
Point (geometry)
Computer file
Codebuch
Emulation
Revision control
String (computer science)
Computer hardware
Software testing
Integer
output
Subtraction
Copyright infringement
Scripting language
Element (mathematics)
Java applet
Embedding
Cartesian coordinate system
Computer animation
Personal digital assistant
Function (mathematics)
Computer network
Interpreter (computing)
Iteration
Object (grammar)
Integer
Freezing
Library (computing)
Randomization
Thread (computing)
Java applet
Code
INTEGRAL
Multiplication sign
ACID
GSM-Software-Management AG
Parameter (computer programming)
Solid geometry
Mereology
Food energy
Software bug
Formal language
MKS system of units
Forest
Moving average
Social class
Metropolitan area network
Enterprise architecture
Spacetime
Software developer
Formal language
Connected space
Process (computing)
Data storage device
Order (biology)
Software testing
Data type
Row (database)
Ocean current
Domain name
Game controller
Server (computing)
Implementation
Divisor
Letterpress printing
Control flow
Mass
Login
Surgery
Number
2 (number)
Revision control
Data management
Latent heat
Prototype
String (computer science)
Computer hardware
Software testing
Message passing
Booting
Subtraction
Modem
Run time (program lifecycle phase)
Mobile app
Default (computer science)
BEEP
Chemical equation
Java applet
Content (media)
Coma Berenices
Cartesian coordinate system
Computer animation
Integrated development environment
Factory (trading post)
Computer network
Dependent and independent variables
Object (grammar)
Game theory
Axiom of choice
Computer programming
Concurrency (computer science)
Thread (computing)
INTEGRAL
Java applet
Multiplication sign
Virtual machine
Mereology
Power (physics)
Formal language
Pi
Lecture/Conference
Central processing unit
Software testing
Product (category theory)
Structural load
Bit
Hand fan
Word
Process (computing)
Exterior algebra
Computer animation
Algebraic closure
Personal digital assistant
Self-organization
Pattern language
Object (grammar)
Relief

Metadata

Formal Metadata

Title Jython in practice
Title of Series EuroPython 2014
Part Number 102
Number of Parts 120
Author Håård, Fredrik
License CC Attribution 3.0 Unported:
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.
DOI 10.5446/19978
Publisher EuroPython
Release Date 2014
Language English
Production Place Berlin

Content Metadata

Subject Area Information technology
Abstract Fredrik Håård - Jython in practice A lot of people have heard of Jython, some have tried it, but it seems few have actually deployed it in a corporate environment. In this talk I'll share my experiences in using Jython as a testbed for Java applications, for rapid prototyping in Java desktop and web environments, and for embedding scripting capabilities in Java products. ----- Not everyone gets paid to work with Python all the time, but if you find yourself in a Java project, there are good chances you could benefit from Python without throwing out the Java stack. Using Jython, you can do rapid prototyping without the long edit-compile-test cycles normally associated with large Java projects, whether on the web or the desktop, and when testing an application might become a nightmare of scaffolding in Java, a little Jython may be just what you need to be able to run your tests smoothly. At the end of this talk, I will put on my politician´s hat and bring up the best - and worst - arguments to use to get permission to use Jython in a corporate environment.
Keywords EuroPython Conference
EP 2014
EuroPython 2014

Recommendations

Loading...
Feedback
AV-Portal 3.5.0 (cb7a58240982536f976b3fae0db2d7d34ae7e46b)

Timings

  751 ms - page object