Expressive Design (in 20 minutes)

Loading...

Flash Player 9 (or above) is needed to view presentations.
We have detected that you do not have it on your computer. To install it, go here.

0 comments

Post a comment

    Post a comment
    Embed Video
    Edit your comment Cancel

    8 Favorites

    Expressive Design (in 20 minutes) - Presentation Transcript

    1. Expressive Design (in 20 minutes) phillip calçado http://fragmental.tw
    2. javamail usage
    3. I want this CSV report delivered as an e-mail attachment
    4. 1st Try
    5. public class Mail { public void sendEmailWithCsvFile(String from, String to, String subject, String body, List<String> csvFileLines) { Properties props = new Properties(); props.put(\"mail.smtp.host\", \"localhost\"); Session session = Session.getDefaultInstance(props); MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress(from)); InternetAddress[] address = { new InternetAddress(to) }; msg.setRecipients(Message.RecipientType.TO, address); msg.setSubject(subject); msg.setSentDate(new Date()); MimeBodyPart part1 = new MimeBodyPart(); part1.setText(body); MimeBodyPart part2 = new MimeBodyPart(); StringBuffer buffer = new StringBuffer(); for (String line : csvFileLines) buffer.append(line + \"\\n\"); part2.setContent(buffer.toString(), \"text/csv\"); part2.setFileName(\"file.csv\"); Multipart mp = new MimeMultipart(); mp.addBodyPart(part1); mp.addBodyPart(part2); msg.setContent(mp); Transport.send(msg); } }
    6. Message.RecipientType I want this CSV report delivered InternetAddress Multipart as an e-mail attachment MimeMessage MimeBodyPart Session Properties
    7. 2nd Try
    8. public class Mail { public void sendEmailWithCsvFile(String from, String to, String subject, String body, List<String> csvFileLines) { Properties props = new Properties(); props.put(\"mail.smtp.host\", \"localhost\"); MailService mailService = new MailService(props); MailMessage message = mailService.newMessage(); message.setFrom(from); message.setTo(to); message.setSubject(subject); message.setBody(body); StringBuffer buffer = new StringBuffer(); for (String line : csvFileLines) buffer.append(line + \"\\n\"); Attachment csvFile = new Attachment(\"file.csv\", buffer.toString()); message.attach(csvFile); mailService.send(message); } }
    9. I want this CSV MailMessage Attachment report delivered as an e-mail MailService Properties attachment
    10. 3rd Try
    11. public class Mail { public void sendEmailWithCsvFile(String from, String to, String subject, String body, List<String> csvFileLines) { StringBuffer buffer = new StringBuffer(); for (String line : csvFileLines) buffer.append(line + \"\\n\"); Properties props = new Properties(); props.put(\"mail.smtp.host\", \"localhost\"); MailService mailService = new MailService(props); mailService.newMessage() .from(from) .to(to) .subject(subject) .body(body) .attachTextFile(\"file3.csv\", buffer.toString()) .send(); } }
    12. send_email do to 'pcalcado@gmail.com' from 'bemaia@fragmental.tw' subject 'Testing via Ruby' body %{ Hi, Please do not forget the milk. Bye! } attachment('file4.csv') << lines end
    13. I want this CSV E-mail report delivered as an e-mail Attachment attachment
    14. what just happened?
    15. Noise Reduction
    16. Noise the difference between I want this CSV E-mail report delivered as an e-mail Attachment attachment
    17. Noise the difference between I want this CSV E-mail report delivered This as an e-mail Attachment attachment
    18. Noise the difference between I want this CSV E-mail report delivered This That as an e-mail Attachment attachment
    19. Noise the difference between Business Analysis Design Implementation public class Something{ Class Name Class Name Attribute Attribute Attribute Attribute private String name; Operation Operation Operation Operation public boolean doS(){ } Class Name Attribute } Attribute Operation Operation This That
    20. the goal
    21. I want this CSV report delivered as an e-mail attachment
    22. I want this CSV report delivered as an e-mail E-mail attachment
    23. I want this CSV report delivered as an e-mailE-mail attachment Attachment
    24. the techniques
    25. Noise Idiomatic” Java Domain-Driven Design Internal DSL External DSL?
    26. “Idiomatic”: Focus on how to use technical tools to solve the problem in an efficient way. Domain-Driven: Language is only a tool to model the domain. Internal DSL: Language is only an :internal { extensible tool to model the DSL domain. } External DSL: Language is created based on the domain.
    27. “Idiomatic”: TFocus on how to use DO: a O e e d r n am technical toolsr thato solve the Ne te be t t fo problem in an efficient way. Domain-Driven: Language is only a tool to model the domain. Internal DSL: Language is only an :internal { extensible tool to model the DSL domain. } External DSL: Language is created based on the domain.
    28. Thanks http://fragmental.tw
    29. pics • http://www.flickr.com/photos/bitzi/293673587/ • http://www.flickr.com/photos/sage/2143086954/ • http://www.flickr.com/photos/brianmitchell/2113553867/ • http://www.flickr.com/photos/kamaski/186266747/ • http://www.flickr.com/photos/tosawyer/43691981/ • http://www.flickr.com/photos/helderfontenele/2134684620/ • http://www.flickr.com/photos/sotto1/808195510/

    + Phillip CalçadoPhillip Calçado, 8 months ago

    custom

    2140 views, 8 favs, 5 embeds more stats

    More info about this document

    © All Rights Reserved

    Go to text version

    • Total Views 2140
      • 1650 on SlideShare
      • 490 from embeds
    • Comments 0
    • Favorites 8
    • Downloads 29
    Most viewed embeds
    • 463 views on http://fragmental.tw
    • 20 views on http://tecnologia.proac.uff.br
    • 5 views on http://static.slideshare.net
    • 1 views on http://74.125.159.132
    • 1 views on http://74.125.91.132

    more

    All embeds
    • 463 views on http://fragmental.tw
    • 20 views on http://tecnologia.proac.uff.br
    • 5 views on http://static.slideshare.net
    • 1 views on http://74.125.159.132
    • 1 views on http://74.125.91.132

    less

    Flagged as inappropriate Flag as inappropriate
    Flag as inappropriate

    Select your reason for flagging this presentation as inappropriate. If needed, use the feedback form to let us know more details.

    Cancel
    File a copyright complaint
    Having problems? Go to our helpdesk?

    Categories