r/javahelp • u/D3v1L_Pup • Apr 26 '19
How important is UML to Java/other languages?
First year programming student at a local community college and in Programming 1 we're learning Java as our vehicle, and towards the end of the class they are really pushing UML diagrams. I honestly hate UML diagrams just because it's extra work that I feel isn't really necessary unless you're really needing to keep track of your public and private variables across a large project to ensure theres not interference.
Is UML actually an important thing I should pay more attention to or not really?
17
u/Grimord Extreme Brewer Apr 26 '19
Tough question. Depends on what you'd call important. If you intend to work in this field you'll definitely find UML diagrams but probably not as often as you may be led to think in college. Some people use it only to generate documentation while others use it sparsely to visually explain certain parts of a project.
There may be people who use it extensively out there in the planning process though I never heard of it, but it'll still be worth your while to get acquainted with UML and learn to read a basic diagram, imo.
10
Apr 26 '19
UML is a great way to get two lead engineers to realize that they're talking about two completely different things
4
Apr 27 '19
Those are the best meetings. That awkward hanging pause when they look back at all the whiteboard madman scribbles they've been screaming and pointing at for the last two hours...
4
u/0-_-_n_-_-0 Apr 26 '19
How do people plan out their programs for n the professional field? I only make UML diagrams because their required but all of my planning is pen and paper. Outlines of classes and methods, maybe a little psuedocode.
7
u/morhp Professional Developer Apr 26 '19
Drawing modules is sometimes common as is writing descriptions. The module diagrams are maybe inspired by UML but not really strictly UML formatted unless that's required by someone.
Classes and methods are relatively rarely planned extensively before the implementation. Interfaces that need to stay compatible will likely be planned in advance. Pseudocode is used very rarely because why write pseudocode when you already can write in a real language? Pseudocode only makes much sense when you implement stuff in ASM or raw C or other cryptic languages later and you really need to plan your code in advance, but Java itself is already so readable that you can simply write stuff directly in Java if you know it and maybe only make minor changes when writing the real implementation later.
15
u/Daedalus9000 Java Developer Apr 26 '19
I've been a professional developer for 10+ years and I have never once seen anyone use UML diagrams when designing a new system or feature. I do see a lot of "boxes and arrows" diagrams, which I guess is a super informal version of UML, but nothing you'd learn about in a class.
2
u/dusty-trash Apr 26 '19
If your college wants you to learn it, then it's important enough to pay attention to it.
I haven't seen it in a work environment except for our Databases.
2
u/D3v1L_Pup Apr 26 '19
I understand the whole "if they're teaching it, you need to pay attention." But I'm curious if it's actually useful/needed in the day to day of a programmers life.
4
2
Apr 26 '19
I think it's great to know about. They come up every once in a while in my work as a software developer. You can kind of figure out what people are talking about without having learned UML much, but it's definitely another helpful tool to have.
There are a lot of things like that in a CS degree. Things which you don't use all the time but are good to have in your toolbelt. A lot of my knowledge about computer hardware and low-level code I don't use on a daily basis, but I am glad that I know about that stuff still. I would be happy if I had gone over more UML in college and knew about it now.
4
4
u/amackenz2048 Apr 26 '19
UML seems great and useful. Aside from a few diagrams here and there nobody uses it. It's too rigid to be very useful. I always just resort to diagrams in Visio.
4
u/ElFeesho Apr 26 '19
When I draw diagrams on whiteboards, I tend to use the uml notation I remember, but, the drawings I'm doing are not for documentation purposes, but just explaining a subsection of a system. In that situation, the diagram isn't useful, the process of drawing the diagram is.
If I were documenting a system or library I was to ship, then I may consider following UML.
4
u/slowfly1st Apr 26 '19 edited Apr 26 '19
We use it rarely. I really understand your situation. I expected to do much more UML when I was student. Here are some examples, when we sometimes used it:
When things get complicated, e.g. a state machine. Can be quite handy when implementing or finding errors.
... and therefore also for documentation. We have a part of our system which is awfully complicated, several other systems are involved, several conditions for several other steps need to be fulfilled, sometimes exact times have to be reached, other things have to be done if that time is not reached, and so on. We have a diagram for that, and we all are really really thankful for the guy who did it =)
Communication, e.g. with a customer (for instance to visualize a process, e.g. a sequence diagram. Those we also put sometimes in our specifications).
When we explain things, usually on pen and paper.
When we try to refactor things
... just checked by notebook: I have three UML diagrams (two class and one sequence-diagram, time range of about half a year)
... I actually use it probably much more often than others, simply because I also educate our students haha :P
But it's most of the time not proper UML, the main intent we use it is to visualize things, how components interact with each other for easier communication or easier understanding of parts of the code. You will have probably an awful long discussion about when something is a composition and when something is an aggregation. But you will never care about this again. You won't write down all the methods and attributes of a class in a class diagram, or draw an interface with its implementations, or you don't care if you use a "implements-inheritance"-arrow or the "extend-class"-arrow.
IMO it's a good thing to know the basics of UML, what diagrams there are and when to draw what diagram. (But honestly, there's diagrams I've never used again), "Complete" diagrams (0..1-dependency or *-dependency, composition or aggregation, using xor-constrains, writing down all the methods with the correct access modifiers and what not) are simply not necessary, because it is imo counterproductive - it may be precise/complete, but it's hard to understand the essentials of how something works or should work.
3
3
u/Triippz Apr 26 '19
I’ve done “pseudo-uml” in design documents, for software but mainly I have only used it in database designs for various entities. Other than that, we use flow charts heavily when designing new subs systems and applications.
3
u/srk- Apr 26 '19
I am on Java for last 9 years, never used it at work nor found any colleague of mine use it. Just another use case of stupid university/certificate/degree based education on contrary to real-time.
2
u/thekab Apr 26 '19
UML is extremely rare. Visualizations that borrow some concepts from UML aren't uncommon. It's the kind of thing I have to deal with once or twice a year at "enterprise Java" companies.
2
u/ReaverKS Apr 27 '19
I just used a sequence and class diagram in a software design review today but the project is in python not java. I don’t think they’re terribly common but you’ll see some sooner or later
2
u/AmateurHero new Intermediate("this.user") Apr 27 '19
Ive used UML class diagrams once, and I think I'll use it for a specific example going forward.
No one really uses it, because it's largely redundant when you have access to the code base. But where it came in handy for me was diagramming an internal library that I always had trouble explaining during onboarding. There are a few layers of abstract classes in that library that basically hide some methods that you must override. It's apparent if you take a deep look traversing the class hierarchy, but otherwise, it just looks like magic. A UML diagram allows me to give a quick, confusing rundown of the library and implementation and then a complete layout of it all when it has always instantly clicked for everyone.
Sequence diagrams aren't talked about as part of UML, but they're good for mapping out systems with lots of communication between multiple parties. Most people probably won't need one, because interaction is usually silo'd pretty well. But in larger corporate environments with legacy services, modern versions of those legacy services that never completely replaced the old ones, an enterprise service bus, a notification system, an external system of record, etc., it can be confusing what team is doing what at a specific time. Doubly so when organizatial changes happen. A sequence diagram (when it isn't bogged down in detail) can clearly map out these interactions.
With all that being said, don't worry too much about it. There are thousands of guides that tell you what all of the symbols mean.
2
Apr 27 '19
I am currently building upon a library a coworker wrote a while ago. The very first thing I requested was the UML so I could understand who are interfaces who are the sure classes and how these different classes work together. So, I order t maintain very big projects , UML and documentation are very important
2
u/trisul-108 Apr 27 '19
It seems to me that UML was a good idea badly implemented. Simple UML diagrams do not help at all, complex ones take too much space to be useful. The graphic language they developed for UML is just not concise enough, it conveys too little information per square inch of space.
2
u/SthoThaDtothaH Apr 27 '19
UML is used a lot in enterprise projects with government contracting. System engineers consider these helpful for documenting how the software will work to the customer, however I have found as a software engineer the implementation of the software does not tightly couple with UML. However, if you are doing Java, PlantUML can demonstrate the code you are writing, thus you can more closely document the activity. It all depends on what kind/size of company you want to work for. Industries like aeronautics, aerospace, mechanical engineering, any industry that involves a lot of planning before actual development, UML is useful. Just my opinion. Not truth.
2
u/HelenSteeply1138 Apr 28 '19 edited Apr 28 '19
I would say having exposure to it is useful.
I sometimes borrow UML idioms when whiteboarding. And it can be good for describing database schemas. But detailed UML diagrams of java classes are rare and basically useless, IMHO.
So, maybe just treat it as a slightly stupid way of learning something that might be useful in other contexts.
Source: enterprise 20-year enterprise java coder.
2
u/FrenchFigaro Software Engineer May 02 '19
The only time I've actually used class diagrams to represent classes, was during internship reports and class assignments. However, I've used them massively to represent databases when kickstarting projects. However, at some point or another, the DB becomes too big to be accurately represented legibly on a single screen. Sometimes I have had to read component diagrams to understand complex systems when a lot of services call each other during a single interaction.
However, I have had to read sequence diagrams and use case diagrams a lot in documentation. Usually they correspond with behaviours expected by the client.
As a developper, I have found that translating my work into UML is one of my most useless skills. But being able to read UML diagrams was a very useful one.
3
u/Stevke11 Apr 26 '19
UML diagrams are used in the process of developing new Information System, for example Use case diagram, sequential diagram etc.
1
1
u/daybyter2 Apr 27 '19
I used UML in many projects. Used together/j and later ArgoUML to which I contributed some code. Sometimes I just use a sheet of paper to draw some use cases as a start. Or a class structure diagram to layout some class responsibilities. It is sad, that UML actions never really took off.
2
u/D3v1L_Pup Apr 26 '19
Thanks for all the responses, everybody. I really appreciate the thoughtful responses.
On Monday I'm taking the final for Programming 1, which I should pass just fine. I'm pretty good at programming and problem solving, but sometimes I flub on the tests. UML is just one of those annoyances that I don't see myself willfully using on most occasions, but we'll see.